diff --git a/Makefile b/Makefile index be82db240..a1eaf394f 100644 --- a/Makefile +++ b/Makefile @@ -107,16 +107,16 @@ mocks_check: ## check validity of mock python headers flake8 core/mocks/generated templates: icons ## rebuild coin lists from definitions in common - ./core/tools/build_templates + make -C core templates templates_check: ## check that coin lists are up to date - ./core/tools/build_templates --check + make -C core templates_check solana_templates: ## rebuild Solana instruction template file - ./core/tools/build_solana_templates + make -C core solana_templates solana_templates_check: ## check that Solana instruction template file is up to date - ./core/tools/build_solana_templates --check + make -C core solana_templates_check icons: ## generate FIDO service icons python3 core/tools/build_icons.py diff --git a/core/Makefile b/core/Makefile index a326833ce..b7d0a9167 100644 --- a/core/Makefile +++ b/core/Makefile @@ -211,12 +211,20 @@ clippy: ## code generation: -templates: ## render Mako templates (for lists of coins, tokens, etc.) +templates: translations ## render Mako templates (for lists of coins, tokens, etc.) ./tools/build_templates -templates_check: ## check that Mako-rendered files match their templates +templates_check: translations_check ## check that Mako-rendered files match their templates ./tools/build_templates --check +translations: ## update translations + python ./translations/order.py + python ./translations/cli.py gen + +translations_check: ## check that translations are up to date + # spits out error if the stored merkle root is not up to date + python ./translations/cli.py merkle-root > /dev/null + solana_templates: ## rebuild Solana instruction template file ./tools/build_solana_templates @@ -455,3 +463,5 @@ coverage: ## generate coverage report unused: ## find unused micropython code vulture src src/_vulture_ignore.txt --exclude "messages.py,*/enums/*" + +.PHONY: templates translations templates_check translations_check diff --git a/core/SConscript.firmware b/core/SConscript.firmware index 724829d17..b988ef114 100644 --- a/core/SConscript.firmware +++ b/core/SConscript.firmware @@ -367,6 +367,12 @@ if FEATURE_FLAGS["SYSTEM_VIEW"]: CPPDEFINES_MOD += ['SYSTEM_VIEW'] CCFLAGS_MOD += '-DSYSTEM_VIEW ' +TRANSLATION_DATA = [ + "translations/en.json", + "translations/order.json", +] + + # fonts tools.add_font('NORMAL', FONT_NORMAL, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('BOLD', FONT_BOLD, CPPDEFINES_MOD, SOURCE_MOD) @@ -749,6 +755,7 @@ rust = env.Command( source='', action=cargo_build(), ) env.Depends(rust, protobuf_blobs) +env.Depends(rust, TRANSLATION_DATA) env.Append(LINKFLAGS=f' -L{RUST_LIBDIR}') env.Append(LINKFLAGS=f' -l{RUST_LIB}') diff --git a/core/SConscript.unix b/core/SConscript.unix index 2e85a1a70..783485a99 100644 --- a/core/SConscript.unix +++ b/core/SConscript.unix @@ -417,6 +417,12 @@ if DMA2D: ] +TRANSLATION_DATA = [ + "translations/en.json", + "translations/order.json", +] + + # fonts tools.add_font('NORMAL', FONT_NORMAL, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('BOLD', FONT_BOLD, CPPDEFINES_MOD, SOURCE_MOD) @@ -833,6 +839,7 @@ rust = env.Command( source='', action=cargo_build(), ) env.Depends(rust, protobuf_blobs) +env.Depends(rust, TRANSLATION_DATA) env.Append(LINKFLAGS=f'-L{RUST_LIBDIR}') diff --git a/core/translations/order.py b/core/translations/order.py index bf24cd15c..c9c198221 100644 --- a/core/translations/order.py +++ b/core/translations/order.py @@ -1,5 +1,6 @@ from __future__ import annotations import json +import os from pathlib import Path @@ -29,6 +30,8 @@ def generate_new_order() -> None: old_order[new_index] = item output_file.write_text(json.dumps(old_order, indent=2) + "\n") + stat = language_file.stat() + os.utime(output_file, ns=(stat.st_atime_ns, stat.st_mtime_ns)) else: print("No new items found.")