6

I'm working on different language packs for my web app. Some of the output is generated by the JavaScript/JQuery and I can't use .aspx.resx resource files within the JavaScript. What options do I have in order to localize output produced by the client?

Thanky you

1 Answers1

5

The most common way I've seen is different .js language files being kept in a lang/ or locale/ folder in the project, with only the file for the current language being included using a <script> tag.

If you want to manage your languages in one, central, server-side place, I think you would indeed be best of outputting your translations from ASP as a JavaScript file. I don't know ASP but that should be perfectly possible to do - just remember to send a Content-type: text/javascript header along.

Related, PHP oriented but doesn't really matter: this question. Check out the translation plugins mentioned there, they may save you work additionally.

Community
  • 1
  • 1
Pekka
  • 442,112
  • 142
  • 972
  • 1,088
  • Thank you very much! :) Can't vote yet due to low rep....sorry! What you have said makes sense, I'll write some code in few minutes and will tell you how I got on. –  May 21 '10 at 09:49
  • Hi, Sorry for the late reply. This worked just fine, still a bit worried about maintenance overhead, but it should be manageable once I re-factor the script files. –  May 24 '10 at 08:25
  • @vikp nice to hear. And yes, if the script files are fed by the server side dictionary, overhead should become almost zero! – Pekka May 24 '10 at 09:20
  • 1
    I store part of the filename in the dictionary and than build the complete filename. For example: KeyValue | EN –  May 24 '10 at 16:36