INNER CODE UNIT · Python
missing
sameerasw/essentials · scripts/validate_strings.py:294
missing = set(sorted_locales) - existing
if missing:
if auto_fix:
lines = ['<?xml version="1.0" encoding="utf-8"?>\n', '<locale-config xmlns:android="http://schemas.android.com/apk/res/android">\n']
for loc in sorted_locales:
lines.append(f' <locale android:name="{loc}" />\n')
lines.append('</locale-config>\n')
with open(config_file, 'w', encoding='utf-8') as f:
f.writelines(lines)
print(f"{BOLD}{GREEN}🔧 Updated locales_config.xml with missing locales: {sorted(missing)}{RESET}\n")
else:
print(f"{BOLD}{YELLOW}⚠️ locales_config.xml is missing locales: {sorted(missing)}{RESET}\n")
except Exception as e:
pass
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 %%)")