Difference between revisions of "Tool4po help"

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.
(Command line update)
m
Line 82: Line 82:
 
   $ python3.1 tool4po.py --get-list-trans 'pair' [file xml output] [folder xml translated] [folder en_US xml]
 
   $ python3.1 tool4po.py --get-list-trans 'pair' [file xml output] [folder xml translated] [folder en_US xml]
 
'''Example:'''
 
'''Example:'''
   $ python3.1 tool4po.py --get-list-trans 'pair', 'list_trans.xml', 'zh_CN', 'en_US'
+
   $ python3.1 tool4po.py --get-list-trans 'pair' 'list_trans.xml', 'zh_CN', 'en_US'
  
 
or if you don't want to compare against the en_US
 
or if you don't want to compare against the en_US
Line 89: Line 89:
 
   $ python3.1 tool4po.py --get-list-trans 'single' [file xml output] [folder xml translated]
 
   $ python3.1 tool4po.py --get-list-trans 'single' [file xml output] [folder xml translated]
 
'''Example:'''
 
'''Example:'''
   $ python3.1 tool4po.py --get-list-trans 'single', 'list_trans.xml', 'zh_CN'  
+
   $ python3.1 tool4po.py --get-list-trans 'single' 'list_trans.xml', 'zh_CN'  
  
 
'''Details in process:'''
 
'''Details in process:'''

Revision as of 01:44, 16 June 2012

readme

  • Last modified by: Peanut Blake, Jul 18, 2010
  • Created by: Peanut Blake. May 01, 2010
  • Version of this readme file: 0.97

About tool4po

  • tool4po is a tool for interaction between XML format and .PO format for ADempiere ERP
    • XML format is ADempiere standard XML format in language packages.
    • .PO format is a kind of format related with GNU gettext. Launchpad translation platform is using .PO format.
  • Basic functions of tool4po:
    • Convert XML en_US packages into .POT template files. (.POT is standard model for global translations)
    • Convert existing XML translation packages into .po files, so that the existing translations can be upload to lp.net
    • tool4po is designed for global languages. Now it works well for Chinese. It can be easily avaible for other languages by changing one pattern string.

Prepare

Install Python3.1

  • Step 1: Download and install python3.1 ( or above ).
    • Debian/Linux:
 # apt-get install python3.1
    • Fedora:
 # yum install python3

po4a, msgfmt

Step 2: Download and install po4a

  • Debian/Linux:
 # apt-get install po4a
  • Fedora:
 # yum install po4a
  • ATTENTION:ONLY Linux version is available yet. So that some functions of tool4po related with po4a cannot run under MS Windows.

work dir

Step 3: Create & access the work dir

  • Linux:
 $ mkdir /home/tool4po/
 $ cd /home/tool4po/
  • Windows:
 $ mkdir D:\tool4po\
 $ cd D:\tool4po\

release tool4po

Step 4: Release tool4po to work dir
Copy following files of tool4po to work dir:    tool4po.py    config.xml    system.xml

Config parameter

Step 5: Config parameter to meet your needs

  1. Open 'config.xml'
  2. Modify the parameter in 'config.xml'
    1. For normal users, please pay attention to <default-language>.
    2. For translation local leader, please pay attention to:
      1. a. <default-language>.
      2. b. <language>. For east-asian languages, please use method='pattern'.For western languages, please use "method='compare'".
      3. c. <head-po>.
  3. Save file in 'UTF-8' charset format.

Functions for normal users

4.1. Get Translated XML files from translated PO files from Launchpad.net

Generate translation list from existing translation packages.e.g. , get file 'list_trans_zh_CN.xml' from folder 'zh_CN' which is already having Chinese translations.This step is to take advantage of existing translations, so that you don't have to re-translation all texts.

ATTENTION: Please use the en_US language package in the official wiki page: http://www.adempiere.com/index.php/TranslationProject . Otherwise you may get some translation missing. Because the en_US exported from ADempiere ERP database contains format like "<![CDATA[&Menu]]>".

Command:

 $ python3.1 tool4po.py --get-xml [folder en_US xml] [folder po translated] [folder xml translated output]

Example:

 $ python3.1 tool4po.py --get-xml 'en_US' 'po_zh_CN' 'xml_zh_CN'

Details in process:

  • step 1: Format convert: PO -> XML-AD.        ( 'en_US' + 'po_zh_CN' --> 'xml_zh_CN_tmp' )        ( 'zh_CN' -> 'zh_CN_4po' )
  • step 2: Get formal XML-AD files        ( 'xml_zh_CN_tmp' --> 'xml_zh_CN' )

5. Functions for translation local leader

5.1. Get Translation List

Generate translation list from existing translation packages.e.g. , get file 'list_trans_zh_CN.xml' from folder 'zh_CN' which is already having Chinese translations.This step is to take advantage of existing translations, so that you don't have to re-translation all texts.

Command:

 $ python3.1 tool4po.py --get-list-trans 'pair' [file xml output] [folder xml translated] [folder en_US xml]

