What can I add to my website?

I made a website in English, what's the most optimal way to add one more language?

  • So, I have created a big website (a lot of text in different files and a lot of programming). I need to add one more language, how should I do? What is the fastest way I can add second language and let my visitors to choose between them? Any ideas? Thanks.

  • Answer:

    Translation is something you have to think about from the beginning, especially with dynamic sites. Make sure all of your messages are split into a separate file or files which a translator can work on. There is an art form to this - you want large text blocks with formatting specifiers, as different languages don't follow the same noun/verb/adjective order. For instance, making text strings such as "Please choose" followed by "items" where the middle is a number is a bad idea, make the string "Please choose %d items" - this allows the translator to place the number in the ideal location. You want a strong translation tool. The fill full of string constants is acceptable, but has poor usability. Try gettext which is a mature tool for doing translations.

evening at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

My suggestion is: write the content in separeted xml files, one for each language, and depending on the language of the user, you will load your website retrieving the content from the Xml that contains the selected language.

Rbacarin

Regardless of your approach, you are going to need to store all of your outputted strings in a separate resource. Flat files with arrays would be the fastest, though an SQLite database would be more flexible. If you were to use arrays, you would basically just make a few language files, such as english.php: $lang = array( 'I am a language.' => 'I am a language.' ); ... and french.php: $lang = array( 'I am a language.' => 'Je suis une langue.' ); Then you could make a static Language class that would import the appropriate language file, and return translated strings based on the array in that file. For example: Language::init('french'); ... echo Language::get('I am a language.'); // outputs Je suis une langue.

Daniel

First you need to http://en.wikipedia.org/wiki/Internationalization_and_localization your entire web site, and then you need to http://en.wikipedia.org/wiki/Language_localization it into your target language. This is another case where the only numbers that matter are zero, one, and infinity. Either you support zero languages (there is no human interface at all), one language (which you just hardcode throughout), or any number of languages. Adding one more language is no easier than adding 10 more.

Daniel Pryden

Amitabh

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.