SharePoint 2013 is new and we didn't find documentation for many items. One of missing items detailed documentaion about scripts in display templates.
I need to localize my template after I checked existing templates I found localization through JavaScript:
I need to localize my template after I checked existing templates I found localization through JavaScript:
- They added local string in resource javascript file. You can create a JavaScript and add to your code as below:
<script>
$includeLanguageScript(this.url, "~sitecollection/_catalogs/masterpage/Display Templates/Language Files/{Locale}/YourCustomStrings.js");
< /script > - Code you will add to JavaScript:
// Add your custom localized strings and then include these string dictionaries in your display templates using the $includeLanguageScript function
$registerResourceDictionary("en-us", {
"sampleCustomStringId": "Sample custom string",
"rf_RefinementTitle_ManagedPropertyName": "Sample Refinement Title for ManagedPropertyName"
}); - To access resource using the following code:
var diagRes = $resource("item_Diagnostic_ItemTitleFormat");
No comments:
Post a Comment