Skip to content

Po Excel Tool (PET) - add or extract PO file from XLSX table, merging POT file available too

License

Notifications You must be signed in to change notification settings

zbyna/po-excel-tool

Repository files navigation

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 🙂 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!

About

Po Excel Tool (PET) - add or extract PO file from XLSX table, merging POT file available too

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages