中文翻译文档

From Dolibarr Open Source ERP CRM Wiki

Contents

Language.png Dolibarr简体中文汉化教程

参考:duuge。com/archives/Dolibarr.html DolibarrQQ群原创:206239089 (简体中文翻译交流)
Dolibarr 语言文件已经被翻译成多国语言文件.

默认语言为 English 英语并且一直为完成状态。其他语言尚有待您的大力贡献。

本教程可以指引您完成一个语种的翻译或者修正已翻译的语言错误以及未审阅的翻译。

Dolibarr 有以下三种不同的翻译方式方法:

  1. 使用 Transifex 网站手工翻译大法 (官方推荐此法).
  2. 手工编辑修改语言文件法
  3. 自动化翻译: 自动翻译法

通过Transifex专业翻译网站在线翻译 (推荐)

Transifex 是一个给翻译项目提供在线翻译平台的在线应用。该平台包括翻译团队和讨论工具,翻译记忆,术语表,校对等N多功能。 此平台相当容用并且全部翻译人员能够从WEB网页或使用该平台专用的TX命令行客户端上传及下载翻译成果 Transifex 是一个开源项目并且其社区版本允许免费下载并安装使用,但我们Dolibarr官方使用的是transifex网站的在线服务。

通过网页在线汉化 (翻译人员)

如果您想帮助Dolibarr翻译完善您的语言,请点击 https://www.transifex.com/dolibarr-association/dolibarr/

您事先需要注册一个账号并申请加入Dolibarr项目翻译团队中来。管理员会给你发封邮件告知你已经被管理团队加入翻译人员之中了。

一旦您认可,您即可开始翻译啦。

更多信息, 请翻阅 Transifex 官方的"Getting Started" 翻译向导介绍 http://docs.transifex.com/introduction/translators/ 以及编辑人员之旅 http://docs.transifex.com/tutorials/txeditor/

注意 en_US

web接口不可翻译en_US源语言因为这是默认语言不允许动呀。 任何变更一定会体现在Dolibarr源代码中的请放心我们会将您的提交pull到Dolibarr在github的源码库中的。

使用 TX 官方客户端命令行工具 (这是给Dolibarr Category:Yoda 团队看的你别看哟——其实我就看完了,嘿嘿嘿费玉清)

此处进行描述如何使用Transifex官方客户端命令行工具。然而,这里保留Dolibarr管理员们用于同步Dolibarr的Transifex主源码。

Official documentation

TX 客户端配置

首先当然是安装 TX 客户端程序软件了. 基于 Debian/Ubuntu/Mint请使用以下安装命令进行安装: 当然首先要安装python-pip

apt-get install python-pip

然后再安装transifex-client

pip install transifex-client

byiz注:本人用上述方法安装失败,使用下面:

easy_install transifex-client

easy_install transifex-client.安装成功, 然后对 TX 运行环境初始化. 即切换到dolibarr根目录下之后运行 tx init 命令. 必须要先tx init初始化才行哦,见duuge笔记记录全文这里不再累述。

cd git/dolibarr
tx init

同意盖掉config配置文件。全部保持默认值即可。因为咱也不懂想改也不知道改哪里就保持默认了一路按回车吧。最后回车不下去了原来是需要输入transifex的账号和密码呢。

做完上边动作,会在当前用户的HOME目录下生成隐藏文件 .transifexrc ,这是这条命令用root权限 .tx/config 生成的. 目录类似如下这样子吧(我本人的不是,我是直接mkdir一个新目录dolibarr-tx目录用来专门放翻译语言避免搞混了源文呀):

