I18n - 国际化

关于多种语言应用程序的说明

简介

The I18n contains the translation of module in different languages. The folder contains two type of files .po and .pot. The .po files are the actual translation files where as .pot is the template for the translation.

.po 文件应该是依照对应语言的代码命名的, .pot 应该是依照对应模块的名称命名的。

以下以 account.pot 为例子

  1. "Project-Id-Version: OpenERP Server 5.0.0\n"
  2. "Report-Msgid-Bugs-To: support@openerp.com\n"
  3. "POT-Creation-Date: 2009-05-19 14:36+0000\n"
  4. "PO-Revision-Date: 2009-05-20 10:36+0000\n"
  5. "Last-Translator: <>\n"
  6. "Language-Team: \n"
  7. "MIME-Version: 1.0\n"
  8. "Content-Type: text/plain; charset=UTF-8\n"
  9. "Content-Transfer-Encoding: 8bit\n"
  10. "X-Launchpad-Export-Date: 2009-12-07 15:06+0000\n"
  11. "X-Generator: Launchpad (build Unknown)\n"
  12. #. module: account
  13. #: code:addons/account/account.py:0
  14. #, python-format
  15. msgid "Integrity Error !"
  16. msgstr ""

上述的文件是会计(account)模块翻译文件的模板,里面的程序是在判别所有模块里的值,在对应的语言里应该被翻译成什么。

以下例子是会计模块里的 fr_FR.po 把会计模块翻译成法文。

  1. # Translation of OpenERP Server.
  2. # This file contains the translation of the following modules:
  3. # * account
  4. #
  5. msgid ""
  6. msgstr ""
  7. "Project-Id-Version: OpenERP Server 5.0.0\n"
  8. "Report-Msgid-Bugs-To: support@openerp.com\n"
  9. "POT-Creation-Date: 2009-05-19 14:36+0000\n"
  10. "PO-Revision-Date: 2010-01-04 11:19+0530\n"
  11. "Last-Translator: Anup <ach@tinyerp.co.in>\n"
  12. "Language-Team: \n"
  13. "MIME-Version: 1.0\n"
  14. "Content-Type: text/plain; charset=UTF-8\n"
  15. "Content-Transfer-Encoding: 8bit\n"
  16. "X-Launchpad-Export-Date: 2009-12-07 15:07+0000\n"
  17. "X-Generator: Launchpad (build Unknown)\n"
  18. #. module: account
  19. #: code:addons/account/account.py:0
  20. #, python-format
  21. msgid "Integrity Error !"
  22. msgstr "Erreur d'Intégrité !"

The above file translates the values of msgid to French in msgstr.Based on the msgid present in the .pot file. fr_FR is the language code for French language in which fr specifies the language and FR specifies the country in which the language is spoken.