• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 577
  • Last Modified:

asp.net 4.0 / Javascript - How to make my web app MultiLingual?


I have a relatively large asp.net app in framework 4.0

I write a lot of the HTML in the code behind and write it out as a Literal etc

I now need to make the app multilingual
its also heavily Javascripted

Does anyone know of any good articles/videos and some quick (or detailed) advise to get me started

I've looked at a web app that uses Resx Files
Performance is a big issue too

1 Solution
Alexandre SimõesManager / Technology SpecialistCommented:
There's no one only way to do that, even within the same application.
There are different sources of localized data that need to be handled differently.
You usually have:

Static text rendered upon page load

This should be handled server-side to avoid flickering. If you translate everything client side you might experience visual problems on slow machines where the user actually see the text appearing or changing.
If you're on .net you can use the resx files, it's easy to use and the default way of doing this on the .net backend.

Lookup data that comes from the DB

Lookup data must arrive at your application layer already translated, otherwise you'll find yourself looping through all the records and replacing the text.
On each lookup table you need to add a LanguageCode CHAR(2) column (assuming SQL db) and each entry has a value per language.
Maintenance is also way easier as each time a new item is added to the lookup table you need to add a line per language. To get the lookup list you have to say in which language you want it.
If you need this data too often and see that too many requests become heavy use server-side cache.

Dynamic text generated client-side

This kind ot text is the one that can be done in 2 ways, either manage everything in javascript with a i18n framework or store them also in resx and pass them to the front-end as json (preferable) of hidden fields.

Calm down and breathe...

Any option will involve a lot of work.
It's always better to foresee this requirement at the beginning... you'll refactor a lot of code.

Have fun!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now