[ZF1] Zend_Locale and locales like "zh_Hans_HK

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
ts
Reply | Threaded
Open this post in threaded view
|

[ZF1] Zend_Locale and locales like "zh_Hans_HK

ts
I am having trouble with I18N. I want to support locales like:
- zh_Hans_HK
- zh_Hant_HK
and it seems that it is impossible with the Zend_Locale. It seems to be functioning correctly only with locales which look like "xx_XX" and not "xx_xxxx_XX".

Example:
$locale = new \Zend_Locale('zh_Hans_HK');
var_dump($locale, $locale->getLanguage());         exit(__METHOD__ . '(' . __LINE__ . ')');

returns output:
object(Zend_Locale)[6]
  protected '_locale' => string 'zh_HK' (length=5)

string 'zh' (length=2)

This means that the Zend_Locale object cannot distinguish between zh_Hans_HK and zh_Hant_HK locales (and treats them all like zh_HK). Again, I need to be able to treat them totally separately (for translations and some locale dependent settings).

Did anyone experience such problems? If so how did you solve it?
Reply | Threaded
Open this post in threaded view
|

Re: [ZF1] Zend_Locale and locales like "zh_Hans_HK

Frank Brückner
Hi Tomasz,
please check the latest version, because "zh_Hans_HK" and "zh_Hant_HK" are  
supported.


Kind regards,
Frank


Am 13.07.2015, 13:23 Uhr, schrieb ts <[hidden email]>:

> I am having trouble with I18N. I want to support locales like:
> - zh_Hans_HK
> - zh_Hant_HK
> and it seems that it is impossible with the Zend_Locale. It seems to be
> functioning correctly only with locales which look like "xx_XX" and not
> "xx_xxxx_XX".
>
> Example:
> $locale = new \Zend_Locale('zh_Hans_HK');
> var_dump($locale, $locale->getLanguage());         exit(__METHOD__ . '('  
> .
> __LINE__ . ')');
>
> returns output:
> object(Zend_Locale)[6]
>   protected '_locale' => string 'zh_HK' (length=5)
>
> string 'zh' (length=2)
>
> This means that the Zend_Locale object cannot distinguish between  
> zh_Hans_HK
> and zh_Hant_HK locales (and treats them all like zh_HK). Again, I need  
> to be
> able to treat them totally separately (for translations and some locale
> dependent settings).
>
> Did anyone experience such problems? If so how did you solve it?

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


ts
Reply | Threaded
Open this post in threaded view
|

Re: [ZF1] Zend_Locale and locales like "zh_Hans_HK

ts
Hi Frank

Thanks for the quick answer. I am currently using ZF 1.12.13 (the newest available ZF1 version). While instantiating a Zend_Locale (with locale string "zh_Hans_HK") object it changes it to "zh_HK". It does that in it's constructor already (method _prepareLocale, lines 1938-1942). From this point on the application is working with "zh_HK" (which is not what I want).

Like I wrote in the beginning I need to have different translations for zh_Hans_HK and zh_Hant_HK (translator gets the current locale from a Zend_Locale instance). If Zend_Locale treats both of the locales as zh_HK then it is impossible to distinguish the translations.
Am I missing something here? If so I would be grateful for any advice.

Regards
Tomasz
ts
Reply | Threaded
Open this post in threaded view
|

Re: [ZF1] Zend_Locale and locales like "zh_Hans_HK

ts
Hi Frank

Here's the ticket I've opened:
https://github.com/zendframework/zf1/issues/586

Just to be 100% clear. This is not about any xml files (containing locale data) missing (from the Zend\Locale\Data\ directory) - the xml files for zh_Hans_HK and zh_Hant_HK are available.
What this is about is the Zend_Locale code which does not seem to support locales with names like xx_Xxxx_XX.

Please let me know if something is not clear.

Regards
Tomasz

-----Original Message-----
From: Frank Brückner [mailto:[hidden email]]
Sent: Tuesday, July 14, 2015 8:42 AM
To: [hidden email]; Tomasz Szmytka
Subject: Re: [fw-general] Re: [ZF1] Zend_Locale and locales like "zh_Hans_HK

Hi Tomasz,
sorry, my mistake.

With version 24 of the CLDR (http://cldr.unicode.org/) the locales "zh_Hans_HK" and "zh_Hant_HK" are no longer part of CLDR. So we introduced the aliases.
But in the meantime the two locales are back in the CLDR library.

Can you open a bug report for this problem?  
(https://github.com/zendframework/zf1/issues)


Thanks and kind regards,
Frank


Am 13.07.2015, 18:52 Uhr, schrieb ts <[hidden email]>:

> Hi Frank
>
> Thanks for the quick answer. I am currently using ZF 1.12.13 (the
> newest available ZF1 version). While instantiating a Zend_Locale (with
> locale string "zh_Hans_HK") object it changes it to "zh_HK". It does
> that in it's constructor already (method _prepareLocale, lines
> 1938-1942). From this point on the application is working with "zh_HK"
> (which is not what I want).
>
> Like I wrote in the beginning I need to have different translations
> for zh_Hans_HK and zh_Hant_HK (translator gets the current locale from
> a Zend_Locale instance). If Zend_Locale treats both of the locales as
> zh_HK then it is impossible to distinguish the translations.
> Am I missing something here? If so I would be grateful for any advice.
>
> Regards
> Tomasz