Hot off the heels of my other question:
These are the two languages I'm wanting to provide translations for using the Zend framework. When a user decides that they don't want to use English as their primary language, they are offered the opportunity to select an alternate language:
- zh_Hans
- zh_Hant
When I use the preceeding with the following code:
require_once 'Zend/Locale.php';
$locale = new Zend_Locale();
$locale->setLocale('zh_Hans'); // for example
The actual language that is available to me is zh and not zh_Hans or zh_CN
So now, when it comes to using Zend for translation
require_once 'Zend/Translate.php';
$translate = new Zend_Translate(array('adapter' => 'array',
'content' => 'translations/zh_Hant.trans',
'locale' => $locale->getLanguage()
));
It fails ... because zh doesn't exist as a language file. this is expected as I am telling $translate
that the $locale
is the language ...
So I try the following:
'locale' => $locale->getLanguage() . '_' . $locale->getRegion()
This also fails as $locale->getRegion() is empty ...
Question:
- What is the proper way to set the language of a remote user's locale using the Zend framework so that language _ region is available for
Zend_Translate
?
-- referencing my other question, zh_HK and zh_CN is incorrect. zh_Hans / zh_Hant is