fixed translation_util script for 2.2

This commit is contained in:
Andreas Preikschat 2014-06-10 10:33:02 +02:00
parent d832933110
commit 8982839794

View File

@ -63,7 +63,7 @@ import webbrowser
from optparse import OptionParser from optparse import OptionParser
from PyQt4 import QtCore from PyQt4 import QtCore
SERVER_URL = 'http://www.transifex.net/api/2/project/openlp/' SERVER_URL = 'http://www.transifex.net/api/2/project/openlp/resource/openlp-22x/'
IGNORED_PATHS = ['scripts'] IGNORED_PATHS = ['scripts']
IGNORED_FILES = ['setup.py'] IGNORED_FILES = ['setup.py']
@ -193,12 +193,11 @@ def download_translations():
if not password: if not password:
password = getpass(' Transifex password: ') password = getpass(' Transifex password: ')
# First get the list of languages # First get the list of languages
url = SERVER_URL + 'resource/ents/'
base64string = base64.encodebytes('%s:%s' % (username, password))[:-1] base64string = base64.encodebytes('%s:%s' % (username, password))[:-1]
auth_header = 'Basic %s' % base64string auth_header = 'Basic %s' % base64string
request = urllib.request.Request(url + '?details') request = urllib.request.Request(SERVER_URL + '?details')
request.add_header('Authorization', auth_header) request.add_header('Authorization', auth_header)
print_verbose('Downloading list of languages from: %s' % url) print_verbose('Downloading list of languages from: %s' % SERVER_URL)
try: try:
json_response = urllib.request.urlopen(request) json_response = urllib.request.urlopen(request)
except urllib.error.HTTPError: except urllib.error.HTTPError:
@ -207,7 +206,7 @@ def download_translations():
json_dict = json.loads(json_response.read()) json_dict = json.loads(json_response.read())
languages = [lang['code'] for lang in json_dict['available_languages']] languages = [lang['code'] for lang in json_dict['available_languages']]
for language in languages: for language in languages:
lang_url = url + 'translation/%s/?file' % language lang_url = SERVER_URL + 'translation/%s/?file' % language
request = urllib.request.Request(lang_url) request = urllib.request.Request(lang_url)
request.add_header('Authorization', auth_header) request.add_header('Authorization', auth_header)
filename = os.path.join(os.path.abspath('..'), 'resources', 'i18n', language + '.ts') filename = os.path.join(os.path.abspath('..'), 'resources', 'i18n', language + '.ts')