tags:

views:

73

answers:

3

Hi guys,

Does somebody knows a simple php language switcher. I'm not really a PHP savvy and I would like your help.

Thanks in advance.

A: 

yeah it requires some modifications 1. seperate your business logic from presentation layer via templating 2. in your presentation layer remove hard-coded text and replace it with php-variables 3. create your language files 4. depending on how you solved the case, puzzle your app together(hand over the data from the language files in the presentation layer)

w13531
+1  A: 

There's no free ride here. You'll have to provide translated strings for every message displayed by your program. This article will get you started: Internationalization in PHP 5.3

bemace
+1  A: 

The answer has already been posted, but let me give a brief explanation here.

Computers aren't smart. They don't understand higher level concepts like language. The fact is: computers can't look at a sentence and know what it means. Using advanced math and algorithms we can dissect the sentence and try to recognize key words, but something as simple as a misspelling could throw the whole algorithm for a loop.

Web services which perform automatic translation are not only buggy, but also tend to require LOTS of power and resources. That's why they're often only owned and operated by companies like Yahoo! (Babelfish) or Google (Google Translate).

Whenever a website has a simple feature for changing language (phpBB has a feature like this built in) the simple fact is that they typed everything several times. Once in English, one in Spanish, once in German... Then by clicking a button it determines whether to send you the English text, Spanish text, or German text. The same is true of wikipedia. When you view an article in two different languages they are not by ANY means the same article. Many times I'll read the Spanish wiki and the information will differ drastically. Two different people wrote two different articles, and by selecting a language you're just telling wikipedia which article to send you.

Your best bet if you really need your website translated at the click of a button is to add Google's Translate Tools. http://translate.google.com/translate_tools

steven_desu