Package: po-excel-translate
Translating via spreadsheetsNot all translators are comfortable with using PO-editors such asPoeditor translation tools likeTransifex. For them this package provides simple tools to
convert PO-files toxlsx-files and back again. This also has another benefit:
it is possible to include multiple languages in a single spreadsheet, which can be
helpful when translating to multiple similar languages at the same time (for
example simplified and traditional chinese).The format for spreadsheets is simple:If any message use a message context the first column will specify the
context. If message contexts are not used this column will be skipped.The next (or first) column contains the message id. This is generally the
canonical text.A set of columns for any requested comment types (message occurrences, source
comments or translator comments).A column with the translated text for each locale. Fuzzy translations are
marked in italic.IMPORTANT:The first row contains the column headers.xls2pouses these to locale
information in the file, so make sure never to change these!ComparisonNOTE: Original code of this was taken fromhttps://github.com/wichert/po-xlsAdvantages of this implementation:sane defaultsthe first row and first columns are freezed so that you can always see the source string you want to translatecustomizable options like width/wrap/protected ranges/fontscan use the exporter/importer from another python project, you just import the library after installing it:frompathlibimportPathimportpo_excel_translateaspoet# po2xlspo_files_to_convert=[poet.PortableObjectFile("ro-example.po")]poet.PortableObjectFileToXLSX(po_files=po_files_to_convert,comment_types=[poet.CommentType.SOURCE],output_file_path=Path("ro-example.xlsx"))# xls2popoet.XLSXToPortableObjectFile(locale="ro",input_file_path=Path("ro-example.xlsx"),output_file_path=Path("ro-example.po"))InstallFrom repositorypipinstall.From pypipipinstallpo-excel-translatePortable Object (.po) to spreadshseet (.xlsx)Converting one or more PO-files to an xls file is done with thepo2xlscommand:po2xlsnl.poThis will create a new filemessages.xlsxwith the Dutch translations. Multiple
PO files can be specified:po2xls-otexts.xlsxzh_CN.pozh_TW.ponl.poThis will generate atexts.xlsxfile with all simplified Chinese,
traditional Chinese and Dutch translations.po2xlswill guess the locale for a PO file by looking at theLanguagekey in the file metadata, falling back to the filename if no language information
is specified. You can override this by explicitly specifying the locale on the command line. For example:po2xlsnl:locales/nl/LC_MESSAGES/mydomain.poThis will readlocales/nl/LC_MESSAGES/mydomain.poand treat it as Dutch
(nllocale).You can also use the-cor--commentsoption with one of those choices:translator,extracted,reference,allto add more column in the
output.Spreadshseet (.xlsx) to Portable Object (.po)Translations can be converted back from a spreadsheet into a PO-file using thexls2pocommand:xls2ponltexts.xlsxnl.poThis will take the Dutch (nl) translations fromtexts.xls, and (re)create annl.pofile using those. You can merge those into an existing po-file using a tool like gettext'smsgmerge.