PyroCMS 语言支持
PyroCMS 中的自定义模块需要支持多种语言。这是怎么做到的?特别是:
- 我们将语言文件夹和文件放在哪里?我们假设在
/addons/
中。这是对的吗?/language/ - 我们是否必须提供 PyroCMS 支持的所有语言的内容翻译(特定于我们模块的内容)?例如,我们要添加“Gibberish”语言,并希望定义
"greeting" = "Gibberish Hello"
。我们还必须用英语等定义“greeting”
吗? - 相反,我们是否也必须将 PyroCMS 支持的术语翻译成“乱码”语言?例如,“英文”翻译
“cp_title”=“Control Panel”
必须翻译成“cp_title”=“Gibberish Control Panel”
等? 设置“?lang=zz”(其中“zz”是我们尝试添加的语言)给我们带来了以下错误:
<块引用>遇到 PHP 错误
严重性:通知
消息:未定义索引:en
文件名:core/MY_Controller.php
行号:83
Our custom modules in PyroCMS need to support multiple languages. How is this done? Particularly:
- Where do we put the language folders and files? We assume in
/addons/<module name>/language/
. Is this right? - Must we provide a translation of our content (content that is specific to our modules) in all of the PyroCMS supported languages? For example, we are adding the "Gibberish" language and want to define
"greeting" = "Gibberish Hello"
. Must we also define"greeting"
in english, etc.? - Conversely, must we also translate into "Gibberish" language the terms that PyroCMS supports? For example, the "English" translation
"cp_title" = "Control Panel"
must be translated into"cp_title" = "Gibberish Control Panel"
, etc.? Setting "?lang=zz" (where "zz" is the language we tried to add) gave us the following error:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: en
Filename: core/MY_Controller.php
Line Number: 83
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在阅读pyro 论坛中的帖子后遇到了这个答案。让我也在这里贡献一下:
我认为看一下由开发团队创建的与 Pyro 捆绑在一起的 Galleries 模块,会让您清楚地了解如何处理其中的大部分问题。
在画廊中,语言文件遵循以下结构:modules/galleries/language/language-name/galleries_lang.php
关于3,我认为这些应该放在system/cms/language/lang-name/中(并且,如果可以的话,你应该向 Pyro 社区贡献“乱码”语言:))
我对 4 不是 100% 确定,但我确信我在文档中看到了一些东西。
I ran into this answer after reading the post in pyro's forums. Let me contribute it here too:
I think taking a look at the Galleries module -bundled with Pyro, created by the dev team- will give you a clear idea on how to take care of most of this.
In galleries, language files follow this structure: modules/galleries/language/language-name/galleries_lang.php
About 3, I think those should be placed in system/cms/language/lang-name/ (and, if you can, you should contribute "Gibberish" language to the Pyro community :) )
I'm not 100% sure about 4, but I'm sure I saw something in the docs.
我在 或 论坛上回答了这个问题,但再一次:这里是文档:
http://docs.pyrocms.com/2.2/manual/developers/contributing/translated-language-files
I answered this on or forums, but once again: here is the documentation:
http://docs.pyrocms.com/2.2/manual/developers/contributing/translating-language-files