Search code examples
sitecoresitecore7

How to obtain sitecore locale value for ISO translations


I am working with angularJS in Sitecore and need to add the localization layer to Angular and therefore need to obtain a variable from Sitecore for the current language/locale

In my html I need to access files of the type: angular-en-gb.js or angular-de-de.js for example so I am hoping to concat a value from Sitecore to the pattern:

"path-to-js/angular-" + locale + ".js"

Thanks for your help.


Solution

  • You should use Sitecore.Context.Language.

    string filepath = "path-to-js/angular-" + Sitecore.Context.Language.Name + ".js";