views:

55

answers:

1

Hello!

I'm planning on developing a website that uses two languages, instead of making separate htmls one in language "a" and one in language "b", I wanted to know what do you recommend? What should I be looking at if I want to change the value of the variables like buttonNames instead of designing a separate thing?

Or should I be designing two htmls, one dynamic web template for language "a" and one dynamic web template for language "b"?

Thanks!

So far I'm using html, javascript/jquery, I don't need any database access or something, it's basically an informative webpage. No login etc.

+1  A: 

Your question is very subjective. In most practical cases you end up storing 2 distinct copies of the HTML. Some people may have different abstractions for the content, perhaps if a content management system is in use but somewhere you have a string in language 1 and another for each other language you support.

You can make supporting multiple languages easier by:

  • Using unicode everywhere. Joel Spolsky has a popular article on unicode.
  • Being smart about how you store the HTML. If you use a relational database you might want to have a table with a secondary key identifying the language for the content in that row (columns: PageID, PageLanguage, HTMLContent). You then have a new row for each language. The example was just for conceptual purposes.
  • For things other than content in the website, perhaps navigation, then you might want to use something along the lines of resource files that get loaded in depending on the user's language preference. Each resource file gets translated to a new language each time you need to add one.
BrianLy