INNER CODE UNIT · Python

main

sameerasw/essentials · scripts/validate_strings.py:309

def main():
    parser = argparse.ArgumentParser(description="Validate Android translation strings.xml files.")
    parser.add_argument('--fix', action='store_true', help="Auto-fix simple escaping issues (unescaped ' and %%)")
    parser.add_argument('--strict', action='store_true', help="Treat placeholder warnings as errors")
    parser.add_argument('--path', type=str, default='app/src/main/res', help="Path to res directory")
    args = parser.parse_args()

    res_dir = os.path.abspath(args.path)
    if not os.path.exists(res_dir):
        print(f"{RED}Error: Directory {res_dir} does not exist.{RESET}")
        sys.exit(1)

    check_or_update_locales_config(res_dir, auto_fix=args.fix)

    base_strings_file = os.path.join(res_dir, "values", "strings.xml")
    base_strings = get_base_strings(base_strings_file)

    files_to_check = sorted(glob.glob(os.path.join(res_dir, "values*", "strings.xml")))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…