Index: build.py |
=================================================================== |
--- a/build.py |
+++ b/build.py |
@@ -237,98 +237,103 @@ def createDevEnv(baseDir, scriptName, op |
def setupTranslations(baseDir, scriptName, opts, args, type): |
if len(args) < 1: |
print 'Project key is required to update translation master files.' |
usage(scriptName, type, 'setuptrans') |
return |
key = args[0] |
+ from buildtools.packager import readMetadata |
+ metadata = readMetadata(baseDir, type) |
+ basename = metadata.get('general', 'basename') |
+ |
if type == 'chrome' or type == 'opera': |
import buildtools.packagerChrome as packager |
locales = os.listdir(os.path.join(baseDir, '_locales')) |
locales = map(lambda locale: locale.replace('_', '-'), locales) |
- basename = packager.readMetadata(baseDir, type).get('general', 'basename') |
else: |
import buildtools.packagerGecko as packager |
locales = packager.getLocales(baseDir, True) |
- basename = packager.readMetadata(baseDir, type).get('general', 'basename') |
import buildtools.localeTools as localeTools |
localeTools.setupTranslations(type, locales, basename, key) |
def updateTranslationMaster(baseDir, scriptName, opts, args, type): |
if len(args) < 1: |
print 'Project key is required to update translation master files.' |
usage(scriptName, type, 'translate') |
return |
key = args[0] |
+ from buildtools.packager import readMetadata |
+ metadata = readMetadata(baseDir, type) |
+ basename = metadata.get('general', 'basename') |
+ |
if type == 'chrome' or type == 'opera': |
import buildtools.packagerChrome as packager |
defaultLocaleDir = os.path.join(baseDir, '_locales', packager.defaultLocale) |
- metadata = packager.readMetadata(baseDir, type) |
- basename = metadata.get('general', 'basename') |
else: |
import buildtools.packagerGecko as packager |
defaultLocaleDir = os.path.join(packager.getLocalesDir(baseDir), packager.defaultLocale) |
- metadata = packager.readMetadata(baseDir, type) |
- basename = metadata.get('general', 'basename') |
import buildtools.localeTools as localeTools |
localeTools.updateTranslationMaster(type, metadata, defaultLocaleDir, basename, key) |
def uploadTranslations(baseDir, scriptName, opts, args, type): |
if len(args) < 1: |
print 'Project key is required to upload existing translations.' |
usage(scriptName, type, 'uploadtrans') |
return |
key = args[0] |
+ from buildtools.packager import readMetadata |
+ metadata = readMetadata(baseDir, type) |
+ basename = metadata.get('general', 'basename') |
+ |
if type == 'chrome' or type == 'opera': |
import buildtools.packagerChrome as packager |
localesDir = os.path.join(baseDir, '_locales') |
locales = os.listdir(localesDir) |
locales = map(lambda locale: (locale.replace('_', '-'), os.path.join(localesDir, locale)), locales) |
- metadata = packager.readMetadata(baseDir, type) |
- basename = metadata.get('general', 'basename') |
else: |
import buildtools.packagerGecko as packager |
localesDir = packager.getLocalesDir(baseDir) |
locales = packager.getLocales(baseDir, True) |
locales = map(lambda locale: (locale, os.path.join(localesDir, locale)), locales) |
- metadata = packager.readMetadata(baseDir, type) |
- basename = metadata.get('general', 'basename') |
import buildtools.localeTools as localeTools |
for locale, localeDir in locales: |
if locale != packager.defaultLocale: |
localeTools.uploadTranslations(type, metadata, localeDir, locale, basename, key) |
def getTranslations(baseDir, scriptName, opts, args, type): |
if len(args) < 1: |
print 'Project key is required to update translation master files.' |
usage(scriptName, type, 'translate') |
return |
+ from buildtools.packager import readMetadata |
+ metadata = readMetadata(baseDir, type) |
+ basename = metadata.get('general', 'basename') |
+ |
key = args[0] |
if type == 'chrome' or type == 'opera': |
import buildtools.packagerChrome as packager |
localesDir = os.path.join(baseDir, '_locales') |
else: |
import buildtools.packagerGecko as packager |
localesDir = packager.getLocalesDir(baseDir) |
import buildtools.localeTools as localeTools |
- basename = packager.readMetadata(baseDir, type).get('general', 'basename') |
localeTools.getTranslations(type, localesDir, packager.defaultLocale.replace('_', '-'), basename, key) |
def showDescriptions(baseDir, scriptName, opts, args, type): |
locales = None |
for option, value in opts: |
if option in ('-l', '--locales'): |
locales = value.split(',') |