From:             raulsalitrero at gmail dot com
Operating system: windows xp sp3
PHP version:      5.3.0
PHP Bug Type:     Gettext related
Bug description:  gettext behaves differently in php 5.3.0 (5.2.x ignored 
setlocale errors)

Description:
------------
usign gettext functions under php 5.3.0 (built with vc9) works differently
to how it used to work in php 5.2.x (tested on 5.2.10 built with vc6).

it used to work even after a setlocale error, (locale not supported on my
machine), after the error it continued loading the .mo (.po) files from the
locale folder in the app. in php 5.3 it doesn't seem to load the files,
i've tried changing the locale to the correct name for windows wich is
"enu" and the path to the correct locale folder to:
locale/
  enu/...
  en_us/...
  en_US/...
  English_United States/...
  English_United States.1252/... (changing the setlocale codeset from
"UTF-8" to "CP1252" and "1252", and various combinations of the above
settings, also with and without the codeset functions, and it didn't show
translations.

in php 5.2.10 it loaded the files directly from the first settings
id like to know if it is possible to make php_gettext to ignore the
setlocal error and work out the folder name from the LANG and LC_ALL
enviroment variables like it apparently used to be in earlier versions of
php. or if it would be too much troublesome, then if it could be possible
to add a new function that returns the folder name where the the .mo files
are being expected to be, something like:

gettext_getpath([$text_domain = Current_default_domain])

and get something like "en_US\LC_MESSAGES\domain.mo" (locale folder name)
or the full path something like
"C:\Apache\htdocs\app\locale\en_US\LC_MESSAGES\domain.mo" or
"/var/www/app1/locale/en_US/LC_MESSAGES/domain.mo" in *nix (even if the
file doesn't exists to know if its necessary to rename/move folders

thanks in advance

Reproduce code:
---------------
<?php
        
        $locale = "en";
        @error_reporting(E_ALL - E_NOTICE);
        $mensaje="";
        
        if (isSet($_GET["locale"])){
                $locale = $_GET["locale"]; 
        }
        setlocale(LC_ALL, $locale);
        if(false == putenv("LC_ALL=$locale")){echo "error lc_all";}
        if(false == putenv("LANG=$locale")){echo "error lang";}
        if(false == putenv("LANGUAGE=$locale")){echo "error language";}
        textdomain("messages");
        bindtextdomain("messages", "locale");
        bind_textdomain_codeset("messages","UTF-8");
        textdomain("messages");
        
        echo _("hola mundo");
        
        

Expected result:
----------------
(having messages.po and messages.mo files with the translation "hola
mundo" -> "hello world" (english)
in the relative path "locale/en/LC_MESSAGES/"

"hello world"

Actual result:
--------------
"hola mundo" (text not being translated)

-- 
Edit bug report at http://bugs.php.net/?id=49349&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49349&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49349&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49349&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49349&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49349&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49349&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49349&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49349&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49349&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49349&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49349&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49349&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49349&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49349&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49349&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49349&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49349&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49349&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49349&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49349&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49349&r=mysqlcfg

Reply via email to