(app, lang=None, eligible_for_transifex_only=False)
return rows
Data rows for bulk app translation download

    If `eligible_for_transifex_only` is True, sheets will omit
    translations that would not be sent to Transifex.
Data rows for bulk app translation download
Data rows for bulk app translation download
def get_bulk_app_sheets_by_name(app, lang=None, eligible_for_transifex_only=False):
    """
    Data rows for bulk app translation download

    If `eligible_for_transifex_only` is True, sheets will omit
    translations that would not be sent to Transifex.
    """
    checker = EligibleForTransifexChecker(app)

    # keys are the names of sheets, values are lists of tuples representing rows
    rows = OrderedDict({MODULES_AND_FORMS_SHEET_NAME: []})

    for module in app.get_modules():
        if eligible_for_transifex_only and checker.exclude_module(module):
            continue

        langs = [lang] if lang else app.langs

        module_sheet_name = get_module_sheet_name(module)
        rows[MODULES_AND_FORMS_SHEET_NAME].append(get_modules_and_forms_row(
            row_type="Menu",
            sheet_name=module_sheet_name,
            languages=[module.name.get(lang) for lang in langs],
            media_image=[module.icon_by_language(lang) for lang in langs],
            media_audio=[module.audio_by_language(lang) for lang in langs],
            unique_id=module.unique_id,
        ))

        rows[module_sheet_name] = []
        for module_row in get_module_rows(langs, module, app.domain):
            if eligible_for_transifex_only:
                field_name, field_type, *translations = module_row
                if checker.is_blacklisted(module.unique_id, field_type, field_name, translations):
                    continue
            rows[module_sheet_name].append(module_row)

        for form in module.get_forms():
            if eligible_for_transifex_only and checker.exclude_form(form):
                continue

            form_sheet_name = get_form_sheet_name(form)
            rows[MODULES_AND_FORMS_SHEET_NAME].append(get_modules_and_forms_row(
                row_type="Form",
                sheet_name=form_sheet_name,
                languages=[form.name.get(lang) for lang in langs],
                media_image=[form.icon_by_language(lang) for lang in langs],
                media_audio=[form.audio_by_language(lang) for lang in langs],
                unique_id=form.unique_id
            ))

            rows[form_sheet_name] = []
            for label_name_media in get_form_question_label_name_media(langs, form):
                if (
                    eligible_for_transifex_only and
                    checker.is_label_to_skip(form.unique_id, label_name_media[0])
                ):
                    continue
                rows[form_sheet_name].append(label_name_media)

    return rows
def get_bulk_app_sheets_by_name ( app , lang = None , eligible_for_transifex_only = False ) : checker = EligibleForTransifexChecker ( app ) # keys are the names of sheets, values are lists of tuples representing rows rows = OrderedDict ( { MODULES_AND_FORMS_SHEET_NAME : [ ] } ) for module in app . get_modules ( ) : if eligible_for_transifex_only and checker . exclude_module ( module ) : continue langs = [ lang ] if lang else app . langs module_sheet_name = get_module_sheet_name ( module ) rows [ MODULES_AND_FORMS_SHEET_NAME ] . append ( get_modules_and_forms_row ( row_type = "Menu" , sheet_name = module_sheet_name , languages = [ module . name . get ( lang ) for lang in langs ] , media_image = [ module . icon_by_language ( lang ) for lang in langs ] , media_audio = [ module . audio_by_language ( lang ) for lang in langs ] , unique_id = module . unique_id , ) ) rows [ module_sheet_name ] = [ ] for module_row in get_module_rows ( langs , module , app . domain ) : if eligible_for_transifex_only : field_name , field_type , * translations = module_row if checker . is_blacklisted ( module . unique_id , field_type , field_name , translations ) : continue rows [ module_sheet_name ] . append ( module_row ) for form in module . get_forms ( ) : if eligible_for_transifex_only and checker . exclude_form ( form ) : continue form_sheet_name = get_form_sheet_name ( form ) rows [ MODULES_AND_FORMS_SHEET_NAME ] . append ( get_modules_and_forms_row ( row_type = "Form" , sheet_name = form_sheet_name , languages = [ form . name . get ( lang ) for lang in langs ] , media_image = [ form . icon_by_language ( lang ) for lang in langs ] , media_audio = [ form . audio_by_language ( lang ) for lang in langs ] , unique_id = form . unique_id ) ) rows [ form_sheet_name ] = [ ] for label_name_media in get_form_question_label_name_media ( langs , form ) : if ( eligible_for_transifex_only and checker . is_label_to_skip ( form . unique_id , label_name_media [ 0 ] ) ) : continue rows [ form_sheet_name ] . append ( label_name_media ) return rows