Re: Re: how to get php_gettext.dll work on windows2000 / iis5 server?
| From: | (Hace) | Date: | Thu, 15 Nov 2001 09:43:04 +0000 |
| Subject: | Re: Re: how to get php_gettext.dll work on windows2000 / iis5 server? | ||
| References: | 1 2 3 4 | Groups: | php.general php.i18n php.windows |
| Request: | Send a blank email to php-general+get-74691@lists.php.net to get a copy of this message | ||
On Wed, 14 Nov 2001 08:01:54 -0700, zak@php.net (Zak Greant) wrote:
>Drop by http://www.php-er.com and take a look at the chapter on
>gettext.
>
>I have written a complete overview of using gettext with PHP. It is
>also Unix-centric, but it is easier to understand than the gettext
>docs. : )
Your page at:
http://www.php-er.com/chapters/Gettext_Functions.html
is very clear!
I have also completed the 'msgfmt' utility, so I have succesfully
created a "binary language file" (the .mo file from the .po file)
But.. unfortunately I still could not manage to get it work :-(
This is what I have done.
On the W2000-webserver, I've put the nl.mo file in the following
folder (directory):
[webroot]\melle\includes\translations\nl\LC_MESSAGES
so, in that directory resides the 'nl.mo' file.
I've altered your .php example to read:
=========
<HTML>
<BODY>
<?
// Bind a domain to directory
// Gettext uses domains to know what directories to
// search for translations to messages passed to gettext
bindtextdomain ('greetings', './includes/translations'); // Set the
current domain that gettext will use
textdomain ('greetings'); # Make an array
# Use the ISO two-letter codes as keys
# Use the language names as values
$iso_codes = array (
'en'=>'English',
'fr'=>'French',
'it'=>'Italian',
'pt'=>'Portuguese',
'es'=>'Spanish',
'nl'=>'Nederlands'
); foreach ($iso_codes as $iso_code => $language) {
# Set the LANGUAGE environment variable to the desired language
putenv ('LANGUAGE='.$iso_code); # Print out the language name and
greeting
# Filter the greeting through gettext
printf ("<b>%12s:</b> %s\n", $language, _("str_hello"));
}
?></BODY></HTML>
=======
I've put the above .php file in the [webroot]\melle folder.
The (wrong) output is:
English: str_hello
French: str_hello
Italian: str_hello
Portuguese: str_hello
Spanish: str_hello
Nederlands: str_hello
And, in the nl.po file, I have entered:
======
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2001-11-14 17:11+0100\n"
"Last-Translator: Melle Koning <hace_x@yahoo.com>\n"
"Language-Team: <>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "str_hello"
msgstr "hallo"
======
So, what I expected was:
===
English: str_hello
French: str_hello
Italian: str_hello
Portuguese: str_hello
Spanish: str_hello
Nederlands: hallo
===
So this does not work!
Now, what I think could still be going wrong is that 'gettext' is
unable to find the nl.mo file, in other words gettext is unable to
find the right folder(directory)...
My question:
How should I alter:
bindtextdomain ('greetings', './includes/translations');
I have already done this:
echo bindtextdomain ('greetings', '.\includes\translations');
This returns:
C:/Inetpub/PowerPlate/melle/includes/translations
Which seems to be ok, with the difference that I guess windows wants
to have:
C:\Inetpub\PowerPlate\melle\includes\translations
(backslashes instead of forward slashes)?
Any other hints to get gettext to find the .mo files???
Thanks,
--
http://hace.dyndns.org/
Everything I say is my own opinion and not necessarily that of my employer.