1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-20 14:54:31 +01:00

Translations: fixed a nasty bug that prevented new translations to be included

This commit is contained in:
Federico Fissore 2015-08-06 13:16:37 +02:00
parent 119cda6dda
commit 64bf90fec4
2 changed files with 5 additions and 12 deletions

View File

@ -37,8 +37,7 @@ class Transifex(object):
def translation(self, lang):
r = requests.get(
'http://www.transifex.com/api/2/project/'
'arduino-ide-15/resource/ide-15/translation/%s/?file' % lang,
'https://www.transifex.com/api/2/project/arduino-ide-15/resource/ide-15/translation/%s/?file' % lang,
auth=self.auth_
)
r.raise_for_status()
@ -50,13 +49,8 @@ class Transifex(object):
new = map(lambda a: a + '\n', new.split('\n'))
new = update.read_po(new)
# remove the key '' to preserve the first comment block.
first = new.pop('', ('', '', ''))
catalog = update.read_po(fname)
update.merge(catalog, new)
(comment, rkey, rvalue) = catalog.get('', ('', 'msgid ""\n', ''))
catalog[''] = (comment, rkey, first[2])
update.dump(catalog, fname)

View File

@ -54,11 +54,10 @@ def dump(d, dstFile):
out.close()
def merge(d, dd):
for key in dd.keys():
if d.has_key(key):
d[key] = dd[key]
return d
def merge(old, new):
for key in new.keys():
old[key] = new[key]
return old
# Remove currently unused catalog text lines from ".po" file.
def main():