Hello everybody,
First of all thanks to Bharat for inviting me to talk in this forum!
No the question:
Is there any method by which the languages can be switched depending on the users preference.
e.g. putting up some flags representing the languages supported and when the user clicks on it , the document switches to the choosed language.
Thanks in advance,
Girish
Posts: 6
Hi,
Is it the right place where I am asking the question?
BTW, I found that the language settings are indeed applied based on the users settings.
But despite that the text is not translated.
If I debug the "translate()" function in the GalleryTranslator.class
then I found that there is no translation taking place into other language.
Does any one know how to correct this?
Thanks!
Girish
Posts: 3474
Hi there. Gallery 2's translation requires your webserver to have two things:
1) GNU gettext, which is a set of small programs and library functions that facilitate translations.
2) Your webserver's PHP module must be compiled with gettext support (add --with-gettext to the configuration options, after having installed gettext, of course).
If you have more questions, just ask.
(The PHP.net gettext page might also help)
-Beckett (
)
Posts: 6
hi beckett,
Thanks for the reply!
I have GNUmake as well as gettext support in the PHP.
I created a sample text file in the core directory to test it but no translation???
Can any one test it out and tell me what wrong I am doing?
----------------------
<?php
// Set the language as full locale 'de_DE'
$language = 'de_DE';
echo "\n";
// Set the text domain as 'modules_core'
$domain = 'modules_core';
echo bindtextdomain($domain, "./locale");
echo "\n";
echo textdomain("$domain");
echo "\n";
// The .mo file searched is:
// ./locale/de_DE/LC_MESSAGES/modules_core.mo
// or if previous one doesn't exist:
// ./locale/de/LC_MESSAGES/modules_core.mo
//putenv("LANGUAGE=$language");
putenv("LC_ALL=$language");
//setlocale(LC_ALL, $language);
echo gettext("Hello world!");
echo "\n";
echo _("1 minute");
echo "\n";
echo _("Good Morning!");
?>
----------------------
Thanks,
Girish
Posts: 3474
Right, but those messages aren't in the .mo file, right?
In other words, "Hello world!" isn't going to translate unless you've physically added that translation to the .po file, then compiled it into the .mo file. You should test with phrases contained within the po/de_DE.po file.
Is the G2 translation still not working? If not, then make sure that PHP was compiled pointing to the correct install dir of gettext. It defaults to /usr/local. If it's something else, you need to specify that in the PHP configuration command before compiling.
Posts: 6
Hi,
Yes there was no "Hello World!" in it, I put instead the "Action" which i see in the de_DE.po but still it don't translate.
I checked the above script seperately with a locale/de_DE/LC_MESSAGES/greetings.mo from the examples on www.php.net and the translation works fine on the same server. (just needs an httpd restart)
But no translation in Gallery2.
I wonder, is this the language feature really working in Gallery2?
Please can anybody test the above script in a gallery2 installation.
just point the path in this line to correct location:
echo bindtextdomain($domain, "./locale");
and change the messages in the gettext("") , to something like Action,Active etc.
thanks,
Girish
Posts: 7994
Girish -- I haven't had a chance to run the test you outline above, but the translation code in G2 does work and has been functioning properly since February or so. Can somebody here publish the link to a demo server where it's functioning so that Girish can see it in operation?
Posts: 6
Ok,
It seems there is some problem with out local test server.
The translation works fine with the production server
Thanks a lot!
Girish
Posts: 7994
By the way, I've had issues on servers which did not have the proper locales installed. On most unix boxes there's an easy way to install the locales that you're going to use. To see wht you have available, try looking in /usr/share/locale