Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/translations: add 🇮🇹 🇵🇹 #4047

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- id: set_vars
name: Set variables
run: |
echo test_lang=${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'translations') && '[\"en\", \"cs\", \"fr\", \"de\", \"es\"]' || '[\"en\"]' }} >> $GITHUB_OUTPUT
echo test_lang=${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'translations') && '[\"en\", \"cs\", \"fr\", \"de\", \"es\", \"it\", \"pt\"]' || '[\"en\"]' }} >> $GITHUB_OUTPUT
echo asan=${{ github.event_name == 'schedule' && '[\"noasan\", \"asan\"]' || '[\"noasan\"]' }} >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT

Expand Down
1 change: 1 addition & 0 deletions core/.changelog.d/4047.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Initial support for Italian and Portugese translations.
2 changes: 2 additions & 0 deletions core/embed/lib/fonts/font_pixeloperatormono_regular_8.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file is generated by core/tools/codegen/gen_font.py

#include <stdint.h>

// clang-format off
Expand Down
2 changes: 2 additions & 0 deletions core/embed/lib/fonts/font_robotomono_medium_21.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file is generated by core/tools/codegen/gen_font.py

#include <stdint.h>

// clang-format off
Expand Down
2 changes: 2 additions & 0 deletions core/embed/lib/fonts/font_robotomono_medium_21.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file is generated by core/tools/codegen/gen_font.py

#include <stdint.h>

#if TREZOR_FONT_BPP != 4
Expand Down
2 changes: 2 additions & 0 deletions core/embed/lib/fonts/font_ttsatoshi_demibold_42.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file is generated by core/tools/codegen/gen_font.py

#include <stdint.h>

// clang-format off
Expand Down
2 changes: 2 additions & 0 deletions core/embed/lib/fonts/font_ttsatoshi_demibold_42.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file is generated by core/tools/codegen/gen_font.py

#include <stdint.h>

#if TREZOR_FONT_BPP != 4
Expand Down
2 changes: 2 additions & 0 deletions core/embed/lib/fonts/font_unifont_bold_16.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file is generated by core/tools/codegen/gen_font.py

#include <stdint.h>

#if TREZOR_FONT_BPP != 1
Expand Down
2 changes: 2 additions & 0 deletions core/embed/lib/fonts/font_unifont_regular_16.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file is generated by core/tools/codegen/gen_font.py

#include <stdint.h>

// clang-format off
Expand Down
2 changes: 2 additions & 0 deletions core/embed/lib/fonts/font_unifont_regular_16.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file is generated by core/tools/codegen/gen_font.py

#include <stdint.h>

#if TREZOR_FONT_BPP != 1
Expand Down
53 changes: 53 additions & 0 deletions core/tools/codegen/foreign_chars.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,62 @@
"ü",
)

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


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


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


all_languages = {
"cs": czech_chars,
"fr": french_chars,
"es": spanish_chars,
"de": german_chars,
"it": italian_chars,
"pt": portugese_chars,
"tr": turkish_chars,
}
3 changes: 3 additions & 0 deletions core/tools/codegen/gen_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ def _normalize(s: str) -> str:
"Ä",
"À",
"Â",
"Ã",
"Æ",
"Î",
"Ï",
"Ì",
"î",
"ï",
"ì",
"ÿ",
"Ý",
"Ÿ",
Expand Down
2 changes: 1 addition & 1 deletion core/tools/translations/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
TRANSLATIONS_DIR = CORE / "translations"

ENGLISH_LANG = "en"
FOREIGN_LANGUAGES = ["cs", "de", "es", "fr"]
FOREIGN_LANGUAGES = ["cs", "de", "es", "fr", "it", "pt", "tr"]
ALL_LANGUAGES = [ENGLISH_LANG] + FOREIGN_LANGUAGES
33 changes: 33 additions & 0 deletions core/translations/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,5 +394,38 @@ def merge(update_json: t.Tuple[t.TextIO, ...]) -> None:
click.echo(f"Updated {lang}")


