lvgl / lv_i18n

Internationalization (i18n) for LVGL
MIT License
63 stars 17 forks source link

context storage #65

Open bryghtlabs-richard opened 3 months ago

bryghtlabs-richard commented 3 months ago

It's often useful to be able to give a translator a short description of the context needed for a particular translation. Especially when translating from English, which has a lot of different meanings with the same spelling. It would be useful for us if lv_i18n could store context descriptions alongside in the yml file somehow. Ex:

de:
   Close: schließe #An action, close a window or close the door
de:
   Close: in der Nähe #adverb, nearby, not far away

Currently lv_i18n extract discards comments though, I saw Puzrin mentioned js-yaml doesn't have an AST, so there's not a good way to update just the values and keep the comments and formatting. I wanted to mention the idea of storing context since it has always been useful to supply to translators for a number of projects, perhaps others also would use it.

puzrin commented 3 months ago

If you need advanced metadata management, it's probably better to select more advanced projects for translation. This one was done to be compact for "small projects," and having no metadata support is a trade-off.

Also, you can partially dim the problem by embedding context into variables:

That will also require a translation file for English, but the content will be descriptive.

bubeck commented 1 month ago

I issued this PR https://github.com/lvgl/lv_i18n/pull/52 as another solution to this problem. It gives translators a hint, where the source string comes from. This could help him understanding the context.