.
|-- build
|-- build.xml
|-- ChangeLog
|-- COPYING
|-- COPYRIGHT
|-- dev
|-- doc
|-- .gitignore
|-- htdocs
|-- INSTALL
|-- pom.xml
|-- quickbuild.xml
|-- README
|-- README-FR
|-- README.md
|-- robots.txt
|-- scripts
|-- test
`-- .tx

当然这个 config 配置文件可从 https://github.com/Dolibarr/dolibarr/tree/develop/.tx 下载得到的啦别担心, 下载回来并放到 .tx 目录中去, 盖掉因为使用命令 tx init 而生成的那个配置文件哦。

此项目配置文件用于说明项目的详情和文件与源码的映射对应。

下边有一个简洁的 config 配置文件所包含有哪些元素不包生仔哦:

[main]
host = https://www.transifex.com
lang_map = uz: uz_UZ, sw: sw_SW, sr@latin: sr_RS
 
[dolibarr.accountancy]
file_filter = htdocs/langs/<lang>/accountancy.lang
source_file = htdocs/langs/en_US/accountancy.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.admin]
file_filter = htdocs/langs/<lang>/admin.lang
source_file = htdocs/langs/en_US/admin.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.agenda]
file_filter = htdocs/langs/<lang>/agenda.lang
source_file = htdocs/langs/en_US/agenda.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.banks]
file_filter = htdocs/langs/<lang>/banks.lang
source_file = htdocs/langs/en_US/banks.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.bills]
file_filter = htdocs/langs/<lang>/bills.lang
source_file = htdocs/langs/en_US/bills.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.bookmarks]
file_filter = htdocs/langs/<lang>/bookmarks.lang
source_file = htdocs/langs/en_US/bookmarks.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.boxes]
file_filter = htdocs/langs/<lang>/boxes.lang
source_file = htdocs/langs/en_US/boxes.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.cashdesk]
file_filter = htdocs/langs/<lang>/cashdesk.lang
source_file = htdocs/langs/en_US/cashdesk.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.categories]
file_filter = htdocs/langs/<lang>/categories.lang
source_file = htdocs/langs/en_US/categories.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.commercial]
file_filter = htdocs/langs/<lang>/commercial.lang
source_file = htdocs/langs/en_US/commercial.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.companies]
file_filter = htdocs/langs/<lang>/companies.lang
source_file = htdocs/langs/en_US/companies.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.compta]
file_filter = htdocs/langs/<lang>/compta.lang
source_file = htdocs/langs/en_US/compta.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.contracts]
file_filter = htdocs/langs/<lang>/contracts.lang
source_file = htdocs/langs/en_US/contracts.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.cron]
file_filter = htdocs/langs/<lang>/cron.lang
source_file = htdocs/langs/en_US/cron.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.deliveries]
file_filter = htdocs/langs/<lang>/deliveries.lang
source_file = htdocs/langs/en_US/deliveries.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.dict]
file_filter = htdocs/langs/<lang>/dict.lang
source_file = htdocs/langs/en_US/dict.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.donations]
file_filter = htdocs/langs/<lang>/donations.lang
source_file = htdocs/langs/en_US/donations.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.ecm]
file_filter = htdocs/langs/<lang>/ecm.lang
source_file = htdocs/langs/en_US/ecm.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.errors]
file_filter = htdocs/langs/<lang>/errors.lang
source_file = htdocs/langs/en_US/errors.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.exports]
file_filter = htdocs/langs/<lang>/exports.lang
source_file = htdocs/langs/en_US/exports.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.externalsite]
file_filter = htdocs/langs/<lang>/externalsite.lang
source_file = htdocs/langs/en_US/externalsite.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.ftp]
file_filter = htdocs/langs/<lang>/ftp.lang
source_file = htdocs/langs/en_US/ftp.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.help]
file_filter = htdocs/langs/<lang>/help.lang
source_file = htdocs/langs/en_US/help.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.holiday]
file_filter = htdocs/langs/<lang>/holiday.lang
source_file = htdocs/langs/en_US/holiday.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.hrm]
file_filter = htdocs/langs/<lang>/hrm.lang
source_file = htdocs/langs/en_US/hrm.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.incoterm]
file_filter = htdocs/langs/<lang>/incoterm.lang
source_file = htdocs/langs/en_US/incoterm.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.install]
file_filter = htdocs/langs/<lang>/install.lang
source_file = htdocs/langs/en_US/install.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.interventions]
file_filter = htdocs/langs/<lang>/interventions.lang
source_file = htdocs/langs/en_US/interventions.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.languages-not-res]
file_filter = htdocs/langs/<lang>/languages.lang
source_file = htdocs/langs/en_US/languages.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.ldap]
file_filter = htdocs/langs/<lang>/ldap.lang
source_file = htdocs/langs/en_US/ldap.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.link]
file_filter = htdocs/langs/<lang>/link.lang
source_file = htdocs/langs/en_US/link.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.loan]
file_filter = htdocs/langs/<lang>/loan.lang
source_file = htdocs/langs/en_US/loan.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.mailmanspip]
file_filter = htdocs/langs/<lang>/mailmanspip.lang
source_file = htdocs/langs/en_US/mailmanspip.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.mails]
file_filter = htdocs/langs/<lang>/mails.lang
source_file = htdocs/langs/en_US/mails.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.main]
file_filter = htdocs/langs/<lang>/main.lang
source_file = htdocs/langs/en_US/main.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.margins]
file_filter = htdocs/langs/<lang>/margins.lang
source_file = htdocs/langs/en_US/margins.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.members]
file_filter = htdocs/langs/<lang>/members.lang
source_file = htdocs/langs/en_US/members.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.oauth]
file_filter = htdocs/langs/<lang>/oauth.lang
source_file = htdocs/langs/en_US/oauth.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.opensurvey]
file_filter = htdocs/langs/<lang>/opensurvey.lang
source_file = htdocs/langs/en_US/opensurvey.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.orders]
file_filter = htdocs/langs/<lang>/orders.lang
source_file = htdocs/langs/en_US/orders.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.other]
file_filter = htdocs/langs/<lang>/other.lang
source_file = htdocs/langs/en_US/other.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.paybox]
file_filter = htdocs/langs/<lang>/paybox.lang
source_file = htdocs/langs/en_US/paybox.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.paypal]
file_filter = htdocs/langs/<lang>/paypal.lang
source_file = htdocs/langs/en_US/paypal.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.printing]
file_filter = htdocs/langs/<lang>/printing.lang
source_file = htdocs/langs/en_US/printing.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.productbatch]
file_filter = htdocs/langs/<lang>/productbatch.lang
source_file = htdocs/langs/en_US/productbatch.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.products]
file_filter = htdocs/langs/<lang>/products.lang
source_file = htdocs/langs/en_US/products.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.projects]
file_filter = htdocs/langs/<lang>/projects.lang
source_file = htdocs/langs/en_US/projects.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.propal]
file_filter = htdocs/langs/<lang>/propal.lang
source_file = htdocs/langs/en_US/propal.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.receiptprinter]
file_filter = htdocs/langs/<lang>/receiptprinter.lang
source_file = htdocs/langs/en_US/receiptprinter.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.resource]
file_filter = htdocs/langs/<lang>/resource.lang
source_file = htdocs/langs/en_US/resource.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.salaries]
file_filter = htdocs/langs/<lang>/salaries.lang
source_file = htdocs/langs/en_US/salaries.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.sendings]
file_filter = htdocs/langs/<lang>/sendings.lang
source_file = htdocs/langs/en_US/sendings.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.sms]
file_filter = htdocs/langs/<lang>/sms.lang
source_file = htdocs/langs/en_US/sms.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.stocks]
file_filter = htdocs/langs/<lang>/stocks.lang
source_file = htdocs/langs/en_US/stocks.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.suppliers]
file_filter = htdocs/langs/<lang>/suppliers.lang
source_file = htdocs/langs/en_US/suppliers.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.supplier_proposal]
file_filter = htdocs/langs/<lang>/supplier_proposal.lang
source_file = htdocs/langs/en_US/supplier_proposal.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.trips]
file_filter = htdocs/langs/<lang>/trips.lang
source_file = htdocs/langs/en_US/trips.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.users]
file_filter = htdocs/langs/<lang>/users.lang
source_file = htdocs/langs/en_US/users.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.withdrawals]
file_filter = htdocs/langs/<lang>/withdrawals.lang
source_file = htdocs/langs/en_US/withdrawals.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.website]
file_filter = htdocs/langs/<lang>/website.lang
source_file = htdocs/langs/en_US/website.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.workflow]
file_filter = htdocs/langs/<lang>/workflow.lang
source_file = htdocs/langs/en_US/workflow.lang
source_lang = en_US
type = MOZILLAPROPERTIES

这里有专门解释config配置文件的章节哦:

[main] section

本章节中我们有项目范围的选项,默认transifex为全部的项目的服务器。你也可以自建服务器然后需要修改这里相对应的选项。、

[dolibarr.resource]

source_lang: 这是资源的源语言.
source_file: 这直接指向源文件.
file_filter: 在这里,我们保持用于识别特定项目下的翻译文件的表达式。 not mandatory
trans.<lang>: 这是用于翻译的文件,不遵循一个共同的命名模式和文件的表达不能被用来跟踪他们。 not mandatory
host: 万一项目不使用默认的Transifex服务器那么就在 [main] 这里标记设定, it can override it using this option. not mandatory

TX 使用方法简要说明

一些有用的TX命令的 tx 帮助信息.

tx status

显示翻译状态

tx push

使用push命令将你本地计算机中的翻译文件push上传到Transifex服务器
更多的tx push命令的帮助信息如下:

-h - Shows the help screen for the command
-l <lang> - Specify which translations you want to push (defaults to all)
-r <resource> - Specify the resource for which you want to push the translations (defaults to all)
-f - Push source files without checking modification times
--skip - Don't stop on errors. Useful when pushing many files concurrently.
-s - Push the source file to the server
-t - Push the translation files to the server
--no-interactive - Don't require user input when forcing a push

tx pull

使用pull命令将Transifex服务器的翻译文件pull下载到你本地计算机中
更多的tx pull命令的帮助信息如下:

-h - Shows the help screen for the command
-l <lang> - Specify which translations you want to pull (defaults to all)
-r <resource> - Specify the resource for which you want to pull the translations (defaults to all)
-a - Fetch all translation files from server (even new ones)
-s - Force the fetching of the source file (default: False)
-f - Force download of translations files
--skip - Don't stop on errors. Useful when pushing many files concurrently.
--disable-overwrite - By default Transifex will fetch new translations files and replace existing ones. Use this flag if you want to disable this feature.
--minimum_perc=VALUE - Specify the minimum acceptable percentage of a translation in order to download it.

示例

从transefix拉取翻译文件回来, 可用如下命令:

tx -d pull -l zh_CN  # 仅拉取简体中文语言
tx -d pull -a   # 拉取全部语言

推送本地翻译源文件到transefix去, 输入以下命令即可:

tx -d push -t -l zh_CN [-r dolibarr.file]   # 仅推送指定的zh_CN简体中文语言的翻译源文件到trasefix去
tx -d push -s  # To push source file

有关 transifex 的其他问题

下面是三个 transifex 翻译相关的疑问及官方解答:

1) 这是定期同步到Dolibarr中去的吗?定期多久呢 ?

不。这不是定期的。因此也不存在定期多久的问题。 当翻译的提交足够多的时候。 这些翻译结果也作为 beta branch 分支或者最终稳定版本中使用。

2) Are all the translations synced to git, or only the reviewed translations. Do I need to review before sync is done ?

When a Sync is done, transifex files overwrites files into git, but only if there is at least on record modified for the file. You don't have to make review before sync is done. Making review is above all to know which lines were manually reviewed and which one were initially translated using a robot.

3) In which Dolibarr releases will translations be available ? Are transifex translations also synced to maintenance releases ?

Sync is always done on develop and/or beta. So transifex changes appear in all version whose branch is created after the transifex change (a sync is always done before creating a new branch). Once a branch is created, then new changes into transifex will be available only for next branch. Reason of this is that transifex is not able to manage branch/versions (not yet).

Manual Translation (not recommended)

To translate Dolibarr into another language, go to the langs directory and create a folder/directory named with the code language to translate (follow the existing format, for example en_US, en_GB, es_ES, de_DE, etc...). Then copy the files from an existing language directory (for example en_US/main.lang, en_GB/bills.lang), into the new language directory that you have just created.

These files have the format of key/value pairs in each line like the followings:

Code1 = translate phrase 1
Code2 = translate phrase 2
...
Coden = translate phrase n

Translate the phrases (the value portion of the key/value pairs) on right side of the "=" as seen above, the code (the key portion) on left side of "=" should remain unchanged. It is possible to translate the files one by one, without bringing them all at once. If a file has not been translated into the new language, Dolibarr uses English.

To have a localised (translated) string into the PHP code, all you have to do is load the language file and use the method to get the translated value, like this:

$langs->load("myfile"); // or use $langs->load("myfile@mymodule") if myfile.lang is inside directory htdocs/mymodule/langs/xx_XX   
 
print $langs->trans("CodeX")

An entry type;

CodeX = phrase X

must be present or added to the myfile.lang file.


Automatic Translation with autotranslator.php tool

  • Translator OS: All
  • Tool: autotranslator.php provided with Dolibarr in directory dev/translation.

This method is recommended when starting translation for a language not already initialized. If there is already a translation available but you need to add missing key or correct errors, try to use method using Transifex (see later).

To make or update all files of a language code, just run the script:

php autotranslator.php lang_code_source lang_code_target GOOGLEAPIKEY

For example :

php autotranslator.php en_US pt_PT GOOGLEAPIKEY

to translate into Portuguese (pt_PT) using English (en_US) files.

All non existing files will be created, all existing files will be updated. The tool use Google translation service to find the translation value of a string, so a working Internet connection is required from station running the script. Also a GOOGLEAPIKEY is required and Google charges a fee for using this service (20 euros / 1 000 000 of translated chars). Your PHP must also have permissions to write into htdocs/langs directory and must have curl functions available.

Language.png Distribute or include your translation into core source

Including your translation in the official Dolibarr sources

Once you start translating, it's a smart decision to share it, so it can be included into the official code of Dolibarr. If you keep it for you, others will not be able to improve it when new terms are added or previous terms are modified, and you will still have to manage the translation on your own.

If you translated through the Transifex system, there's nothing to be done. Your translation will be included in the next version of Dolibarr. No additional work! In technical terms, the translation will be exported from Transifex and imported into Dolibarr by our developers, at least once every month.

If, however, you translated directly in Dolibarr files, then you will first have to transfer those translations to Transifex before they can be included. So, really, you should start translating into Transifex. If you send us your translation through a Pull Request on Github, sadly, it will be overwritten by the next import from Transifex, so it would be very short-lived.

Adding new variables

The reference language is en_US and is always complete. You can find it in the htdocs/langs/en_US/ folder. All other language files are likely to be slightly or highly incomplete, depending on the language.

If you are developing a new module, you are likely going to need the addition of new language variables. This is done exclusively through the update of the en_US language (htdocs/langs/en_US/ folder). Just modify these files to add the variable you need and send the resulting folder as part of your Pull Request. Refer to the developer documentation to learn how to contribute code (you will need an account on http://www.github.com.

As an extension

When you create a new language, if it is not already integrated into Dolibarr, it can still be broadcast to all other users. You can make a distribution package using the build/makepack-dolibarrlang.pl script or making a zip archive manually and posting it on dolistore.com or sending it to the developers' mailing list dolibarr-dev (https://savannah.nongnu.org/mail/?group=dolibarr).

New language files are immediately available in an installation as soon as the archive is unzipped in the correct directory.

Language.png Translate documentation on wiki

The wiki is written in 3 languages: English, French and Spanish. If you want to enhance documentation on one of these languages, all you have to do is to create an account on this wiki. Then, you can edit existing pages to correct a bad translation or translate pages waiting for translation Category:Page_waiting_for_translation.

Personal tools
  • Ask to contact@dolibarr.org to request an account to contribute to this documentation
  • Log in
In other languages
<multilanguagemanager_en><multilanguagemanager_fr><multilanguagemanager_es><multilanguagemanager_de>
&lt;multilanguagemanager_notranslation&gt;
<multilanguagemanager_it><multilanguagemanager_el>
&lt;multilanguagemanager_notranslation&gt;

Social networks
Follow us on Google+ Follow us on Facebook Follow us on LinkedIn Follow us on Twitter