Example:

 $ python3.1 tool4po.py --get-list-trans 'pair' 'list_trans.xml', 'zh_CN', 'en_US'

or if you don't want to compare against the en_US

Command:

 $ python3.1 tool4po.py --get-list-trans 'single' [file xml output] [folder xml translated]

Example:

 $ python3.1 tool4po.py --get-list-trans 'single' 'list_trans.xml', 'zh_CN' 

Details in process:

  • step 1: XML-format convert: XML-AD -> XML-4PO.         ( 'en_US' -> 'en_US_4po' )        ( 'zh_CN' -> 'zh_CN_4po' )
  • step 2: Get Original - Translation pairs by matching IDs & tags.        ( 'en_US_4po' & 'zh_CN_4po' -> 'list_trans_zh_CN.xml' )

5.2. Get PO files

Generate PO files. These files can be uploaded to Launchpad.net.

Command:

 $ python3.1 tool4po.py --get-po [file trans] [folder POT] [folder output]

Example:

 $ python3.1 tool4po.py --get-po 'list_trans.xml' 'pot' 'po'

Details in process:

  • step 1: XML-format convert: XML-MIX -> XML-SNG.        ( 'list_trans.xml' -> 'list_trans_en_US.xml' )        ( 'list_trans.xml' -> 'list_trans_en_US.xml' )
  • step 2: Get 'list_trans.po' by 'po4a-gettextize'.
  • step 3. Generate .PO files. 'list_trans.po' & 'pot' -> 'po'.
  • step 4. Re-organize .PO files in the format accepted by Launchpad.net.
  • step 5. msgfmt. check format of .po files

5.3. Merge PO files into ONE PO file

This function is useful if you have different xml translation packages from different people.If you don't need it, please ignore it and skip this step.
In this case, you can use "--get-list-trans" and "--get-po" for each translated xml packages.This function merges all the po files in the folder into 1 po file.

Command:

 $ python3.1 tool4po.py --po-merge [folder po] [file po output]

Example:

 $ python3.1 tool4po.py --po-merge 'po-pool' 'list_trans.po'

5.4. Get Launchpad.net packages

Generate packages, which can be uploaded to Launchpad.net.

Command:

 $ python3.1 tool4po.py --lp-package [folder input] [folder output] [type]

Example:

 $ python3.1 tool4po.py --lp-package 'po' 'po_lp' 'po'

6. Functions for Translation Project leader

6.1. Tidy en_US XML package

Tidy the format of en_US XML files (XML-AD).This function is especially for <![CDATA[&Menu]]>.

Command:

 $ python3.1 tool4po.py --tidy-xml [source folder] [target folder]

Example:

 $ python3.1 tool4po.py --tidy-xml 'en_US' 'en_US_tidy'

6.2.Get POT templates

Generate POT template files from 'en_US' xml files..POT files are to be uploaded to Launchpad.net as templates.

Command:

 $ python3.1 tool4po.py --get-pot [folder en_US] [folder output]

Example:

 $ python3.1 tool4po.py --get-pot 'en_US' 'pot'

Details in process:

  • step 1: XML-format convert: XML-AD -> XML-4PO. ( 'en_US' -> 'en_US_4po' )
  • step 2: Convert: XML-4PO -> .POT. by po4a-gettextize. ( 'en_US_4po' -> 'pot_tmp' )
  • step 3. Reorganize POT file. ( 'pot_tmp' -> 'pot' )
  • step 4. msgfmt. check format of .pot files

6.3. Get Launchpad.net packages

Generate packages, which can be uploaded to Launchpad.net.

Command:

 $ python3.1 tool4po.py --get-list-trans [folder input] [folder output] [type]

Example:

 $ python3.1 tool4po.py --get-list-trans 'pot' 'pot_lp' 'pot'

Attention:[type] option: 'pot' / 'po'the package formats are different between *.POT files & *.PO files.

7. Mile Stone

Mile stone of tool4po:

  • Mile Stone 08: 0.983a, Aug 12, 2010. Function: --get-xml-lp.
  • Mile Stone 08: 0.98a, Aug 02, 2010. Enhanced the remark information in POT files.
  • Mile Stone 07: 0.97a, Jul 18, 2010. 1. Using en_US standard package. 2. Support pot_remark. 3. Function: --tidy-xml.
  • Mile Stone 06: 0.96a, Jun 25, 2010. 1. Function: --get-xml. 2. Support western languages such as German.
  • Mile Stone 05: 0.95a, Jun 02, 2010. Finished rewriting in Object-Orient method
  • Mile Stone 04: 0.94a, May 09, 2010. Rewrite in Object-Orient method
  • Mile Stone 03: 0.93a, Apr 17, 2010. Complete: --msgfmt, --lp-package.
  • Mile Stone 02: 0.92a, Apr 16, 2010. Complete: --get-pot.Mile Stone 01: 0.89a, Mar 16, 2010.

END

This is the end of the file.

Reference