Skip to content

sugarlabs/po-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

po-utils

Some utils I use to manage PO files for my JavaScript apps

js2pot.py scrapes strings from the js/ and plugins/ subdirectorys to update the project POT file. Usage is:

python js2pot.py TopLevelProjectDirectory ProjectPOTPath

pot2po.py updates the strings found in an individual PO file from the project POT file. Usage is:

python pot2po.py ProjectPOTPath POFilePath

There is an optional 3rd argument that can be used to specify a second PO file from which to extract TRANS messages. For example, if you wanted to add Spanish hints to the Aymara PO file:

python pot2po.py MusicBlocks/po/MusicBlocks.pot MusicBlocks/po/ayc.po MusicBlocks/po/es.po

po2po.py will mine a PO file for msgstrs that are missing in a second po file. Usage is:

python po2po.py SourcePOFilePath TargetPOFilePath [-i, --ignorecase]

The SourcePOFile is a PO file that contains potentially useful strings. The TagetPOFile is the PO file in need of additional translations. Note that the result is placed in a third file, tmp.po

If the --ignorecase argument is given, the case of the msgid in Source is ignored.

Note: I am using a simple schema for TRANS notes in my code:

    //.TRANS: a message to the translator goes here

svg2svg.py will translate any strings in an SVG file based on a PO file. Usage is:

python svg2svg.py SourceSVGFilePath SourcePOFilePath

Output is an SVG file will a _ inserted at the end of the filename.

js2js.py will translate any strings in an JS file based on a PO file. Usage is:

python js2js.py repoFilePath SourcePOFilePath

Output is an JS or JSON file will a _ inserted at the end of the filename.