Menu
Hiya,
What are the best resources for making a website compatible with many languages?
For example, you can click ‘English’, ‘French’, or ‘German’ on the actual website and then the whole site would obviously become English, French or German, without going to an external site – this will be all inside the site.
I’m not sure what topic this should have gone under – my apologies in advance; this is a new one to me.
Any help with this would be most appreciated.
Thank you.
Tony ?
Hi, a popular way of providing one webiste in many languages is with a "url prefix", for example:
www.yoursite.com/en/page1 ,www.yoursite.com/en/page2
www.yoursite.com/tr/page1 ,www.yoursite.com/tr/page2
www.yoursite.com/ru/page1 ,www.yoursite.com/ru/page1
This way you can determine which version to server by looking into first /xx/ parameter. This is an approach adopted by Symfony framework:
http://www.symfony-project.org/book/1_0/13-I18n-and-L10n [/QUOTE]
Other approach I have seen in other websites is upon login you are asked to choose your language and country so as to speak. Then the application uses cookies to store your language and country preferences for all subsequent pages navigation. Such technique has a flaw as in one can disable cookies and it will not work again.
So I still like the url prefix method. Simple and effective ?[/QUOTE]
There is no need to store that data in a cookie if the user is also logging in. That data can be stored with login information on the server and used regardless of cookies being enabled.[/QUOTE]
Are there any other url prefix frameworks/techniques that can be used for this?
[/QUOTE]
Thank you Dave - this also sounds great.
Could you please give me some more pointers? Mainly:
How would the foreign language code be generated in the xml - Manually!?
[/quote]
<i>
</i><page>
<name>homepage</name>
<line id="1" language="en">Hello</line>
<line id="1" language="fr">Bonjour</line>
</page>
Do you know of a framework that I could start from?
[/QUOTE]
<span class="langEnglish" style="display:none">ENGLISH</span>
<span class="langRussian" style="display:none">Русский</span>
<script type="text/javascript">
switchLanguage();
function switchLanguage() {
var spans = document.getElementsByTagName("span");
for (var i = 0; i < spans.length; i++) {
theLanguage = spans[i].className;
if (theLanguage != undefined) {
if (theLanguage.indexOf("lang") != -1) {
spans[i].style.display = 'none';
switch (theLanguage) {
case "langEnglish":
if (languageSwitch == theLanguage) {
spans[i].style.display = '';
}
break;
case "langRussian":
if (languageSwitch == theLanguage) {
spans[i].style.display = '';
}
break;
default:
// do nothing
} // end case of determining which language
} // end if div contains "lang"
} // end if div does not define a name
} // end for each div in document
}
0.1.9 — BETA 6.17