Skip to main content

Convert between Excel and PO files

Project description

# Translating via spreadsheets

NOTE: Original code of this was taken from https://github.com/wichert/po-xls

Not all translators are comfortable with using PO-editors such as [Poedit] (http://www.poedit.net/) or translation tools like [Transifex](http://trac.transifex.org/). For them this package provides simple tools to convert PO-files to xlsx-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. ``xls2po`` uses these to locale information in the file, so make sure never to change these!

# Install

## From repository `sh pip install . `

## From pypy `sh pip install po-excel-translate `

# Catalog to spreadshseet

Converting one or more PO-files to an xls file is done with the po-to-xls command:: `sh po2xls nl.po `

This will create a new file messages.xlsx with the Dutch translations. Multiple PO files can be specified:: `sh po2xls -o texts.xlsx zh_CN.po zh_TW.po nl.po `

This will generate a texts.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 Language key in the file metadata, falling back to the filename of no language information is specified. You can override this by explicitly specifying the locale on the commandline. For example:: `sh po2xls nl:locales/nl/LC_MESSAGES/mydomain.po `

This will read locales/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 the output.

# Spreadshseet to catalog

Translations can be converted back from a spreadsheet into a PO-file using the excel-to-po command:: `sh xls2po nl texts.xlsx nl.po `

This will take the Dutch (nl) translations from texts.xls, and (re)create a nl.po file using those. You can merge those into an existing po-file using a tool like gettext’s msgmerge.

Changelog

1.4.2 - May 11, 2017

  • Fix another problem with message context handling in po-to-xls.

1.4.1 - May 11, 2017

  • Fix po-to-xls handling of messages with a context.

1.4.0 - December 23, 2016

  • Fix compatibility with current OpenPyxl releases.
  • Fix Python 3 compatibility.

1.3.0 - July 6, 2015

  • Fix another ReST syntax error in package description.
  • Correcty handle rows with a missing translation.

1.2.0 - June 12, 2015

  • Fix ReST syntax error in package description.
  • Skip rows without a message id.

1.1.0 - 25 March 2015

  • Use [openpyxl](http://openpyxl.readthedocs.org/) instead of xlrd/xlwt. This fixes warnings about cell type conversions when opening generated xlsx files in Apple Numbers (and possibly others).

1.0.0 - 15 March 2015

Project details


Release history Release notifications

This version

3.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for po-excel-translate, version 3.0
Filename, size File type Python version Upload date Hashes
Filename, size po_excel_translate-3.0-py2.py3-none-any.whl (10.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size po-excel-translate-3.0.tar.gz (8.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page