, ,

A Simple Solution for Non-Technical Translators

Aisha Patel Avatar

·

Translating PO Files with Spreadsheets: A Simple Solution for Non-Technical Translators

Being comfortable with PO-editors and translation tools is not a requirement for all translators. For those who prefer a more user-friendly approach, the po-xls package provides a straightforward solution – converting PO files to XLSX files and vice versa. This functionality also offers the advantage of including multiple languages in a single spreadsheet, making it easier to handle translations for similar languages simultaneously.

The Format for Spreadsheets

The format for working with spreadsheets in po-xls is simple. Each row in the spreadsheet represents a message, and the columns are organized as follows:

  1. If a message uses a message context, the first column specifies the context. If message contexts are not used, this column is skipped.
  2. The next (or first) column contains the message ID, which is usually the canonical text.
  3. Additional columns can be used for different comment types, such as message occurrences, source comments, or translator comments.
  4. Each locale has a separate column for the translated text. Fuzzy translations can be marked in italic.

The first row of the spreadsheet serves as the column headers, and it is important not to modify them as xls-to-po uses this information to identify locale information in the file.

Converting PO Files to Spreadsheets

To convert one or more PO files to an XLSX file, you can use the po-to-xls command. For example:

po-to-xls nl.po

This command will create a new file named messages.xlsx with the Dutch translations. You can specify multiple PO files as well:

po-to-xls -o texts.xlsx zh_CN.po zh_TW.po nl.po

This will generate a texts.xlsx file containing translations for Simplified Chinese, Traditional Chinese, and Dutch.

The po-to-xls command will automatically guess the locale for a PO file by looking at the Language key in the file metadata. If no language information is specified, it will fallback to using the filename. However, you can override this by explicitly specifying the locale on the command line:

po-to-xls nl:locales/nl/LC_MESSAGES/mydomain.po

In this example, po-to-xls will read the locales/nl/LC_MESSAGES/mydomain.po file and treat it as Dutch.

You can also use the -c or --comments option with choices like translator, extracted, reference, or all to add more columns in the output, depending on the type of comments you want to include.

Converting Spreadsheets to PO Files

To convert translations from a spreadsheet back into a PO file, you can use the xls-to-po command. For instance:

xls-to-po nl texts.xlsx nl.po

This command will extract the Dutch translations from the texts.xlsx file and recreate a nl.po file. If needed, you can merge these translations into an existing PO file using a tool like gettext’s msgmerge.

You can also ignore specific sheets in the spreadsheet by using the -i or --ignore option. For example:

xls-to-po -i 'Read Me First' -i Appendix nl texts.xlsx nl.po

This command will ignore the sheets named “Read Me First” and “Appendix” in the spreadsheet during the conversion.

In conclusion, the po-xls package provides a simple solution for non-technical translators who prefer working with spreadsheets for translating PO files. By converting PO files to XLSX format, multiple languages can be conveniently managed in a single spreadsheet. This approach not only simplifies the translation process but also offers flexibility and easy collaboration among translators. Whether you are a non-technical translator or someone looking for an alternative to traditional PO editors, po-xls is a valuable tool for smoother localization workflows.

Leave a Reply

Your email address will not be published. Required fields are marked *