分类 dolibarr 下的文章

今年就翻到这里了,
odoo10.0还剩688条未翻译,11还是老样子,odoo12.0就要破4K,
老唐说,若干年后,他会回忆起当年一起整odoo官方翻译这事儿,
专注干一件事情,想想也蛮不错的————是为记。杜哥@1028年09月26日 23:42
adfg.png

参考:https://wiki.dolibarr.org/index.php/Zh_Translator_documentation

基于Linux Mint 18

DolibarrQQ群原创:206239089 (简体中文翻译交流)

1.安装transifex-client:提示没安装但最新版本是0.12的而apt-get install的是0.10这个版本不能用有问题的。于是继续下面步骤。

2.安装python pip:

sudo apt-get install python-pip

3.安装setuptools:

sudo pip install setuptools

4.安装transifex-client:

sudo pip install transifex-client

sudo easy_install install transifex-client

5.执行下面命令:

tx -d pull -l zh_CN

报错,提示:

duuge@Latitude-E6410 ~/github/dolibarr-tx $ tx -d pull -l zh_CNPath to tx is /home/duuge/github/dolibarr-tx.
Config file is /home/duuge/github/dolibarr-tx/.tx/config
.transifexrc file is at /home/duuge/github/dolibarr-tx
.transifexrc file is at /home/duuge
/home/duuge/.transifexrc not found.
Handling resource dolibarr.accountancy
Language mapping is: Flipdict({'sw': 'sw_SW', 'sr@latin': 'sr_RS', 'uz': 'uz_UZ'})
URL data are: {'project': 'dolibarr', 'host': 'https://www.transifex.com', 'resource': 'accountancy'}
No user credentials found for host https://www.transifex.com. Edit ~/.transifexrc and add the appropriate info in there.
Exception: No user credentials found for host https://www.transifex.com. Edit ~/.transifexrc and add the appropriate info in there.

看到:Edit ~/.transifexrc这文件没配置好。好吧用命令tx init初始化一下就解决。

tx init

会提示输入你在transifex网站的账号和密码。
完了之后继续 执行

补全一下.tx文件夹下的config配置文件(有点长)文件在github的dolibarr源代码的.tx文件夹下:
右键另存为千万别直接点击:https://github.com/Dolibarr/dolibarr/blob/develop/.tx/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

6.执行下面命令:

tx -d pull -l zh_CN

成功!

duuge@Latitude-E6410 ~/github/dolibarr-tx $ tx -d pull -l zh_CN
Path to tx is /home/duuge/github/dolibarr-tx.
Config file is /home/duuge/github/dolibarr-tx/.tx/config
.transifexrc file is at /home/duuge/github/dolibarr-tx
.transifexrc file is at /home/duuge
Handling resource dolibarr.accountancy
Language mapping is: Flipdict({'sw': 'sw_SW', 'sr@latin': 'sr_RS', 'uz': 'uz_UZ'})
URL data are: {'project': 'dolibarr', 'host': 'https://www.transifex.com', 'resource': 'accountancy'}
Statistics response is {
    "ar_SA": {
        "reviewed_percentage": "70%", 
        "completed": "70%", 
        "untranslated_words": 229, 
        "last_commiter": "eldy", 
        "reviewed": 97, 
        "translated_entities": 97, 
        "translated_words": 503, 
        "last_update": "2016-08-30 23:05:18", 
        "untranslated_entities": 40
    }, 
    "en": {
        "reviewed_percentage": "0%", 
        "completed": "100%", 
        "untranslated_words": 0, 
        "last_commiter": "eldy", 
        "reviewed": 0, 
        "translated_entities": 137, 
        "translated_words": 732, 
        "last_update": "2016-08-30 23:05:19", 
        "untranslated_entities": 0
    }, 

......
......
......

Adding to new translations: set([])
Pulling languages for: set(['zh_CN'])
Pulling translations for resource dolibarr.workflow (source: htdocs/langs/en_US/workflow.lang)
Using file htdocs/langs/zh_CN/workflow.lang
Remote time is 1473712800.0 and local 1473713460.0
Local is newer than remote for lang zh_CN
Skipping 'zh_CN' translation (file: htdocs/langs/zh_CN/workflow.lang).
Done.
duuge@duuge-Latitude-E6410 ~/github/dolibarr-tx $ 

用的是https://github.com/Dolibarr/dolibarr/blob/develop/Dockerfile这份Dockerfile,如下:
1、先创建文件夹:
sudo mkdir dolibarr
cd dolibarr
进到dolibarr文件夹后,
2、再创建Dockefile:
sudo vim Dockerfile
内容如下:




FROM php:5.6-apache

RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev \

&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd

RUN docker-php-ext-install mysqli

COPY htdocs/ /var/www/html/

RUN chown -hR www-data:www-data /var/www/html

EXPOSE 80



然后,重点来了,用docker build来创建images镜像:
3、命令如下 :
sudo docker build dolibarr .
请注意末尾有一个英文状态下的句号.句点,这个“.“小句点我之前一直没加上,所以build不下去,一直报错就是这里。


root@server:/home/liangjia/docker/dolibarr# ls
Dockerfile
root@server:/home/liangjia/docker/dolibarr# docker build -t dolibarr
docker: "build" requires 1 argument.
See 'docker build --help'.

Usage: docker build [OPTIONS] PATH | URL | -

Build an image from a Dockerfile
root@server:/home/liangjia/docker/dolibarr# docker build -t dolibarr .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM php:5.6-apache
Pulling repository docker.io/library/php
88536ecbcd56: Pulling dependent layers
cb6fb082434e: Downloading 13.4 MB


记录备用:
1、本机的ubuntu先安装python-pip:
apt-get install python-pip
2、再用pip来安装transifex-client:
pip install transifex-client
3、然后建个git目录给odoo或dolibarr并初始化tx的client客户端环境:
odoo的:
mkdir /git/odoo
cd git/odoo
tx init

dolibarr的:
mkdir /git/dolibarr
cd git/dolibarr
tx init

其他不动保持默认,需要的时候请输入你在transifex.com的账号和密码