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

[LVGL] Add multilanguage support (i18n) #274

Open
prasimix opened this issue Jul 1, 2023 · 5 comments
Open

[LVGL] Add multilanguage support (i18n) #274

prasimix opened this issue Jul 1, 2023 · 5 comments
Assignees
Milestone

Comments

@prasimix
Copy link
Member

prasimix commented Jul 1, 2023

No description provided.

@prasimix prasimix added this to the M16 milestone Jul 1, 2023
@prasimix prasimix removed this from the M16 milestone Jul 26, 2023
@mverch67
Copy link

mverch67 commented Jun 8, 2024

I think basic multi language support would be quite easy to achieve as the text label "label" just would need to be generated as _("label") instead, so that lvgl's _(char*) function is called to translate the string. Either a simple checkbox to indicate translation or using the already available dropdown menu next to the text label could be used.

The localised strings are handled offline in .yml files and a node script is used to generate the C code. The include of "lv_i18n.h" can be manually added into screens.c settings.

Reference to lv_i18n:
https://github.com/lvgl/lv_i18n

Reference to squareline studio's usage:
https://docs.squareline.io/docs/multilanguage/

@mvladic
Copy link
Contributor

mvladic commented Jun 8, 2024

We also need to add support through expressions. So you can write something like this:

T"Voltage: " + volt_var

Here syntax will be T"..." since this is already how we use it in EEZ-GUI and Dashboard projects.

@mvladic mvladic added this to the M21 milestone Jun 11, 2024
@mvladic
Copy link
Contributor

mvladic commented Jun 13, 2024

We should support LVGL YML format for lv_i18n.h:

  • Import from YML into Studio so translations can be edited inside Studio
  • Export to YML
  • Synchronization with the YML file
  • Generate source code from YML file inside studio, so there is no need to execute lv_i18n script manually

@mverch67
Copy link

mverch67 commented Jun 16, 2024

I'd still like to propose to do this in two steps in case this project is low on developers:
Step 1- add checkbox (or extend the dropdown) next to the label text and generate _("label") for lvgl C code
Step 2- add _p("label", cnt) to UI and code generation as well as import/export YML files and YML code-generation

If the tiny little effort for step 1 is done right away it has the big advantage that migrants from squareline studio can use this feature as they did in the past without losing this functionality for their project. Step 1 is needed anyway and may not change much when developing step 2 at a later stage.

@mvladic
Copy link
Contributor

mvladic commented Jun 16, 2024

I implemented Step 1 in the master.

In "Label", "Textarea", "Dropdown" and "Roller" widgets you can now select for "Text" and "Options" a new option called "Translated literal":

image
image

Here is the project I used for testing:

https://github.com/eez-open/lvgl_test_translate_literal

Here is the place where I putted i18n files:

https://github.com/eez-open/lvgl_test_translate_literal/tree/master/src/i18n

I added following line to screens.c file template:

image

And added these lines in main.c.

@mvladic mvladic modified the milestones: M21, 0.14.2 Jun 16, 2024
@mvladic mvladic changed the title Add multilanguage support in LVGL project [LVGL] Add multilanguage support Jun 17, 2024
@mvladic mvladic changed the title [LVGL] Add multilanguage support [LVGL] Add multilanguage support (i18n) Jun 17, 2024
@prasimix prasimix modified the milestones: 0.14.2, M21 Jun 17, 2024
@mvladic mvladic modified the milestones: M21, M22 Aug 3, 2024
@mvladic mvladic modified the milestones: M22, M23 Aug 31, 2024
@mvladic mvladic modified the milestones: M23, v1.0 Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants