zend-locale

why doesn't the Zend_Locale honor abbreviated formats like zh_HK or zh_CN

笑着哭i 提交于 2019-12-25 01:14:58
问题 I have the following piece of code and am trying to do something simple with the Zend framework and Zend_Locale() $supported_langs = array( 'en' => 'English', 'zh_CN' => '中文(简体)', 'zh_HK' => '中國(傳統)', 'es' => 'Español', 'ja' => '日本', 'pt' => 'Português', 'de' => 'Deutsch', 'ar' => 'العربية', 'fr' => 'Française', 'ru' => 'Pусский', 'ko' => '한국의', 'hi' => 'हिन्दी', 'vi' => 'Việt' ); echo '<pre>'; foreach ($supported_langs as $lang => $desc) { print Zend_Locale::getTranslation($lang, 'language',

zend framework 2 get locale from view PhpRenderer

浪子不回头ぞ 提交于 2019-12-25 01:01:13
问题 How I can obtain traslator locale in my view? I want to do it starting from the variable $this (the PhpRenderer of the view). i.e. I don't want use onBootstrap nor ActionController because I don't care to have a view variables. Thank you! 回答1: You should try: <?php echo \Locale::getDefault(); ?> Many of the I18n classes make reference to PHP's Locale class (http://www.php.net/locale) - so in my opinion that would be a good starting point. 回答2: <?php echo $this->plugin('translate')-

Zend Locale & Zend_Currency: Region code

天大地大妈咪最大 提交于 2019-12-12 00:44:03
问题 I am trying to create a connection between the Zend_Locale and the Zend_Currency using the browser language preferences. BROWSER: en $locale = new Zend_Locale(Zend_Locale::BROWSER); Zend_Debug::Dump($locale->getLanguage()); Zend_Debug::Dump($locale->getRegion()); die; Result: string(2) "en" bool(false) BROWSER: en_US $locale = new Zend_Locale(Zend_Locale::BROWSER); Zend_Debug::Dump($locale->getLanguage()); Zend_Debug::Dump($locale->getRegion()); die; Result: string(2) "en" string(2) "US" Ho

Zf2 Locale in URL and $this->url

梦想的初衷 提交于 2019-12-08 04:18:38
问题 I am developing a web app on ZF2 Skeleton App base. I have played with lot of options but failed to get final headway. I need to route the url as under: http://myapp/ http://myapp/en/album to AlbumController/indexAction. Also, links need to work as: http://myapp/en/album/edit/1 http://myapp/en/album/delete/1 The code generates correct URLs but on clicking returns "404" error My Application/module.config.php is as under: return array ( 'router' => array ( 'routes' => array ( 'home' => array (

Using “.” for decimals in zend validator float

微笑、不失礼 提交于 2019-12-07 17:47:44
问题 I have a form with a element called "price". I validate this element with the "float" validator. The thing is when I insert, for example: 12,50 => it is valid but when I try to save it on the DB (mysql) it is saved as "12.00" So I wanna to change the decimal character from "," to ".". Does anybody knows how?? Note. If I put: $price->addValidator('Float', 'de') or $validator = new Zend_Validate_Float(array('locale' => 'de')); $price->addValidator($validator) It does not work. 回答1: You can use

Zf2 Locale in URL and $this->url

做~自己de王妃 提交于 2019-12-06 14:52:01
I am developing a web app on ZF2 Skeleton App base. I have played with lot of options but failed to get final headway. I need to route the url as under: http://myapp/ http://myapp/en/album to AlbumController/indexAction. Also, links need to work as: http://myapp/en/album/edit/1 http://myapp/en/album/delete/1 The code generates correct URLs but on clicking returns "404" error My Application/module.config.php is as under: return array ( 'router' => array ( 'routes' => array ( 'home' => array ( 'type' => 'Zend\Mvc\Router\Http\Literal', 'options' => array ( 'route' => '/', 'defaults' => array (

Using “.” for decimals in zend validator float

独自空忆成欢 提交于 2019-12-05 21:16:43
I have a form with a element called "price". I validate this element with the "float" validator. The thing is when I insert, for example: 12,50 => it is valid but when I try to save it on the DB (mysql) it is saved as "12.00" So I wanna to change the decimal character from "," to ".". Does anybody knows how?? Note. If I put: $price->addValidator('Float', 'de') or $validator = new Zend_Validate_Float(array('locale' => 'de')); $price->addValidator($validator) It does not work. You can use a filter Zend_Filter LocalizedToNormalized to it will normalized you localized price according to the user's

Is it feasible to rely on setlocale, and rely on locales being installed?

一笑奈何 提交于 2019-11-29 10:07:53
I was trying to generate a localized date string with strftime , the placeholder I use is %x . The language/locale is setlocale(LC_ALL, array('jp','japanese')) , however neither locale was available so it generated a string with improper characters. I then installed the ja_JP.utf8 locale and specified that as the first element in the array and the date formatting issue I had was resolved. My question is, should I always rely on locales being installed? I'm aware of how to install them on boxes I have root access to, but what if I don't have access? I believe Zend_Locale and Zend_Translate do

Is it feasible to rely on setlocale, and rely on locales being installed?

巧了我就是萌 提交于 2019-11-28 03:29:43
问题 I was trying to generate a localized date string with strftime , the placeholder I use is %x . The language/locale is setlocale(LC_ALL, array('jp','japanese')) , however neither locale was available so it generated a string with improper characters. I then installed the ja_JP.utf8 locale and specified that as the first element in the array and the date formatting issue I had was resolved. My question is, should I always rely on locales being installed? I'm aware of how to install them on