Inspired by lvgl's lv_i18n & t123yh's mcufont-encoder
It don't work gettext style. You declare before use of text.
- Read the
strings.yaml
in example to see how to define texts - Define your text FIRST and translations as
example.yaml
shows. - Run this tool before compile to generate right headers and functions.
- Optional, Run this tool to generate list of out put to your font converter like
lv_font_conv
. Now onlylv_font_conv
is supported. - Optional , Run this tool to call the convert and do upload hook stuff etc...
Go to example folder for more info
There is also a demo use in https://github.com/KisonHe/at32-gcc-template/, on branch mcu-font-tool-demo
If you use https://fonts.google.com/icons like me, you will notice that the ttf downloaded from google (MaterialIcons-Regular.ttf) is missing sooooooo many chars.
You can build your own font from svg, and pass the font to this tool.
import fontforge
font = fontforge.font()
glyph = font.createChar(65, "font1")
glyph.importOutlines("xxx.svg")
font.generate("output.ttf")
- It helps you with the font managing.
- If the translation is not available on the selected locale then the default language will be used instead
- If the translation is not available on the default locale, the text ID will be returned
- Read info from config and string yaml files
- Generate
stringtable.cpp/h
from jinja template- Get your text from ID
- Get text font from ID
- Generate converter commands from template (Optional)
- Run commands generated
- Run defined upload command
- Change the fonts. Take lvgl for example, if some text have different font for same ID, Language in example.yaml for example, the text is not updated. If you update the font without updating its font, you will have a bad day. I recommend reboot to apply.
- Update the strings. You need to set all instances'(lvgl labels) strings your self
- Handling plural stuff
- Thread safety
- Allow generate
stringtable.h
from inja template.