预翻译 Zend Framework 资源的推荐位置
自 zf 1.10 Zend Framework 附带预翻译的验证消息。它们位于图书馆路径之外。
手册说明了如何在引导程序中加载这些内容。
$translator = new Zend_Translate(
'array',
'/resources/languages',
$language,
array('scan' => Zend_Locale::LOCALE_DIRECTORY)
);
Zend_Validate_Abstract::setDefaultTranslator($translator);
我倾向于认为这些资源是特定于 zf 版本的;验证器可能会随着时间的推移而改变。如果我将资源复制到应用程序树中,则每次升级到新版本时都需要执行额外的维护。
什么是最佳实践?已经有采埃孚大会了吗?
Since zf 1.10 Zend Framework ships with pre-translated validation messages. They are outside the library path.
The manual illustrates how to load these in your bootstrap.
$translator = new Zend_Translate(
'array',
'/resources/languages',
$language,
array('scan' => Zend_Locale::LOCALE_DIRECTORY)
);
Zend_Validate_Abstract::setDefaultTranslator($translator);
I am inclined to think that these resources are specific to the zf-version; validators could change over time. If i copy the resources to my application tree I need to perform additional maintenance each time I upgrade to a newer version.
What is best practice? Is there a ZF convention already?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些翻译是为了您的方便而提供的,它并不是真正受支持的功能。
大多数时候,您不想用未知的内容覆盖翻译文件,如果 Zend 决定更改某些翻译,您可能不想遵循它们。
然后,您需要手动检查与先前版本相比有何更改,以确保不会破坏应用程序的措辞。
我真的不明白这一点。
但是,如果您确实不需要 cp -R(我理解),您可以使用 svn:external 加载此类资源,并进行相应更新。
使用 git (我使用的),它可能有点棘手,但你可以使用 git-subtree< /a>
Those translation are provided for your convenience, it is not really a supported feature.
Most of the time, you don't want to overwrite translation file with unknown, if Zend decides to change some translations, you may not want to follow them.
Then, you need to manually check what's changed from the previous release, to be sure to don't break the wording of your application.
I don't really get the point.
However if you really don't to have to
cp -R
(and I understand), you can use svn:external to load such resources, and update consequently.With git (which I use), it can be a little more tricky, but you can success with git-subtree