ZendFramework2入门教程第3章 创建模块文件3.2 module.config 文件3.2.5 translator 翻译器
上一篇:3.2.4 service_m... 下一篇:3.2.6 navigatio...

3.2.5 translator 翻译器

翻译器的主要工作是负责对各种支持语言的转换以此为目的,从而实现网站应用程序的多国化甚至全球化。本书内容有涉及到使用语言包,语言包的生成可以参考po,mo 文件创建的其他文献;你也可以通过 Zend Studio 来创建项目以获取ZF2 默认生成的language 包。下面将会提供两个语言包内容 zh_CN.po ,en_US.po 这个为中英文件互转文件,这两语言由Zend Studio项目生成时自动创建;他们对应的mo文件可以通过 poedit 软件来生成,也可能过poedit 来修改po文件。如果在开发时不想使用任何语言转换,可以不进行任何关于语言转换相关的配置。

链:translator-->locale , translator-->translation_file_patterns
  • translator 表示此数组块为翻译器配置信息段
  • translator-->locale 指明应用程序的本地使用语言,或是应用程序使用的默认语言
  • translator-->translation_file_patterns 翻译文件的配置设置
  • translator-->translation_file_patterns-->type 翻译文件类型
  • translator-->translation_file_patterns-->base_dir 指定语言文件目录
  • translator-->translation_file_patterns-->pattern 语言文件的匹配规则

下面提供两个语言包,语言包为中英语言包,可以在开发的时候对两种语言环境进行切换。

3.2.5.1 语言文件 zh_CN.po 内容

msgid ""
msgstr ""
"Project-Id-Version: ZendSkeletonApplication\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-07-05 22:17-0700\n"
"PO-Revision-Date: 2013-05-06 11:26+0800\n"
"Last-Translator: \n"
"Language-Team: ZF Contibutors \n"
"Language: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: translate\n"
"X-Poedit-Basepath: .\n"
"X-Generator: Poedit 1.5.5\n"
"X-Poedit-SearchPath-0: ..\n"
msgid "Home"
msgstr "主页"
msgid "All rights reserved."
msgstr "版权所有."
msgid "Help & Support"
msgstr "帮助 & 支持"
msgid "An error occurred"
msgstr "发生错误"
msgid "Additional information"
msgstr "附加信息"
msgid "File"
msgstr "文件"
msgid "Message"
msgstr "消息"
msgid "Stack trace"
msgstr "Stack trace"
msgid "Previous exceptions"
msgstr "上一个异常"
msgid "No Exception available"
msgstr "没有可用的Exception"
msgid "A 404 error occurred"
msgstr "404 缺少目标文件"
msgid "The requested controller was unable to dispatch the request."
msgstr "所请求的控制器不能分发该请求"
msgid ""
"The requested controller could not be mapped to an existing controller class."
msgstr "所请求的控制器不能映射到已存在的控制器类"
msgid "The requested URL could not be matched by routing."
msgstr "所请求的URL不能与路由对应"
msgid "We cannot determine at this time why a 404 was generated."
msgstr "我们不能确定为什么这次会出现404"
msgid "Controller"
msgstr "控制器"
msgid "resolves to %s"
msgstr "解决: %s"
msgid "Exception"
msgstr "异常"
msgid "Add"
msgstr "添加"
msgid "Delete"
msgstr "删除"
msgid "Edit"
msgstr "修改"
msgid "Add new album"
msgstr "添加新闻"
msgid "Title"
msgstr "标题"
msgid "Artist"
msgstr "文章内容"

3.2.5.2 语言文件 en_US.po 内容

msgid ""
msgstr ""
"Project-Id-Version: ZendSkeletonApplication\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-07-05 22:17-0700\n"
"PO-Revision-Date: 2012-07-05 22:17-0700\n"
"Last-Translator: Evan Coury \n"
"Language-Team: ZF Contibutors \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: translate\n"
"X-Poedit-Language: English\n"
"X-Poedit-Country: UNITED STATES\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../view/layout/layout.phtml:6
#: ../view/layout/layout.phtml:33
msgid "Skeleton Application"
msgstr ""
#: ../view/layout/layout.phtml:36
msgid "Home"
msgstr ""
#: ../view/layout/layout.phtml:50
msgid "All rights reserved."
msgstr ""
#: ../view/application/index/index.phtml:2
#, php-format
msgid "Welcome to %sZend Framework 2%s"
msgstr ""
#: ../view/application/index/index.phtml:3
#, php-format
msgid "Congratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2."
msgstr ""
#: ../view/application/index/index.phtml:4
msgid "Fork Zend Framework 2 on GitHub"
msgstr ""
#: ../view/application/index/index.phtml:10
msgid "Follow Development"
msgstr ""
#: ../view/application/index/index.phtml:11
#, php-format
msgid "Zend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!"
msgstr ""
#: ../view/application/index/index.phtml:12
msgid "ZF2 Development Portal"
msgstr ""
#: ../view/application/index/index.phtml:16
msgid "Discover Modules"
msgstr ""
#: ../view/application/index/index.phtml:17
#, php-format
msgid "The community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2."
msgstr ""
#: ../view/application/index/index.phtml:18
msgid "Explore ZF2 Modules"
msgstr ""
#: ../view/application/index/index.phtml:22
msgid "Help & Support"
msgstr ""
#: ../view/application/index/index.phtml:23
#, php-format
msgid "If you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s."
msgstr ""
#: ../view/application/index/index.phtml:24
msgid "Ping us on IRC"
msgstr ""
#: ../view/error/index.phtml:1
msgid "An error occurred"
msgstr ""
#: ../view/error/index.phtml:8
msgid "Additional information"
msgstr ""
#: ../view/error/index.phtml:11
#: ../view/error/index.phtml:35
msgid "File"
msgstr ""
#: ../view/error/index.phtml:15
#: ../view/error/index.phtml:39
msgid "Message"
msgstr ""
#: ../view/error/index.phtml:19
#: ../view/error/index.phtml:43
#: ../view/error/404.phtml:55
msgid "Stack trace"
msgstr ""
#: ../view/error/index.phtml:29
msgid "Previous exceptions"
msgstr ""
#: ../view/error/index.phtml:58
msgid "No Exception available"
msgstr ""
#: ../view/error/404.phtml:1
msgid "A 404 error occurred"
msgstr ""
#: ../view/error/404.phtml:10
msgid "The requested controller was unable to dispatch the request."
msgstr ""
#: ../view/error/404.phtml:13
msgid "The requested controller could not be mapped to an existing controller class."
msgstr ""
#: ../view/error/404.phtml:16
msgid "The requested controller was not dispatchable."
msgstr ""
#: ../view/error/404.phtml:19
msgid "The requested URL could not be matched by routing."
msgstr ""
#: ../view/error/404.phtml:22
msgid "We cannot determine at this time why a 404 was generated."
msgstr ""
#: ../view/error/404.phtml:34
msgid "Controller"
msgstr ""
#: ../view/error/404.phtml:41
#, php-format
msgid "resolves to %s"
msgstr ""
#: ../view/error/404.phtml:51
msgid "Exception"
msgstr ""
上一篇:3.2.4 service_m... 下一篇:3.2.6 navigatio...