Skip to main content

Convert between Excel and PO files

Project description

Po Excel Tool (PET)

I created this command line utility to speed up my own translating process using Excel xlsx file.

It can be basically used for:

  • adding multiple PO files to one sheet in Excel file
  • extract required locale(s) from xlsx sheet to PO file(s)

As I often use Babel for extracting traslated strings which generates POT file it is possible:

  • to merge POT file with older PO files before creating spreadsheet table

Workflow is as minimal as possible, you need only two commands:

  • pet toxls and pet fromxls
  • it uses all po files in actual directory and default name for Excel table is messages.xlsx

Ouput table is hopefully :slightly_smiling_face: beautifully formatted and columns´ length is adjusted:

image

Using

pet toxls -h
Usage: pet toxls [OPTIONS] CATALOG

  Convert .PO files to an XLSX file.

  guessing locale for PO files:
      1. "Language" key in the PO metadata,
      2. filename.
  manual locale specification:
      pet toxls cs=basedir/czech/mydomain.po

  pet toxls en.po Bulgarian.po
  - add files en.po and bg.po as en and bg locale to messages.xlsx

  pet toxls en=British.po cs=Czech.po
  - add files British.po and Czech.po as en and cs locale to messages.xlsx

  pet toxls
  - add all po files from current dir to messages.xlsx

Options:
  -c, --comments [translator|extracted|reference|all]
                                  Comments to include in the spreadsheet
  -o, --output FILENAME           Output file  [default: messages.xlsx]
  -m, --msgmerge                  flag for update(merge) from pot file
  -h, --help                      Show this message and exit.
pet fromxls -h
Usage: pet fromxls [OPTIONS] [LOCALE]...

   Convert a XLS(X) file to a .PO file

    pet fromxls en cs
    - create en.po and cs.po files from messages.xlsx

    pet fromxls en=British.po cs=Czech.po
    - create British.po and Czech.po from message.xlsx

   pet fromxls
   - extract all locales from messages.xlsx to appropriate po files
     in current directory


Options:
  -is, --ignoresheet TEXT  Ignore sheets with specific names.
  -od, --outdir DIRECTORY  output directory for po file  [default: .]
  -if, --inputfile PATH    input xlsx file  [default: messages.xlsx]
  -h, --help               Show this message and exit.

Instalation

pip install git+https://github.com/zbyna/po-excel-tool.git#egg=poexceltool

or

pip install poexceltool

As a base for this project was https://github.com/wichert/po-xls used. Thank you!

Project details


Download files

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

Source Distribution

poexceltool-0.1.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poexceltool-0.1.0-py2.py3-none-any.whl (9.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file poexceltool-0.1.0.tar.gz.

File metadata

  • Download URL: poexceltool-0.1.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for poexceltool-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cab0141adbe1b1611a8dfbc744a298aef24c3e73210855f9207a310859475c50
MD5 c851a28d33d3d768aedb4d6251c61ee1
BLAKE2b-256 2006be6785833613fed11754b220fc3ac680a0ed5d6f77f20341a1ac104fe054

See more details on using hashes here.

File details

Details for the file poexceltool-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: poexceltool-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for poexceltool-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8230223b45a3536f012f64e8fa5aa1bd73474b74656232022925d7d38a13e1a0
MD5 4a65ffe9e10c5d7b6c26f5e8d83524c3
BLAKE2b-256 de7c3a5a604ef9883609134b0869f7b2b60ee509488fece31a383c36c4990e75

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page