Skip to content

Commit

Permalink
fixup! feat(core/translations): add it, pt, tr
Browse files Browse the repository at this point in the history
  • Loading branch information
mmilata committed Jul 23, 2024
1 parent c2e8e61 commit 55683f1
Show file tree
Hide file tree
Showing 8 changed files with 7,146 additions and 7,124 deletions.
76 changes: 38 additions & 38 deletions core/tools/codegen/foreign_chars.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,52 +98,52 @@
)

italian_chars = (
"À"
"à"
"è"
"é"
"ì"
"ò"
"ù"
"À",
"à",
"è",
"é",
"ì",
"ò",
"ù",
)


portugese_chars = (
"º"
"Á"
"Ã"
"Ç"
"Í"
"Ó"
"Õ"
"Ú"
"à"
"á"
"ã"
"ç"
"é"
"ê"
"í"
"ó"
"ô"
"õ"
"ú"
"º",
"Á",
"Ã",
"Ç",
"Í",
"Ó",
"Õ",
"Ú",
"à",
"á",
"ã",
"ç",
"é",
"ê",
"í",
"ó",
"ô",
"õ",
"ú",
)


turkish_chars = (
"Ç"
"Ö"
"Ü"
"ç"
"ö"
"ü"
"Ğ"
"ğ"
"İ"
"ı"
"Ş"
"ş"
"Ç",
"Ö",
"Ü",
"ç",
"ö",
"ü",
"Ğ",
"ğ",
"İ",
"ı",
"Ş",
"ş",
)


Expand Down
24 changes: 23 additions & 1 deletion core/translations/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ def merge(update_json: t.Tuple[t.TextIO, ...]) -> None:
tdir.save_lang(lang, orig_data)
click.echo(f"Updated {lang}")


@cli.command()
@click.argument("lang_file", type=click.File("r"), nargs=1)
def characters(lang_file: t.TextIO) -> None:
Expand All @@ -395,9 +396,30 @@ def characters(lang_file: t.TextIO) -> None:
chars = filter(lambda c: ord(c) > 127, all_chars)
print("(")
for c in sorted(chars):
print(f" \"{c}\"")
print(f" \"{c}\",")
print(")")


@cli.command()
@click.argument("lang_file", type=click.Path(), nargs=1)
def lowercase(lang_file: Path) -> None:
"""Convert strings to lowercase."""
with open(lang_file, "r") as fh:
data = json.load(fh)
new_translations = {}

def f(s: str) -> str:
if not all(map(lambda c: c.isupper() or not c.isalpha(), s)):
return s
else:
return s[0] + s[1:].lower()

for k, v in data['translations'].items():
new_translations[k] = f(v)

data["translations"] = new_translations
with open(lang_file, "w") as fh:
json.dump(data, fh, indent=2, ensure_ascii=False)

if __name__ == "__main__":
cli()
2 changes: 1 addition & 1 deletion core/translations/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"buttons__info": "Informace",
"buttons__install": "Nainstalovat",
"buttons__more_info": "Další informace",
"buttons__ok_i_understand": "OK, ROZUMÍM",
"buttons__ok_i_understand": "OK, rozumím",
"buttons__purchase": "Koupit",
"buttons__quit": "Ukončit",
"buttons__restart": "Restartovat",
Expand Down
Loading

0 comments on commit 55683f1

Please sign in to comment.