views:

54

answers:

1

Hi,

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

+3  A: 

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.

Pekka
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.
vikp
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.
vikp
@vikp nice to hear. And yes, if the script files are fed by the server side dictionary, overhead should become almost zero!
Pekka
I store part of the filename in the dictionary and than build the complete filename. For example: KeyValue | EN<script path="\\SomePath\> + <%: (string) GetLocalResource(KeyValue) %> + "\TheRestOfThePath.js ">
vikp