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
1 changed files with 4 additions and 5 deletions

View File

@ -63,7 +63,7 @@ import webbrowser
from optparse import OptionParser
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_FILES = ['setup.py']
@ -193,12 +193,11 @@ def download_translations():
if not password:
password = getpass(' Transifex password: ')
# First get the list of languages
url = SERVER_URL + 'resource/ents/'
base64string = base64.encodebytes('%s:%s' % (username, password))[:-1]
auth_header = 'Basic %s' % base64string
request = urllib.request.Request(url + '?details')
request = urllib.request.Request(SERVER_URL + '?details')
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:
json_response = urllib.request.urlopen(request)
except urllib.error.HTTPError:
@ -207,7 +206,7 @@ def download_translations():
json_dict = json.loads(json_response.read())
languages = [lang['code'] for lang in json_dict['available_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.add_header('Authorization', auth_header)
filename = os.path.join(os.path.abspath('..'), 'resources', 'i18n', language + '.ts')