翻譯器的主要工作是負責對各種支持語言的轉換以此為目的,從而實現網站應用程序的多國化甚至全球化。本書內容有涉及到使用語言包,語言包的生成可以參考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 <zf-devteam@zend.com>\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 <me@evancoury.com>\n"
"Language-Team: ZF Contibutors <zf-devteam@zend.com>\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 ""
~~~
- 序言
- 第1章 Zend Framework2 簡介
- 1.1 Zend Framework2 簡介
- 1.2 下載安裝
- 1.3 搭建開發環境
- 第2章 創建ZF2項目
- 2.1 新建一個項目
- 2.2 配置網站
- 2.3 偽靜態 .htaccess文件
- 2.4 添加啟動/入口文件
- 2.5 添加全局配置文件
- 2.6 添加自動加載文件 init_autoloader.php
- 2.7 IndexController 控制器
- 第3章 創建模塊文件
- 3.1 Module 文件
- 3.2 module.config 文件
- 3.2.1 router 路由配置
- 3.2.2 controllers控制器配置
- 3.2.3 view_manager 視圖管理器
- 3.2.4 service_manager 服務管理器
- 3.2.5 translator 翻譯器
- 3.2.6 navigation 導航條
- 第4章 創建控制器
- 4.1 控制器簡介
- 4.2 新建控制器
- 4.3 添加控制器的Action
- 第5章 創建視圖模板
- 5.1 創建模板
- 5.2 模板配置
- 5.3 編寫布局和錯誤異常模板
- 5.4 編寫Action 對應的模板文件
- 5.5 訪問 IndexAction
- 第6章 創建模型
- 6.1 ORM 對象映射法
- 6.2 使用分頁導航
- 6.3 自定模型
- 6.4 章節總結
- 第7章 實例應用
- 7.1 建立Album 模塊
- 7.2 添加模塊文件
- 7.3 添加模塊配置文件
- 7.4 創建數據表 album
- 7.5 添加模型文件
- 7.6 添加表單 AlbumForm
- 7.7 添加控制器 AlbumController
- 7.8 添加模板文件
- 第8章 用戶認證
- 8.1 建立數據表
- 8.2 新建認證類
- 8.3 引用認證類
- 第9章 結束語