Skip to main content

Translating via spreadsheets

Not all translators are comfortable with using PO-editors such as Poedit or translation tools like Transifex. 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!

Comparison

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

Advantages of this implementation:

  • sane defaults
  • the first row and first columns are freezed so that you can always see the source string you want to translate
  • customizable options like width/wrap/protected ranges/fonts
  • can use the exporter/importer from another python project, you just import the library after installing it:
from pathlib import Path
import po_excel_translate as poet

# po2xls
po_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")
)

# xls2po
poet.XLSXToPortableObjectFile(
	locale="ro",
	input_file_path=Path("ro-example.xlsx"),
	output_file_path=Path("ro-example.po")
)

Install

From repository

pip install .

From pypi

pip install po-excel-translate

Portable Object (.po) to spreadshseet (.xlsx)

Converting one or more PO-files to an xls file is done with the po2xls command:

po2xls nl.po

This will create a new file messages.xlsx with the Dutch translations. Multiple PO files can be specified:

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.

po2xls will guess the locale for a PO file by looking at the Language key 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:

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 (.xlsx) to Portable Object (.po)

Translations can be converted back from a spreadsheet into a PO-file using the xls2po command:

xls2po nl texts.xlsx nl.po

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

Metadata

Release files for po-excel-translate 3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for po-excel-translate 3.3
File Size Uploaded
po-excel-translate-3.3.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for po-excel-translate 3.3
File Interpreter ABI Platform
po_excel_translate-3.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 19.1 kB

Release files / po-excel-translate-3.3.tar.gz

Download URL po-excel-translate-3.3.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
50f8e6849ff577ea42b1c31fb39e2a87440cc9abc5bfae0819b82b9fdd9d9e2b
BLAKE2b-256 checksum
How to use checksums
52cd8aa2cab2a1e69a1122dc03d92a220c7f9f962e74f1dde491657ff6fdb0de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

Release files / po_excel_translate-3.3-py2.py3-none-any.whl

Download URL po_excel_translate-3.3-py2.py3-none-any.whl
Size 10.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2d3e72596f0f9aac7f293e9246750c2684dbda8be262c0ddd9320fc806e0a6e9
BLAKE2b-256 checksum
How to use checksums
f4fdeed576f5006eae713fa25d69b2c4590dd48ee4018b23071a46c52c336e1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

Release history Release notifications | RSS feed

This release

3.3 This release

2 release files

3.0.1

1 release file

3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page