INNER CODE UNIT · Python

lang

Julow/Unexpected-Keyboard · gen_method_xml.py:129

    def lang(loc):
        return loc["name"].split("_")[0]
    def find_locale(locs, name):
        for loc in locs:
            if loc["name"] == name: return loc
        return None
    def find_default_locale_in_group(l, locs):
        for loc in locs:
            if "default_for_lang" in loc and loc["default_for_lang"]:
                return loc
        # Set the language with a country code equal to the lang as the first
        # in order (eg. "de_DE" comes before "de_BE")
        def_loc = find_locale(locs, f"{l}_{l.upper()}")
        if def_loc is not None:
            def_loc["default_for_lang"] = True
        else:
            def_loc = find_locale(locs, l)
            if def_loc is None and len(locs) == 1:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…