LEFT | RIGHT |
1 # This Source Code Form is subject to the terms of the Mozilla Public | 1 # This Source Code Form is subject to the terms of the Mozilla Public |
2 # License, v. 2.0. If a copy of the MPL was not distributed with this | 2 # License, v. 2.0. If a copy of the MPL was not distributed with this |
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
4 | 4 |
5 import os | 5 import os |
6 import sys | 6 import sys |
7 import re | 7 import re |
8 import subprocess | 8 import subprocess |
9 import shutil | 9 import shutil |
10 import buildtools | 10 import buildtools |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 key = args[0] | 333 key = args[0] |
334 | 334 |
335 from buildtools.packager import readMetadata | 335 from buildtools.packager import readMetadata |
336 metadata = readMetadata(baseDir, type) | 336 metadata = readMetadata(baseDir, type) |
337 | 337 |
338 basename = metadata.get('general', 'basename') | 338 basename = metadata.get('general', 'basename') |
339 localeConfig = readLocaleConfig(baseDir, type, metadata) | 339 localeConfig = readLocaleConfig(baseDir, type, metadata) |
340 | 340 |
341 import buildtools.localeTools as localeTools | 341 import buildtools.localeTools as localeTools |
342 for locale, localeDir in localeConfig['locales'].iteritems(): | 342 for locale, localeDir in localeConfig['locales'].iteritems(): |
343 if locale != localeConfig['default_locale']: | 343 if locale != localeConfig['default_locale'].replace('_', '-'): |
344 localeTools.uploadTranslations(localeConfig, metadata, localeDir, lo
cale, | 344 localeTools.uploadTranslations(localeConfig, metadata, localeDir, lo
cale, |
345 basename, key) | 345 basename, key) |
346 | 346 |
347 | 347 |
348 def getTranslations(baseDir, scriptName, opts, args, type): | 348 def getTranslations(baseDir, scriptName, opts, args, type): |
349 if len(args) < 1: | 349 if len(args) < 1: |
350 print 'Project key is required to update translation master files.' | 350 print 'Project key is required to update translation master files.' |
351 usage(scriptName, type, 'translate') | 351 usage(scriptName, type, 'translate') |
352 return | 352 return |
353 | 353 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 if option in ('-h', '--help'): | 600 if option in ('-h', '--help'): |
601 usage(scriptName, type, command) | 601 usage(scriptName, type, command) |
602 sys.exit() | 602 sys.exit() |
603 commands[command](baseDir, scriptName, opts, args, type) | 603 commands[command](baseDir, scriptName, opts, args, type) |
604 else: | 604 else: |
605 print 'Command %s is not supported for this application type' % comm
and | 605 print 'Command %s is not supported for this application type' % comm
and |
606 usage(scriptName, type) | 606 usage(scriptName, type) |
607 else: | 607 else: |
608 print 'Command %s is unrecognized' % command | 608 print 'Command %s is unrecognized' % command |
609 usage(scriptName, type) | 609 usage(scriptName, type) |
LEFT | RIGHT |