Oscar Wild

Oscar Wild

  • 1.9k
  • 3
  • 2.1k

Javascript localization

Jan 31 2013 11:32 PM
Hello everyone! Can anyone help me with localization on javascript in Visual Studio?
I have a simple Visual Studio web application. Programming language is C#. I want to do something like adding 3 javascripts to the page. One in russian, one in english and one in kazakh. For example: <script type="text/javascript" src="englishLanguage.js" /> In "englishLanguage.js" would be all my English variables. And on the page, I would get those variables. However, I wasn't able to do so.

In aspx page in the head, I am adding some scripts.
<script runat="server" type="text/javascript" src="russianLanguage.js" charset="utf-8" > </script>
<script runat="server" type="text/javascript" src="englishLanguage.js" charset="utf-8" > </script>

<script type="text/javascript">
Some function to retrieve the variable from those scripts based on the current culture (englishLanguage.js,russianLanguage.js)
</script>

In those scripts lies the simple string: var uilanguage = { someString: "russian string" }; --- for russianLanguage.js

var uilanguage = { someString: "english string" }; --- for englishLanguage.js

Any example would be helpful!

Please help!

Thanks!

Answers (2)