volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

EPiServer Translate in JS

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

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
error 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.