php-i18n Digest 14 Oct 2005 10:15:29 -0000 Issue 296

Topics (messages 877 through 880):

Re: [PHP] gettext() troubles
        877 by: Aaron Gould
        879 by: Jochem Maas

Re: gettext() troubles
        878 by: Michael Wallner

Problem with special chars.
        880 by: Erfan Shirazi

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Denis Gerasimov wrote:
<?php
putenv("LANG=ru_RU");
setlocale (LC_ALL,"ru");
$domain = 'messages';
echo bindtextdomain ($domain, 'D:\intranet\wwwroot\lng');
echo textdomain ($domain);
echo bind_textdomain_codeset($domain, 'UTF-8');
echo gettext("string");
?>

Here's what I use to set my language (to French in this case). It works 100% of the time for me:

  // Set locale to preferred language
  setlocale(LC_ALL, 'fr_FR');
  bindtextdomain('messages', $_SERVER['DOCUMENT_ROOT'].'/locale');
  textdomain('messages');

I don't do the "putenv" line that you have, so I'm not sure if it's necessary...

--
Aaron Gould
Programmer/Systems Administrator
PARTS CANADA

--- End Message ---
--- Begin Message ---
Aaron Gould wrote:
Denis Gerasimov wrote:

<?php
putenv("LANG=ru_RU");
setlocale (LC_ALL,"ru");
$domain = 'messages';
echo bindtextdomain ($domain, 'D:\intranet\wwwroot\lng');
echo textdomain ($domain);
echo bind_textdomain_codeset($domain, 'UTF-8');
echo gettext("string");
?>


anyone who has worked with locales on different machines/platforms
will probably run into the problem that locales are different and/or
differently named on alot of systems...

for this reason (I believe) set_locale() allows you to pass
an array of locale names as the second arg - the first one found will be used...

e.g. (I use dutch locales alot):

setlocale( LC_ALL,
           array('[EMAIL PROTECTED]',
                 'nl_NL',
                 'nld_nld',
                 'Dutch',
                 'Dutch_Netherlands.1252',
                 'nl_NL.ISO8859-1',
                 'nl') );

maybe that helps a bit.


Here's what I use to set my language (to French in this case). It works 100% of the time for me:

  // Set locale to preferred language
  setlocale(LC_ALL, 'fr_FR');
  bindtextdomain('messages', $_SERVER['DOCUMENT_ROOT'].'/locale');
  textdomain('messages');

I don't do the "putenv" line that you have, so I'm not sure if it's necessary...

it sometimes is I believe - depends on your setup (e.g. if your using CGI 
version)
- don't hold me to that I could be completely wrong.



--- End Message ---
--- Begin Message ---
Hi Denis Gerasimov, you wrote:

> I am facing some troubles with gettext.
> ...
> putenv("LANG=ru_RU");

Speaking from my experience, you need to use only "ru" there
on Windows...

> setlocale (LC_ALL,"ru");

...but you definitly have to use the Windows abbreviation
for the corresponding locale in the setlocale call.

Have a look at PEARs I18Nv2 module which attempts to solve
this discrepancy.

Regards,
-- 
Michael - < mike(@)php.net >

--- End Message ---
--- Begin Message ---
Hi all


I have some problems when I make a string containing the following "Malmö, Asunción" to capital letters and then save it to a file.

I use the following to make it to capital letters:
$msg = mb_strtoupper($msg, "HTML-ENTITIES");

And this works just fine, everything looks as it should, but when I save it to a file, this is how it looks:
"MALM&Ouml;, ASUNCI&Oacute;N

It seems it has problems with "ó" and "Ö", does anybody know how this can be solved? I have tried some different encodings but nothing helps, I'm using PHP 4.3.2.

Thx in advance for all help.

/Erfan

--- End Message ---

Reply via email to