hd-zero / hdzero-goggle

MIT License
261 stars 76 forks source link

Add Beta Localization Support for HDZERO Goggles Firmware #439

Closed Sat1l closed 2 weeks ago

Sat1l commented 2 months ago

This PR introduces beta localisation features to HDZERO goggles firmware.

Screenshot 2024-09-02 at 21 25 16

Some added things include:

What works:

After compiling the code with new languages, changing the firmware language is as easy as adjusting any other setting and rebooting

Current issues that make this PR a beta:

Screenshot 2024-09-02 at 21 25 26
ligenxxxx commented 2 months ago

I like the idea of ​​putting the language options in the firmware menu instead of creating a new menu.

Sat1l commented 2 months ago

Was able to find a person with actual hardware - firmware works and the sim issues are the same on there.

Sat1l commented 2 months ago

~~I was able to identify the issue with clock page raising a SEGFAULT. If the "< Back" button has more then 6 symbols closing the Clock page would cause a crash, and russian translation is "< Назад" which is 7 symbols. Still thinking on how to solve this issue and hoping someone with better lvgl knowledge could help~~ ok turned out it's also something else

ligenxxxx commented 2 weeks ago

Asian languages ​​are really hard. I am from China and I plan to add only Chinese fonts. This means that every time I add a string, I need to update the fonts.

Sat1l commented 2 weeks ago

Asian languages ​​are really hard. I am from China and I plan to add only Chinese fonts. This means that every time I add a string, I need to update the fonts.

Not exactly. One font in the four (4 different font sizes are used in the ui) sizes is sufficient. I haven’t experimented yet with the font loading, only used backup fonts. After adding a new string you just have to type one lv_i18n command to compile the .yml, and re-build the firmware. Other then Russian I tested it with some German and it worked fine

Sat1l commented 2 weeks ago
Screenshot 2024-11-05 at 20 19 00

I did some Deepl translation and it kinda works. I as of now I solely rely on font-backups, but its not a rigid approach in any way shape or form.

Issues to target are:

As for the first one, if it's fine with you i can add an additional command to parse all of the used symbols in translations and generate the fonts only with the needed values.

So adding a new string would look like this: create a key - extract the key - write the key pair in english - write a value in any desired language - run a font-compile command.

This way we won't have to store hundreds of megs of .c fonts in a repo, the output fonts will be quire small, and we will have to only store one font file to generate all the sizes. This could also be done during ./setup.sh.

As for the font loader, if we do the compilation approach we won't require the loader since all of the symbols would be in one font. My goggles are being shipped, so when they arrive I'll test if including large font influences load time significantly.

@ligenxxxx I'm pending your opinion!

ligenxxxx commented 2 weeks ago

I plan to create PRs myself to implement multiple languages. https://github.com/hd-zero/hdzero-goggle/pull/452

Sat1l commented 2 weeks ago

so should I continue working on this pr or from now on internalization is your job?

ligenxxxx commented 2 weeks ago

so should I continue working on this pr or from now on internalization is your job?

You can wait for a while, let me try it first.

Sat1l commented 2 weeks ago

did this while finicking with branch names, if help is needed I'll create a new one