EPiServer Translate in JS

Vote:
 

Is there any way to translate texts in EPiServer in JavaScript?

In code behind one can usually do:

LanguageManager.Instance.Translate("#translatedText");

Is there any corresponding way to achieve the same thing using JavaScript? What I want to do is to translate some button labels and things like that.

#55503
Dec 06, 2011 8:25
Vote:
 

We usually LinqToXml a specific lang file to find the keys available for JS and then look at HttpContext.Current.Request["epslanguage"] and generate a little JSON put in javascript scope before other scripts:

var projectTranslatedStrings = {
	templates: {
		project: {
			footer: {
				printlinktext: 'Skriv ut sidan'
			},
			documentsection: {
				gobacklinktext: 'Tillbaka'
			}
		}
	}
};

    

#55509
Dec 06, 2011 11:16
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.