Reply to Re: i18n - how best to provide multilingual content

Your name:

Reply:


Posted by John Murtari on 01/24/07 18:12

CptDondo <yan@NsOeSiPnAeMr.com> writes:

> I have a small, embedded app that uses a webserver to serve up pages
> showing status, etc.
>
> Right now all the pages are hard-coded in English. We need to provide
> multi-lingual support.
>
> All of the pages are PHP generated. Ideally, I'd like for the PHP
> backend to serve up the language based a) the user's locale, and if
> that is not set, its own locale.
>
> The PHP backend creates the pages on the fly from XML templates, so it
> wouldn't be that hard for us to change the language.
>
> But... I don't know the best way to do that. What is the current
> 'state of the art' for language on demand in web content?
>
> Thanks....

Like you said, go with gettext(). We just finished a
fairly large app that was to be multilingual. We used gettext
for the small stuff like "Login here". In cases where there
were larger blocks of text we would set a variable $defLang
based on the language the user was using, and in the code,

include(TEXT_DIR."/$defLang/this-usage.txt");

whenever we needed it. There was a root TEXT_DIR, with sub
dirs for each locale. File names were the same and it made
it easy for the end users to update each file for each language.

For graphic buttons it was a similar approach:

<img src=<?=BUTTON_DIR."/$defLang/login.gif"?> ......>

It worked easy for us. Probably the biggest thing we
did for the end user was create a simple PHP page that would
scan all the source files for gettext and put up a tabular
display of each phrase and the translation, if any, in each
of the target languages, and they could enter the translations
right there. They did not have to deal with the raw message
files.

Hope this helps.
--
John
___________________________________________________________________
John Murtari Software Workshop Inc.
jmurtari@following domain 315.635-1968(x-211) "TheBook.Com" (TM)
http://thebook.com/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация