Localization and JQuery/JavaScript
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?
开发者_JS百科Thanky you
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.
精彩评论