Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing content in multiple languages? E.g. English, French, German

How should I store (and present) the text on a website intended for worldwide use, with several languages? The content is mostly in the form of 500+ word articles, although I will need to translate tiny snippets of text on each page too (such as "print this article" or "back to menu").

I know there are several CMS packages that handle multiple languages, but I have to integrate with our existing ASP systems too, so I am ignoring such solutions.

One concern I have is that Google should be able to find the pages, even for foreign users. I am less concerned about issues with processing dates and currencies.

I worry that, left to my own devices, I will invent a way of doing this which work, but eventually lead to disaster! I want to know what professional solutions you have actually used on real projects, not untried ideas! Thanks very much.


I looked at RESX files, but felt they were unsuitable for all but the most trivial translation solutions (I will elaborate if anyone wants to know).

Google will help me with translating the text, but not storing/presenting it.

Has anyone worked on a multi-language project that relied on their own code for presentation?


Any thoughts on serving up content in the following ways, and which is best?

  • http://www.website.com/text/view.asp?id=12345&lang=fr
  • http://www.website.com/text/12345/bonjour_mes_amis.htm
  • http://fr.website.com/text/12345

(these are not real URLs, i was just showing examples)

like image 912
Magnus Smith Avatar asked Nov 18 '25 21:11

Magnus Smith


2 Answers

Firstly put all code for all languages under one domain - it will help your google-rank.

We have a fully multi-lingual system, with localisations stored in a database but cached with the web application.

Wherever we want a localisation to appear we use:

<%$ Resources: LanguageProvider, Path/To/Localisation %>

Then in our web.config:

<globalization resourceProviderFactoryType="FactoryClassName, AssemblyName"/>

FactoryClassName then implements ResourceProviderFactory to provide the actual dynamic functionality. Localisations are stored in the DB with a string key "Path/To/Localisation"

It is important to cache the localised values - you don't want to have lots of DB lookups on each page, and we cache thousands of localised strings with no performance issues.

Use the user's current browser localisation to choose what language to serve up.

like image 197
Keith Avatar answered Nov 20 '25 12:11

Keith


You might want to check GNU Gettext project out - at least something to start with.

Edited to add info about projects:

I've worked on several multilingual projects using Gettext technology in different technologies, including C++/MFC and J2EE/JSP, and it worked all fine. However, you need to write/find your own code to display the localized data of course.

like image 40
Michael Pliskin Avatar answered Nov 20 '25 10:11

Michael Pliskin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!