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]

  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)
예제 #2
0
def uploadtrans(base_dir, project_key, platform, **kwargs):
    """
    Upload existing translations.

    Upload already existing translations to the project on crowdin.com.
    """
    from buildtools.packager import readMetadata
    metadata = readMetadata(base_dir, platform)

    basename = metadata.get('general', 'basename')
    locale_config = read_locale_config(base_dir, platform, metadata)

    import buildtools.localeTools as localeTools
    for locale, locale_dir in locale_config['locales'].iteritems():
        if locale != locale_config['default_locale'].replace('_', '-'):
            localeTools.uploadTranslations(locale_config, metadata, locale_dir,
                                           locale, basename, project_key)
예제 #3
0
def uploadtrans(base_dir, project_key, platform, **kwargs):
    """
    Upload existing translations.

    Upload already existing translations to the project on crowdin.com.
    """
    from buildtools.packager import readMetadata
    metadata = readMetadata(base_dir, platform)

    basename = metadata.get('general', 'basename')
    locale_config = read_locale_config(base_dir, platform, metadata)

    import buildtools.localeTools as localeTools
    for locale, locale_dir in locale_config['locales'].iteritems():
        if locale != locale_config['default_locale'].replace('_', '-'):
            localeTools.uploadTranslations(locale_config, metadata, locale_dir,
                                           locale, basename, project_key)
예제 #4
0
파일: build.py 프로젝트: kzar/buildtools
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')
    localeConfig = readLocaleConfig(baseDir, type, metadata)

    import buildtools.localeTools as localeTools
    for locale, localeDir in localeConfig['locales'].iteritems():
        if locale != localeConfig['default_locale']:
            localeTools.uploadTranslations(localeConfig, metadata, localeDir, locale,
                                           basename, key)
예제 #5
0
파일: build.py 프로젝트: hola/buildtools
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')
    localeConfig = readLocaleConfig(baseDir, type, metadata)

    import buildtools.localeTools as localeTools
    for locale, localeDir in localeConfig['locales'].iteritems():
        if locale != localeConfig['default_locale']:
            localeTools.uploadTranslations(localeConfig, metadata, localeDir,
                                           locale, basename, key)