I need to replace one word in my SharePoint site, depend in on that what language is used. I found this question: Get the current UI language with ECMAScript
I tried to use that code and it works only, if I add it into script editor and my page is in edit mode. If I try to add it to master page, it won't work. If I add it to external js-file, it won't work:
Firebug gives error message:
"SP.Res is undefined"
Master page code: ExecuteOrDelayUntilScriptLoaded("multilanguage.js", "sp.js")
If I try to use other solution (same link, last post), Firebug gives error message:
"ReferenceError: g_wsaLCID is not defined"
"var lcid = g_wsaLCID;"
My example code:
<script type="text/javascript">
var lcid = SP.Res.lcid;
if(lcid == "1033")
{
alert('English'); /* Works only, if it in script editor and page is in edit mode */
}
</script>
What I'm doing wrong? How I can get it to work? Why it is working only script editor and page is edit mode?