@cli.command()
@click.argument("lang_file", type=click.File("r"), nargs=1)
def characters(lang_file: t.TextIO) -> None:
"""Extract all non-ASCII characters."""
all_chars = set(lang_file.read())
chars = filter(lambda c: ord(c) > 127, all_chars)
print("(")
for c in sorted(chars):
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
9 changes: 9 additions & 0 deletions core/translations/fonts/font_pixeloperator_bold_8_it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"À": "060707000760c7b3cffcc0",
"à": "060707000760c7837f37c0",
"è": "060707000760c7b3ff0780",
"é": "060707000718c7b3ff0780",
"ì": "0307050007cc36d8",
"ò": "060707000760c7b3cf3780",
"ù": "060707000760ccf3cf3780"
}
21 changes: 21 additions & 0 deletions core/translations/fonts/font_pixeloperator_bold_8_pt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"o": "06050700057b3cf378",
"Á": "060707000718c7b3cffcc0",
"Ã": "070707000777b9e66cdfb300",
"Ç": "06080700077b3c30cde19c00",
"Í": "0307050107786db0",
"Ó": "060707000718c7b3cf3780",
"Õ": "070707000777b9e66cd99e00",
"Ú": "060707000718ccf3cf3780",
"à": "060707000760c7837f37c0",
"á": "060707000718c7837f37c0",
"ã": "070707000777b9e067d99f00",
"ç": "06080700077b3c3378c19c00",
"é": "060707000718c7b3ff0780",
"ê": "0707070007fd0de66fd81e00",
"í": "0307050107786db0",
"ó": "060707000718c7b3cf3780",
"ô": "0707070007fd0de66cd99e00",
"õ": "070707000777b9e66cd99e00",
"ú": "060707000718ccf3cf3780"
}
14 changes: 14 additions & 0 deletions core/translations/fonts/font_pixeloperator_bold_8_tr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Ç": "06080700077b3c30cde19c00",
"Ö": "0607070007cc07b3cf3780",
"Ü": "0607070007cc0cf3cf3780",
"ç": "06080700077b3c3378c19c00",
"ö": "0607070007cc07b3cf3780",
"ü": "0607070007cc0cf3cf3780",
"Ğ": "0507080107fc6318c7e0",
"ğ": "0507080107fc6318c7e0",
"İ": "0507080107fc6318c7e0",
"ı": "0205050105ffc0",
"Ş": "0507080107fc6318c7e0",
"ş": "0507080107fc6318c7e0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"À": "060707000760c7b3cffcc0",
"à": "060707000760c7b3cffcc0",
"è": "060707000760cff0f30fc0",
"é": "060707000718cff0f30fc0",
"ì": "0307050007cc36d8",
"ò": "060707000760c7b3cf3780",
"ù": "060707000760ccf3cf3780"
}
21 changes: 21 additions & 0 deletions core/translations/fonts/font_pixeloperator_bold_8_upper_pt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"o": "06070700077b3cf3cf3780",
"Á": "060707000718c7b3cffcc0",
"Ã": "070707000777b9e66cdfb300",
"Ç": "06080700077b3c30cde19c00",
"Í": "0307050107786db0",
"Ó": "060707000718c7b3cf3780",
"Õ": "070707000777b9e66cd99e00",
"Ú": "060707000718ccf3cf3780",
"à": "060707000760c7b3cffcc0",
"á": "060707000718c7b3cffcc0",
"ã": "070707000777b9e66cdfb300",
"ç": "06080700077b3c30cde19c00",
"é": "060707000718cff0f30fc0",
"ê": "06070700077b3ff0f30fc0",
"í": "0307050107786db0",
"ó": "060707000718c7b3cf3780",
"ô": "0707070007fd0de66cd99e00",
"õ": "070707000777b9e66cd99e00",
"ú": "060707000718ccf3cf3780"
}
14 changes: 14 additions & 0 deletions core/translations/fonts/font_pixeloperator_bold_8_upper_tr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Ç": "06080700077b3c30cde19c00",
"Ö": "0607070007cc07b3cf3780",
"Ü": "0607070007cc0cf3cf3780",
"ç": "06080700077b3c30cde19c00",
"ö": "0607070007cc07b3cf3780",
"ü": "0607070007cc0cf3cf3780",
"Ğ": "0507080107fc6318c7e0",
"ğ": "0507080107fc6318c7e0",
"İ": "0507080107fc6318c7e0",
"ı": "0207050107fffc",
"Ş": "0507080107fc6318c7e0",
"ş": "0507080107fc6318c7e0"
}
9 changes: 9 additions & 0 deletions core/translations/fonts/font_pixeloperator_regular_8_it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"À": "0507060007411d18fe20",
"à": "0507060007411c17c5e0",
"è": "0507060007411d1fc1c0",
"é": "0507060007111d1fc1c0",
"ì": "02070400079154",
"ò": "0507060007411d18c5c0",
"ù": "0507060007412318c5c0"
}
21 changes: 21 additions & 0 deletions core/translations/fonts/font_pixeloperator_regular_8_pt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"o": "050506000574631700",
"Á": "0507060007111d18fe20",
"Ã": "06070600076667228be880",
"Ç": "0508060007746108b84c00",
"Í": "020704010762a8",
"Ó": "0507060007111d18c5c0",
"Õ": "06070600076667228a2700",
"Ú": "0507060007112318c5c0",
"à": "0507060007411c17c5e0",
"á": "0507060007111c17c5e0",
"ã": "06070600076667027a2780",
"ç": "0508060007746117104c00",
"é": "0507060007111d1fc1c0",
"ê": "0507060007229d1fc1c0",
"í": "020704010762a8",
"ó": "0507060007111d18c5c0",
"ô": "0507060007229d18c5c0",
"õ": "06070600076667228a2700",
"ú": "0507060007112318c5c0"
}
14 changes: 14 additions & 0 deletions core/translations/fonts/font_pixeloperator_regular_8_tr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Ç": "0508060007746108b84c00",
"Ö": "0507060007501d18c5c0",
"Ü": "0507060007502318c5c0",
"ç": "0508060007746117104c00",
"ö": "0507060007501d18c5c0",
"ü": "0507060007502318c5c0",
"Ğ": "0507080107fc6318c7e0",
"ğ": "0507080107fc6318c7e0",
"İ": "0507080107fc6318c7e0",
"ı": "0105040105f8",
"Ş": "0507080107fc6318c7e0",
"ş": "0507080107fc6318c7e0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"À": "0507060007411d18fe20",
"à": "0507060007411d18fe20",
"è": "0507060007413f0e43e0",
"é": "0507060007113f0e43e0",
"ì": "02070400079154",
"ò": "0507060007411d18c5c0",
"ù": "0507060007412318c5c0"
}
21 changes: 21 additions & 0 deletions core/translations/fonts/font_pixeloperator_regular_8_upper_pt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"o": "0507060007746318c5c0",
"Á": "0507060007111d18fe20",
"Ã": "06070600076667228be880",
"Ç": "0508060007746108b84c00",
"Í": "020704010762a8",
"Ó": "0507060007111d18c5c0",
"Õ": "06070600076667228a2700",
"Ú": "0507060007112318c5c0",
"à": "0507060007411d18fe20",
"á": "0507060007111d18fe20",
"ã": "06070600076667228be880",
"ç": "0508060007746108b84c00",
"é": "0507060007113f0e43e0",
"ê": "050706000722bf0e43e0",
"í": "020704010762a8",
"ó": "0507060007111d18c5c0",
"ô": "0507060007229d18c5c0",
"õ": "06070600076667228a2700",
"ú": "0507060007112318c5c0"
}
14 changes: 14 additions & 0 deletions core/translations/fonts/font_pixeloperator_regular_8_upper_tr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Ç": "0508060007746108b84c00",
"Ö": "0507060007501d18c5c0",
"Ü": "0507060007502318c5c0",
"ç": "0508060007746108b84c00",
"ö": "0507060007501d18c5c0",
"ü": "0507060007502318c5c0",
"Ğ": "0507080107fc6318c7e0",
"ğ": "0507080107fc6318c7e0",
"İ": "0507080107fc6318c7e0",
"ı": "0107040107fe",
"Ş": "0507080107fc6318c7e0",
"ş": "0507080107fc6318c7e0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"À": "0507070007411d18fe20",
"à": "0507070007411c17c5e0",
"è": "0507070007411d1fc1c0",
"é": "0507070007111d1fc1c0",
"ì": "050707000741384213e0",
"ò": "0507070007411d18c5c0",
"ù": "0507070007412318c5c0"
}
Loading
Loading