diff options
author | Jesusaves <cpntb1@ymail.com> | 2018-05-01 09:19:43 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2018-05-01 09:19:43 -0300 |
commit | 004d0f5a369d6e374dfae6416fda439ff0d7c0f4 (patch) | |
tree | bd6c49663f6fe3d039d06ee2f7274036a06614eb /lang_client/fetch.py | |
parent | 1878e1370944ee1d12f5d6983a34197bcfb74627 (diff) | |
download | tools-004d0f5a369d6e374dfae6416fda439ff0d7c0f4.tar.gz tools-004d0f5a369d6e374dfae6416fda439ff0d7c0f4.tar.bz2 tools-004d0f5a369d6e374dfae6416fda439ff0d7c0f4.tar.xz tools-004d0f5a369d6e374dfae6416fda439ff0d7c0f4.zip |
Client Data translation
Diffstat (limited to 'lang_client/fetch.py')
-rwxr-xr-x | lang_client/fetch.py | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/lang_client/fetch.py b/lang_client/fetch.py new file mode 100755 index 0000000..01550c9 --- /dev/null +++ b/lang_client/fetch.py @@ -0,0 +1,58 @@ +#! /usr/bin/env python2.7 +# -*- coding: utf8 -*- +# +# Copyright (C) 2018 TMW-2 +# Author: Jesusalva + +from transifex.api import TransifexAPI + +project='saulc-tmw-fork' + +# Load credentials from login.txt and password.txt +login=open('../lang/login.txt', 'r') +for i in login: + username=i.replace('\n', '').replace('\r', '') + +login.close() + +passw=open('../lang/password.txt', 'r') +for i in passw: + password=i.replace('\n', '').replace('\r', '') + +passw.close() + +t=TransifexAPI(username, password, 'https://www.transifex.com') + +if (not t.ping): + print("ERROR: Ping failed, this may be due incorrect username/password in login.txt and password.txt. Ensure there is NO newline at the end of file. At lang/ folder.") + exit(1) + +if (not t.project_exists(project)): + print("ERROR: Invalid project name") + exit(1) + +# Load languages +langs=[] +vcx=open("../../server-data/langs/langs.txt", "r") +for i in vcx: + if i != "en": + langs.append(i.replace('\n', '')) +vcx.close() + +# Fetch all translations and record them at in/ +for i in langs: + # Disregarded languages + if i in ['en', 'vls']: + continue + + # People translated so we cannot override stuff + #if i in ['pt_BR', 'vls']: + # print("Overriding %s..." %(i)) + # t.new_translation(project, 'clientdata', i,'../../client-data/translations/'+str(i)+'.po') + + print("Fetching %s..." %(i)) + t.get_translation(project, 'clientdata', i, '../../client-data/translations/'+str(i)+'.po') + + print("Fetching %s dict..." %(i)) + t.get_translation(project, 'clientdata-dict', i, '../../client-data/translations/dict/'+str(i)+'.po') + |