Discussing the way to write a multi language menu #316
Replies: 16 comments 30 replies
-
It should also be said that when this support is off, the designer will act exactly as it did before. |
Beta Was this translation helpful? Give feedback.
-
It looks really well. I have two points though:
Thinking about the second usecase, i have some idea. Basically the defined menu item is not aware of the units used. So in theory we can just take the value as a base number and hook up an optional conversion method which will trigger based on some conditions, like language_code flag. Internally we'll still work with the base units, just the UI representation will need to do coversions as needed (change via UI or change via the code). |
Beta Was this translation helpful? Give feedback.
-
Locales of Language + Country are working now on master. I just have a little more work to do in the code generator and a few final pieces of UI work to do, and then I'll create a beta once it is working for the main test cases. All possible cases should work once finished including all C++ generators and the Embedded Java Raspberry PI generator. This is going to need a lot of testing, more than I will be able to do. I think what's best is that I create a beta release, and as many people as possible try it out and make sure it is working. |
Beta Was this translation helpful? Give feedback.
-
So for translation I think the things that are needed are:
I don't think there is anything else dates and times are already quite configurable, and we can easily make them more so if needed. |
Beta Was this translation helpful? Give feedback.
-
So also the application name can also be internationalized, simply in the UI add i18n key into the resource bundle and put a "%" at the beginning, then add the entries into the resource bundle yourself. You can also add any other entries in there for your app, they follow a simple convention to convert from properties into code. See the example that was generated by the in-development version of the designer - https://github.com/davetcc/tcMenuLib/tree/master/examples/arduino32/picoAdafruitDashboard |
Beta Was this translation helpful? Give feedback.
-
I've pushed out TcMenu 3.2 BETA today, I've done a fair bit of testing on it myself already, but the changes are pretty substantial, and will need more testing than a usual release. |
Beta Was this translation helpful? Give feedback.
-
Back up your project (or put a tag in the git timeline) so that you can get back to what you had before trying. |
Beta Was this translation helpful? Give feedback.
-
First problem: Compiling .pio\build\hentower\lib9b9\Adafruit Unified Sensor\Adafruit_Sensor.cpp.o
src/hentower_menu.cpp:27:106: error: 'TC_I18N_MENU_78_UNIT' was not declared in this scope
const PROGMEM AnalogMenuInfo minfoOutsideHumidity = { "Outside hum", 78, 0xffff, 100, NO_CALLBACK, 0, 1, TC_I18N_MENU_78_UNIT };
^~~~~~~~~~~~~~~~~~~~
src/hentower_menu.cpp:31:104: error: 'TC_I18N_MENU_77_UNIT' was not declared in this scope
const PROGMEM AnalogMenuInfo minfoInsideHumidity = { "Inside hum", 77, 0xffff, 100, NO_CALLBACK, 0, 1, TC_I18N_MENU_77_UNIT };
^~~~~~~~~~~~~~~~~~~~
src/hentower_menu.cpp:107:97: error: 'TC_I18N_MENU_44_UNIT' was not declared in this scope
const PROGMEM AnalogMenuInfo minfoContrast = { "Contrast", 44, 144, 100, ContrastChanged, 0, 1, TC_I18N_MENU_44_UNIT };
^~~~~~~~~~~~~~~~~~~~
src/hentower_menu.cpp:131:100: error: 'TC_I18N_MENU_33_UNIT' was not declared in this scope
const PROGMEM AnalogMenuInfo minfoTargetHumidity = { "Target hum", 33, 57, 100, NO_CALLBACK, 0, 1, TC_I18N_MENU_33_UNIT }; I use all your libraries from master. This seems to be a generator issue. Do I need to configure something extra to make this work? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Default lang file is generated empty (with a comment). In order to populate this file, I had to modify arbitrary entry and save the project file. Afterwards all entries were exported. |
Beta Was this translation helpful? Give feedback.
-
Last but not least, language files inside TcMenu library. Currently there is support for 4 languages but users don't know about this option. They might be lucky. As long as they specify just the language code, not the country code, a language is activated automatically. In the #elif defined(TC_LOCALE_FR)
#elif defined(TC_LOCALE_SK)
#elif defined(TC_LOCALE_CS)
#elif defined(TC_LOCALE_EN) What I have instead is language code like
The obvious solution is to include both flags but it's too verbose. It would be great if we could detect and apply proper language even though the country is set. Like if there is not country specific language, we'll fallback to language specific file I know the library uses pre-processor directives and I have no idea whether such a detection is possible. If not, it should be at least mentioned in the documentation. |
Beta Was this translation helpful? Give feedback.
-
How can I add extra fields in the property file? For example a text for dialog. I tried adding this manually into the file but the generated code doesn't include this line. |
Beta Was this translation helpful? Give feedback.
-
Let me try and create another project from scratch with Locale support enabled at some point during the week, in case there is something specific to enabling on a new project. |
Beta Was this translation helpful? Give feedback.
-
To be honest, this has really taken a lot longer than I expected, and left many other projects stalled for quite some time. We just need to get this over the line in working order, with as close to what's there now as possible. I can see the value for others, but realistically it has limited value for projects I have at hand right now so is just a direct cost on my time. |
Beta Was this translation helpful? Give feedback.
-
Should you need to include the API. As the API and embedControlCore are in Maven central, the Maven build needs a GPG key, given you'll only be building it for local use, any GPG key will do, there are loads of discussions about this online. |
Beta Was this translation helpful? Give feedback.
-
Update: So I spent the Weekend setting up the dev environment with JavaFX. I got to the point that I can build the packages but IDEA still has some issues with running the app. I will solve this. Just to let you know that I plan to fix these bugs I found. If you decide to write that post about preparing the dev environment, perhaps I could provide a feedback as I deal with it right now. One thing I noticed already is that if I include external JavaFX libraries, I have to uncomment the dependency in the pom files. You have a note there. I will post here once I have something new. |
Beta Was this translation helpful? Give feedback.
-
Often referred to as i18n, tcMenu 3.2 will support the ability to generate multi-language menu applications. In the first instance, it will be done through the use of a TC_LOCALE_?? flag, that for example to enable French strings would require compile option TC_LOCALE_FR to be set. This also localizes nearly all strings inside core tcMenu as well.
This purely focuses on the flow to add locale Strings to a menu project. First we start tcMenu and enable localization. To do so from the "Code" menu we pick "Configure Locales":
From this dialog we can enable the locales that we want, and the designer will write out the source resource bundles for us.
Although each language can be edited within the designer, it is actually quite easy to edit the source bundle files from any editor, they are simple properties files.
Above is the example layout of an i18n project. Notice the i18n directory with the source bundles in it, an example bundle is loaded. The "default" bundle has no extension and it is better to keep this as English language, to stay in keeping with the core.
Notice the use of a generated folder where all the generated source can now be optionally kept. The theme (which becomes part of user code, and also the same for BSP settings on STM32 LTDC) are within your code, as they don't get overwritten again.
Beta Was this translation helpful? Give feedback.
All reactions