build_tools/i18n/crowdin.py
def command_download(branch):
    """
    Downloads and updates the local translation files from the given branch on Crowdin
    """
    logging.info("Crowdin: downloading '{}'...".format(branch))

    # delete previous files
    _wipe_translations(utils.LOCALE_PATH)
    _wipe_translations(utils.PERSEUS_LOCALE_PATH)

    for lang_object in utils.supported_languages(include_in_context=True):
        code = lang_object[utils.KEY_CROWDIN_CODE]
        url = DOWNLOAD_URL.format(language=code, branch=branch)
        r = requests.get(url)
        r.raise_for_status()
        z = zipfile.ZipFile(io.BytesIO(r.content))
        target = utils.local_locale_path(lang_object)
        logging.info("\tExtracting {} to {}".format(code, target))
        z.extractall(target)

        # hack for perseus
        perseus_target = utils.local_perseus_locale_path(lang_object)
        if not os.path.exists(perseus_target):
            os.makedirs(perseus_target)
        shutil.move(
            os.path.join(target, PERSEUS_FILE),
            os.path.join(perseus_target, PERSEUS_FILE),
        )

    _format_json_files()  # clean them up to make git diffs more meaningful
    logging.info("Crowdin: download succeeded!")

    Downloads and updates the local translation files from the given branch on Crowdin
    
Downloads and updates the local translation files from the given branch on Crowdin
Downloads and updates the local translation files from the given branch on Crowdin
def command_download(branch):
    logging.info("Crowdin: downloading '{}'...".format(branch))
    _wipe_translations(utils.LOCALE_PATH)
    _wipe_translations(utils.PERSEUS_LOCALE_PATH)
    for lang_object in utils.supported_languages(include_in_context=True):
        code = lang_object[utils.KEY_CROWDIN_CODE]
        url = DOWNLOAD_URL.format(language=code, branch=branch)
        r = requests.get(url)
        r.raise_for_status()
        z = zipfile.ZipFile(io.BytesIO(r.content))
        target = utils.local_locale_path(lang_object)
        logging.info("\tExtracting {} to {}".format(code, target))
        z.extractall(target)
        perseus_target = utils.local_perseus_locale_path(lang_object)
        if not os.path.exists(perseus_target):
            os.makedirs(perseus_target)
        shutil.move(
            os.path.join(target, PERSEUS_FILE),
            os.path.join(perseus_target, PERSEUS_FILE),
        )
    _format_json_files()  
    logging.info("Crowdin: download succeeded!")
def command_download ( branch ) : logging . info ( "Crowdin: downloading '{}'..." . format ( branch ) ) _wipe_translations ( utils . LOCALE_PATH ) _wipe_translations ( utils . PERSEUS_LOCALE_PATH ) for lang_object in utils . supported_languages ( include_in_context = True ) : code = lang_object [ utils . KEY_CROWDIN_CODE ] url = DOWNLOAD_URL . format ( language = code , branch = branch ) r = requests . get ( url ) r . raise_for_status ( ) z = zipfile . ZipFile ( io . BytesIO ( r . content ) ) target = utils . local_locale_path ( lang_object ) logging . info ( "\tExtracting {} to {}" . format ( code , target ) ) z . extractall ( target ) perseus_target = utils . local_perseus_locale_path ( lang_object ) if not os . path . exists ( perseus_target ) : os . makedirs ( perseus_target ) shutil . move ( os . path . join ( target , PERSEUS_FILE ) , os . path . join ( perseus_target , PERSEUS_FILE ) , ) _format_json_files ( ) logging . info ( "Crowdin: download succeeded!" )
Downloads and updates the local translation files from the given branch on Crowdin
Downloads and updates the local translation files from the given branch on Crowdin
"""
    Downloads and updates the local translation files from the given branch on Crowdin
    """ # delete previous files # hack for perseus # clean them up to make git diffs more meaningful
branch