- Notifications
You must be signed in to change notification settings - Fork24
wichert/po-xls
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Not all translators are comfortable with using PO-editors such asPoedit or translation tools likeWebLate orTransifex. For them this package provides simpletools to convert PO-files to xlsx-files and back again. This alsohas another benefit: it is possible to include multiple languages ina single spreadsheet, which can be helpful when translating tomultiple similar languages at the same time (for example simplifiedand traditional chinese).
The format for spreadsheets is simple:
- If any message use a message context the first column will specify thecontext. If message contexts are not used this column will be skipped.
- The next (or first) column contains the message id. This is generally thecanonical text.
- A set of columns for any requested comment types (message occurrences, sourcecomments or translator comments).
- A column with the translated text for each locale. Fuzzy translations aremarked in italic.
The first row contains the column headers.``xls-to-po`` uses these to localeinformation in the file, so make sure never to change these!
Converting one or more PO-files to an xls file is done with the po-to-xlscommand:
po-to-xls nl.po
This will create a new file messages.xlsx with the Dutch translations. MultiplePO files can be specified:
po-to-xls -o texts.xlsx zh_CN.po zh_TW.po nl.po
This will generate atexts.xlsx
file with all simplified Chinese,traditional Chinese and Dutch translations.
po-to-xls
will guess the locale for a PO file by looking at the Languagekey in the file metadata, falling back to the filename if no language informationis specified. You can override this by explicitly specifying the locale on thecommandline. For example:
po-to-xs nl:locales/nl/LC_MESSAGES/mydomain.po
This will readlocales/nl/LC_MESSAGES/mydomain.po
and treat it as Dutch(nl
locale).
You can also use the-c
or--comments
option with one of those choices:translator
,extracted
,reference
,all
to add more column in theoutput.
Translations can be converted back from a spreadsheet into a PO-file using thexls-to-po command:
xls-to-po nl texts.xlsx nl.po
This will take the Dutch (nl) translations from texts.xls, and (re)create anl.po
file using those. You can merge those into an existing po-file usinga tool like gettext'smsgmerge
.
You can ignore specific sheets by using-i
or--ignore
. For example:
xls-to-po -i 'Read Me First' -i Appendix nl texts.xlsx nl.po
Will ignore sheetsRead Me First
andAppendix
of the book.
About
Use xls files to update translations