Created
January 10, 2024 21:02
-
-
Save Adair-GA/32ccc61546da676677ea7e9a61c61610 to your computer and use it in GitHub Desktop.
Fix for FastForward locales
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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