|
Posted by koichirose on December 18, 2009, 8:06 am
Please log in for more thread options
Hello, I'm having some problems translating my website into both
english and russian.
English always worked, now I'm trying to add russian by translating
the .po file and compiling again.
Here's my directory structure.
-root
---locale
------en_GB
---------LC_MESSAGES
------------messages.mo
------------messages.po
------ru_RU
---------LC_MESSAGES
------------messages.mo
------------messages.po
Here's the code to set the language (in a file in the root folder),
omitting all the bits where I use the GET variable and save a cookie:
putenv("LC_ALL=$locale");
setlocale(LC_ALL, $locale);
bindtextdomain("messages", "./locale");
textdomain("messages");
$locale contains either 'it_IT' or 'en_GB' or 'ru_RU'.
Italian and english are now working but if I choose russian I get
italian (default) instead.
In case this helps, the page has utf-8 encoding and I already tried
printing cyrillic successfully.
I'm on Ubuntu 8.04 with Apache, PHP 5.2.4.
Thank
|
|
Posted by Michael Fesser on December 18, 2009, 8:20 am
Please log in for more thread options
.oO(koichirose)
show/hide quoted text
>Hello, I'm having some problems translating my website into both
>english and russian.
>English always worked, now I'm trying to add russian by translating
>the .po file and compiling again.
>Here's my directory structure.
>[...]
>Here's the code to set the language (in a file in the root folder),
>omitting all the bits where I use the GET variable and save a cookie:
>putenv("LC_ALL=$locale");
>setlocale(LC_ALL, $locale);
>bindtextdomain("messages", "./locale");
>textdomain("messages");
>$locale contains either 'it_IT' or 'en_GB' or 'ru_RU'.
>Italian and english are now working but if I choose russian I get
>italian (default) instead.
What's the return value of setlocale(), when you try ru_RU? Is that
locale installed on the server? If you have shell access, check the
output of "locale -a" (or call it from within PHP with system()).
Micha
|
|
Posted by koichirose on December 18, 2009, 9:04 am
Please log in for more thread options
show/hide quoted text
> What's the return value of setlocale(), when you try ru_RU? Is that
This returns en_GB when I choose english, nothing when I choose
Italian or Russian
show/hide quoted text
> locale installed on the server? If you have shell access, check the
> output of "locale -a" (or call it from within PHP with system()).
yes, "locale -a" shows I have ru_RU.utf8 installed, as well as
it_IT.utf8 and en_GB, en_GB.iso885915, en_GB.utf8 .
Thanks again
|
|
Posted by Michael Fesser on December 18, 2009, 9:29 am
Please log in for more thread options
.oO(koichirose)
show/hide quoted text
>> What's the return value of setlocale(), when you try ru_RU? Is that
>This returns en_GB when I choose english, nothing when I choose
>Italian or Russian
This nothing should be a FALSE, meaning that something went wrong.
show/hide quoted text
>> locale installed on the server? If you have shell access, check the
>> output of "locale -a" (or call it from within PHP with system()).
>yes, "locale -a" shows I have ru_RU.utf8 installed, as well as
>it_IT.utf8 and en_GB, en_GB.iso885915, en_GB.utf8 .
>Thanks again
OK. If this is the complete list, then there is no ru_RU locale
installed - ru_RU.utf8 is something different! Try that one (you might
have to rename the directory under /locale).
Micha
|
|
Posted by koichirose on December 18, 2009, 12:05 pm
Please log in for more thread options
show/hide quoted text
> OK. If this is the complete list, then there is no ru_RU locale
> installed - ru_RU.utf8 is something different! Try that one (you might
> have to rename the directory under /locale).
You are right, I didn't rename the folder. It works now, thank you!!
|
| Similar Threads | Posted | | gettext.so | April 15, 2008, 6:55 pm |
| Gettext doesn't worh, help! | July 17, 2004, 8:39 pm |
| loading gettext | January 10, 2005, 12:42 pm |
| GETTEXT (not really a question) | July 13, 2005, 6:01 pm |
| Gettext fails me | November 9, 2006, 8:32 am |
| gettext() function | May 29, 2008, 3:46 am |
| gettext vs custom ways | May 10, 2007, 8:02 pm |
| Freebsd locales (gettext) | October 26, 2007, 10:54 am |
| string variables in gettext | August 28, 2009, 1:53 am |
| Re: string variables in gettext | August 28, 2009, 6:06 pm |
|
>english and russian.
>English always worked, now I'm trying to add russian by translating
>the .po file and compiling again.
>Here's my directory structure.
>[...]
>Here's the code to set the language (in a file in the root folder),
>omitting all the bits where I use the GET variable and save a cookie:
>putenv("LC_ALL=$locale");
>setlocale(LC_ALL, $locale);
>bindtextdomain("messages", "./locale");
>textdomain("messages");
>$locale contains either 'it_IT' or 'en_GB' or 'ru_RU'.
>Italian and english are now working but if I choose russian I get
>italian (default) instead.