• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Architecture for a multilingual website

LightningRider

Senior member
Hey guys

I'm going to be developing a website that is going to be in two languages. I think that having two files for each page, one for each language is kind of hard to maintain.

I'm wondering if the best way to implement multiple languages is not to either store the content in each language and then retrieve the correct label depending on which language the user has selected.

What do you guys think? I'm pretty sure that this would be the best as far as maintainability goes, but what is the most performing way to accomplish this? Storing text in a MySQL database? Or would it be better to have XML files or something else, etc?

Thanks
 
What language are you using for the website?

One way to do it in Java is to use ResourceBundles (http://java.sun.com/developer/...Intl/ResourceBundles/) and create text files with all of your application text. Each language gets its own text file. If done properly, you can add new languages simply by translating the application text and creating a new resource file.

I've seen similar approaches done using databases. Depending on your performance requirements, you may want to cache your system text in memory so that you're not constantly reading from text files and or databases.
 
It really depends on your site and what kind of content and how much content you are providing.

If all you need is labels (this would include form field labels, buttons, menu items, etc, etc) to be in a different language, then yes, a text file is your best bet, as the overhead of SQL queries would be silly. However, you're probably going to be using some kind of content management in a database for the actual content of the pages. For this, you'd use a hybrid solution, with text files being your labels and the database providing your content.

There really is no wrong way to implement this as long as it works for you and you're satisfied with the result. Me, personally, I would use text files to handle labels and then just duplicate translations in the database for any actual content I had. Really wouldn't be that difficult, honestly.
 
Back
Top