我的配置是
'translator' => array(
'locale' => 'en_EN',
'translation_file_patterns' => array(
array(
'type' => 'gettext',
'base_dir' => __DIR__ . '/../language',
'pattern' => '%s.mo',
),
),
),
以及如何从我的视图或控制器中更改区域设置?
答案 0 :(得分:4)
获取Translator
实例并调用setLocale()
方法。示例(控制器上下文):
// Get the translator from the service locator.
$translator = $this->getServiceLocator()->get('translator');
$translator->setLocale($myLocale);
答案 1 :(得分:1)
更新:
$translator = $this->getServiceLocator()->get('translator');
$translator->setLocale($myLocale);