mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
54 lines
1.2 KiB
Plaintext
54 lines
1.2 KiB
Plaintext
|
#!/usr/bin/env python
|
||
|
# -*- coding: utf-8 -*-
|
||
|
'''
|
||
|
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
|
||
|
|
||
|
|
||
|
download-translation-catalog
|
||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
|
||
|
Download a translation catalog from Transifex.
|
||
|
'''
|
||
|
|
||
|
# Import python libs
|
||
|
import os
|
||
|
import sys
|
||
|
|
||
|
# Import 3rd-party libs
|
||
|
try:
|
||
|
import txclib.utils
|
||
|
except ImportError:
|
||
|
print(
|
||
|
'The \'transifex-client\' library needs to be installed. '
|
||
|
'Please execute one of \'pip install transifex-client\' or '
|
||
|
'\'easy_install transifex-client\''
|
||
|
)
|
||
|
sys.exit(1)
|
||
|
|
||
|
DOC_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||
|
LOCALES_DIR = os.path.join(DOC_DIR, 'locale')
|
||
|
|
||
|
|
||
|
def main():
|
||
|
'''
|
||
|
Run the compile code
|
||
|
'''
|
||
|
|
||
|
os.chdir(DOC_DIR)
|
||
|
tx_root = txclib.utils.find_dot_tx()
|
||
|
|
||
|
if len(sys.argv) < 2:
|
||
|
print('You need to pass a locale to this script. For example: '
|
||
|
'pt_PT, zh_CN, ru, etc...')
|
||
|
sys.exit(1)
|
||
|
|
||
|
for locale in sys.argv[1:]:
|
||
|
print('Download {0!r} translations catalog...'.format(locale))
|
||
|
txclib.utils.exec_command('pull', ['-l', locale], tx_root)
|
||
|
|
||
|
print('Done')
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|