Skip to content

Instantly share code, notes, and snippets.

@Adair-GA
Created January 10, 2024 21:02
Show Gist options
  • Save Adair-GA/32ccc61546da676677ea7e9a61c61610 to your computer and use it in GitHub Desktop.
Save Adair-GA/32ccc61546da676677ea7e9a61c61610 to your computer and use it in GitHub Desktop.
Fix for FastForward locales
import pathlib
import json
path = pathlib.Path("src/_locales")
c = 0
for locale_dir in path.iterdir():
localc = 0
with open(locale_dir / "messages.json", "r", encoding="utf-8") as f:
data = json.load(f)
for key, value in data.items():
if "option" not in key.lower() and "%" in value["message"]:
value["message"] = value["message"].replace("%", "$1")
c += 1
localc += 1
if localc > 0:
with open(locale_dir / "messages.json", "w", encoding="utf-8") as f:
json.dump(data, f, indent=4, ensure_ascii=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment