Re: Re[2]: How to do i18n better?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2010-04-20 at 13:34 +0300, Andre Polykanine wrote:
> Hi Ash,
> 
> Yepp, it's understood. But how exactly did you store the
> language-specific strings: in an array or using another way?
> 
> 
> -- 
> With best regards from Ukraine,
> Andre
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: m_elensule
> 
> ----- Original message -----
> From: Ashley Sheridan <ash@xxxxxxxxxxxxxxxxxxxx>
> To: Jason Pruim <lists@xxxxxxxxxxxxxxxxxxxx>
> Date: Tuesday, April 20, 2010, 2:17:47 AM
> Subject:  How to do i18n better?
> 
> On Mon, 2010-04-19 at 19:17 -0400, Jason Pruim wrote:
> 
> > On Apr 18, 2010, at 6:55 PM, Andre Polykanine wrote:
> > 
> > > Hi everyone,
> > >
> > > I posted this in the PHP-i18n list, however got no answer so trying
> > > here).
> > > We are making a blog platform (http://oire.org/) which is provided in
> > > several languages (currently they are Russian, Ukrainian, and
> > > English).
> > > Now the i18n process is made as follows: we set a cookie on the site
> > > and depending on it we select the language to display the site in. We
> > > have three (currently) interface files: rus.lng, ukr.lng, and enu.lng
> > > (for English US). the format is the following:
> > > define ("MSG379", "Welcome!");
> > > etc. I know that PHP does support somehow exporting the strings into a
> > > .pod file. Maybe it would be better to do that? If so, how can I do
> > > it?
> > > Could you suggest me maybe a better solution than we currently have?
> > > Thanks a lot!
> > 
> > I've never actually had to do this... But one idea that I came up with  
> > is using the browser language in taking a best guess at what language  
> > to display... In other words, if the user's browser language is set to  
> > Chinese, you can be fairly certain they read Chinese :)
> > 
> > And now that I typed that out, I realize that may not be what you are  
> > really looking for...  And that's when we get into the part where I  
> > can't help alot because I've never had to do it :)
> > 
> > So good luck! :)
> > 
> > 
> > 
> > 
> 
> 
> That's the check I did on the last site i worked on (vicestyle.com) The
> user agent string is checked for a language and the site uses that. If
> none is found (bearing in mind that there's no hard and fast rule about
> what can go into a UA string) then it defaults to English.
> 
> Links within the site itself allow the user to change their language
> afterwards, and you could store that in a cookie to it remembers their
> choice.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 
> 
> 

The differences were stored in an array with a file per language like
so:

$lang['Welcome'] = 'Welcome';
$lang['Contact'] = 'Contact';

and in a a different file for German maybe:

$lang['Welcome'] = 'Willkommen';
$lang['Contact'] = 'Kontakt';

Thanks,
Ash
http://www.ashleysheridan.co.uk




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux