def main_obsolete():
    (strings_dict, langs, contributors) = load_strings_file()
    strings = extract_strings_from_c_files()
    for s in strings_dict.keys():
        if s not in strings:
            del strings_dict[s]
    untranslated_dict = dump_missing_per_language(strings, strings_dict)
    write_out_strings_files(strings_dict, langs, contributors,
                            untranslated_dict)
    untranslated = get_untranslated_as_list(untranslated_dict)
    for s in untranslated:
        if s not in strings_dict:
            strings_dict[s] = []

    langs_idx = load_lang_index()
    # check that langs_def.py agrees with the language files
    #print(langs)
    #print(langs_idx)
    for lang in langs + langs_idx:
        lang1, lang2 = [l for l in langs_idx if l[0] == lang[0]
                        ], [l for l in langs if l[0] == lang[0]]
        if not (len(lang1) == 1 and len(lang2) == 1
                and lang1[0][1] == lang2[0][1]):
            print("lang1: %s" % str(lang1))
            print("lang2: %s" % str(lang2))
            assert len(lang1) == 1 and len(
                lang2) == 1 and lang1[0][1] == lang2[0][1]

    c_file_name = os.path.join(g_src_dir, "Translations_txt.cpp")
    #gen_and_upload_js(strings_dict, langs_idx, contributors)
    remove_incomplete_translations(langs_idx, strings, strings_dict)
    gen_c_code(langs_idx, strings_dict, c_file_name, encode_to_utf=True)
Ejemplo n.º 2
0
def main_obsolete():
    (strings_dict, langs, contributors) = load_strings_file()
    strings = extract_strings_from_c_files()
    for s in strings_dict.keys():
        if s not in strings:
            del strings_dict[s]
    untranslated_dict = dump_missing_per_language(strings, strings_dict)
    write_out_strings_files(strings_dict, langs, contributors, untranslated_dict)
    untranslated = get_untranslated_as_list(untranslated_dict)
    for s in untranslated:
        if s not in strings_dict:
            strings_dict[s] = []

    langs_idx = load_lang_index()
    # check that langs_def.py agrees with the language files
    #print(langs)
    #print(langs_idx)
    for lang in langs + langs_idx:
        lang1, lang2 = [l for l in langs_idx if l[0] == lang[0]], [l for l in langs if l[0] == lang[0]]
        if not (len(lang1) == 1 and len(lang2) == 1 and lang1[0][1] == lang2[0][1]):
            print("lang1: %s" % str(lang1))
            print("lang2: %s" % str(lang2))
            assert len(lang1) == 1 and len(lang2) == 1 and lang1[0][1] == lang2[0][1]

    c_file_name = os.path.join(g_src_dir, "Translations_txt.cpp")
    #gen_and_upload_js(strings_dict, langs_idx, contributors)
    remove_incomplete_translations(langs_idx, strings, strings_dict)
    gen_c_code(langs_idx, strings_dict, c_file_name, encode_to_utf=True)
Ejemplo n.º 3
0
def generateCode(s):
    strings_dict = parseTranslations(s)
    strings = extract_strings_from_c_files()
    for s in strings_dict.keys():
        if s not in strings:
            del strings_dict[s]
    untranslated_dict = dump_missing_per_language(strings, strings_dict)
    untranslated = get_untranslated_as_list(untranslated_dict)
    for s in untranslated:
        if s not in strings_dict:
            strings_dict[s] = []

    langs_idx = load_lang_index()
    c_file_name = os.path.join(g_src_dir, "Translations_txt.cpp")
    remove_incomplete_translations(langs_idx, strings, strings_dict)
    gen_c_code(langs_idx, strings_dict, c_file_name)
Ejemplo n.º 4
0
def main():
    (strings_dict, langs, contributors) = load_strings_file()
    strings = extract_strings_from_c_files()
    for s in strings_dict.keys():
        if s not in strings:
            del strings_dict[s]
    untranslated_dict = dump_missing_per_language(strings, strings_dict)
    write_out_strings_files(strings_dict, langs, contributors,
                            untranslated_dict)
    untranslated = get_untranslated_as_list(untranslated_dict)
    for s in untranslated:
        if s not in strings_dict:
            strings_dict[s] = []

    c_file_name = os.path.join(g_src_dir, "translations_txt.cpp")
    gen_c_code(langs, strings_dict, c_file_name, load_lang_index())
    gen_and_upload_js(strings_dict, langs, contributors)
def main():
    (strings_dict, langs, contributors) = load_strings_file()
    strings = extract_strings_from_c_files()
    for s in strings_dict.keys():
        if s not in strings:
            del strings_dict[s]
    untranslated_dict = dump_missing_per_language(strings, strings_dict)
    write_out_strings_files(strings_dict, langs, contributors, untranslated_dict)
    untranslated = get_untranslated_as_list(untranslated_dict)
    for s in untranslated:
        if s not in strings_dict:
            strings_dict[s] = []

    c_file_name = os.path.join(g_src_dir, "Translations_txt.cpp")
    gen_and_upload_js(strings_dict, langs, contributors)
    remove_incomplete_translations(langs, strings, strings_dict, INCOMPLETE_MISSING_THRESHOLD)
    gen_c_code(langs, strings_dict, c_file_name, load_lang_index())