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

Perform translations at runtime; add persistent settings #90

Merged
3 commits merged into from
Mar 1, 2022
Merged

Conversation

ghost
Copy link

@ghost ghost commented Mar 1, 2022

Resolves #73

I took a slightly different approach to the problem than originally spec'd in the issue. Rather than bundle all translations with the firmware, which would bloat the firmware binary and potentially limit the number of locales we could support in the future, I opted to store all translations on the microSD card and, if not present, fall back to English as the default baked-in language.

Just as a note for future reference, the function that loads translations from SD (translations) could trivially be updated to search in multiple locations if someone in the future did want to explore bundling compressed translations in the firmware.

As part of this work, I also added back the ability for settings to persist (also via microSD) so users don't have to constantly be going into the settings menu just to change their default language.

@ghost ghost force-pushed the i18n-at-runtime branch 2 times, most recently from 07f61ab to 9d5dc6f Compare March 1, 2022 09:50
@github-actions
Copy link

github-actions bot commented Mar 1, 2022

✅ Result of Pytest Coverage

---------- coverage: platform linux, python 3.9.10-final-0 -----------

Name Stmts Miss Cover
src/krux/baseconv.py 64 0 100%
src/krux/camera.py 42 0 100%
src/krux/context.py 22 0 100%
src/krux/display.py 156 2 99%
src/krux/firmware.py 161 0 100%
src/krux/format.py 13 0 100%
src/krux/i18n.py 17 0 100%
src/krux/input.py 32 3 91%
src/krux/key.py 46 0 100%
src/krux/light.py 18 0 100%
src/krux/logging.py 46 0 100%
src/krux/metadata.py 2 0 100%
src/krux/pages/init.py 188 16 91%
src/krux/pages/home.py 148 0 100%
src/krux/pages/login.py 264 33 88%
src/krux/power.py 21 4 81%
src/krux/printers/init.py 12 0 100%
src/krux/printers/thermal.py 68 3 96%
src/krux/psbt.py 141 7 95%
src/krux/qr.py 108 0 100%
src/krux/settings.py 68 0 100%
src/krux/wallet.py 142 0 100%
TOTAL 1779 68 96%

~ 147 passed in 16.76s ~

@ghost ghost force-pushed the i18n-at-runtime branch from 9d5dc6f to ebc97cd Compare March 1, 2022 09:58
@ghost ghost force-pushed the i18n-at-runtime branch from 9862129 to 7c8173e Compare March 1, 2022 11:15
@ghost ghost merged commit d6baa98 into main Mar 1, 2022
@ghost ghost deleted the i18n-at-runtime branch March 1, 2022 11:37
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bundle translations with firmware; allow switching at runtime
0 participants