Given the following directory structure:
└── locale
├── es
│ └── intro
│ ├── get-started.html
│ └── index.html
└── intro
├── get-started.html
└── index.html
The command below will show the tx
commands needed to setup multiple resource (source) entries with a single command ignoring the es
directory:
$ python txsetup.py -p my_project -e .html -t HTML -s locale -i es -x 'locale/<lang>/{filepath}/{filename}{extension}'
Output of above command:
tx set --auto-local --resource my_project.locale_intro_get-started --source-lang en --type HTML --source-file locale/intro/get-started.html 'locale/<lang>/intro/get-started.html' --execute
tx set --auto-local --resource my_project.locale_intro_index --source-lang en --type HTML --source-file locale/intro/index.html 'locale/<lang>/intro/index.html' --execute
IMPORTANT: To actually execute the tx
commands and generate the .tx/config
file the option --execute
needs to be present in the command.
$ python txsetup.py --help
usage: txsetup.py [-h] -p PROJECT -e FILE_EXTENSION -t I18N_TYPE -s
SOURCE_FILE_DIR [-l SOURCE_LANGUAGE] [-x EXPRESSION]
[-i IGNORE_DIRS] [--execute]
Setup transifex-client config file (.tx/config) to have a configuration entry
for every source file found under a given directory. This script should be
executed in the root directory of a repo.
optional arguments:
-h, --help show this help message and exit
-p PROJECT, --project PROJECT
Project slug where files will live in Transifex.
-e FILE_EXTENSION, --file-extension FILE_EXTENSION
File extension of files to be mapped.
-t I18N_TYPE, --i18n-type I18N_TYPE
File format type in Transifex. More info
http://docs.transifex.com/formats/.
-s SOURCE_FILE_DIR, --source-file-dir SOURCE_FILE_DIR
Directory where to find source files to be mapped.
Example: locale/en/
-l SOURCE_LANGUAGE, --source-language SOURCE_LANGUAGE
Source language in Transifex for the source files.
Default: en
-x EXPRESSION, --expression EXPRESSION
Expression defining where translation files should be
save. Default value is:
'locale/<lang>/{filepath}/{filename}{extension}'
-i IGNORE_DIRS, --ignore-dir IGNORE_DIRS
Directory to ignore while looking for source files.
Can be called multiple times. Example: `-i es -i fr`.
--execute Call `tx` command to actually write the configuration
file