<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>localize display template</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/localize_display_template/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/localize_display_template/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 04:08:17 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>How To Localize Display Template In SharePoint 2013</title>
      <link>https://docs.microsoft.com/archive/blogs/localize_display_template/how-to-localize-display-template-in-sharepoint-2013</link>
      <pubDate>Thu, 14 Nov 2013 21:40:00 GMT</pubDate>
      <dc:creator><![CDATA[Aatish Agarwal]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/localize_display_template/2013/11/14/how-to-localize-display-template-in-sharepoint-2013/</guid>
      <description><![CDATA[Display Templates&nbsp;are localized with the help of resource files. A resource file is referenced...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: verdana,geneva;">Display Templates&nbsp;are localized with the help of resource files. A resource file is referenced inside a Display Template&nbsp;in&nbsp;the following way.</span></p>
<p>&nbsp;</p>
<p><code class="js">&lt;script&gt;</code></p>
<p><code class="js">&nbsp;$includeLanguageScript(this.url,"~sitecollection/_catalogs/masterpage/Display Templates/Language Files/{Locale}/Strings.js");</code></p>
<p><code class="js">&lt;/script&gt;</code></p>
<p>&nbsp;</p>
<p><span style="font-family: verdana,geneva;">A resource file is a JavaScript file which registers a resource dictionary. The resource dictionary&nbsp;contains <span style="font-family: verdana,geneva;">the resource strings. </span>&nbsp;</span><span style="font-family: verdana,geneva;">For example, a resource file for "en-us" Locale with some resource strings is shown below.</span></p>
<p><code class="js"></code>&nbsp;</p>
<p><code class="js">// Add your custom localized strings and then include these string dictionaries in your display templates using the $includeLanguageScript function</code></p>
<p><span style="font-family: verdana,geneva;"><span style="font-family: verdana,geneva;"><code class="js">$registerResourceDictionary("en-us",<br /> {"resourceKey1": "resourceValue1", <br /> "resourceKey2": "resourceValue2", <br /> "resourceKey3": "resourceValue3"});</code></span></span></p>
<p>&nbsp;</p>
<p><span style="font-family: verdana,geneva;">For changing Display Template content&nbsp;with culture, create a&nbsp;resource file for each of the supporting culture and deploy it to the master page gallery&nbsp;in the language files folder,&nbsp;in the corresponding Locale folder.</span></p>
<p><span style="font-family: verdana,geneva;">Then, use the following code to reference the resource key in the display template.</span></p>
<p><code class="js"></code>&nbsp;</p>
<p><code class="js">var resourceString1 = $resource("resourceKey1");&nbsp;&nbsp; //This will fetch the value - resourceValue1</code></p>
<p><code class="js"></code>&nbsp;</p>
<p><code class="js"></code>&nbsp;</p>]]></content:encoded>
    </item>
  </channel>
</rss>