INNER CODE UNIT · Python

fix_all

sameerasw/essentials · scripts/fix_translations.py:99

def fix_all():
    fixed_count = 0
    files = sorted(glob.glob(os.path.join(RES_DIR, "values-*", "strings.xml")))

    for file_path in files:
        dir_name = os.path.basename(os.path.dirname(file_path))
        locale = dir_name.replace("values-", "")

        # 1. Serbian Cyrillic fixes
        if locale in ("sr", "sr-rSP"):
            with open(file_path, "r", encoding="utf-8") as f:
                c = f.read()
            if "%1$.1ф" in c or "%1$.4ф" in c or "%2$.4ф" in c:
                c = c.replace("%1$.1ф", "%1$.1f")
                c = c.replace("%1$.4ф", "%1$.4f")
                c = c.replace("%2$.4ф", "%2$.4f")
                with open(file_path, "w", encoding="utf-8") as f:
                    f.write(c)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…