ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-i18n
php-i18n
Re: [PHP-I18N] Re: [PHP-WIN] how to get php_gettext.dll work on windows2000 / iis5 server?
by Hace other posts by this author
Nov 15 2001 9:43AM messages near this date
Re: [PHP-I18N] Re: [PHP-WIN] how to get php_gettext.dll work on windows2000 / iis5 server? | Re: [PHP-I18N] how to get php_gettext.dll work on windows2000 / iis5 server?
On Wed, 14 Nov 2001 08:01:54 -0700, zak@[...].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@[...].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.


-- 
PHP Internationalization Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-i18n-unsubscribe@[...].net
For additional commands, e-mail: php-i18n-help@[...].net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
Thread:
Hace
Hace
Zak Greant
Hace
Johan Holst Nielsen
Phil Driscoll
Phil Driscoll

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved