Multi-language enumerations
-
Christian2 years ago #30276
Hi all
in my app, I use an “Entity” and an entity’s status, “EntityStatus”. They are connected via an foreign key and id (“Entity.statusID” and “EntityStatus.id”). Every status has a label to make it easier to work with (e.g., used in dropdowns when setting the status of an entity or in tables, where all entities are listed incl. the status).
All this works fine. But now, multi-language comes into play 🙂 I know how to translate my app in general. But is there also a recommendation how to handle the situation above in Simplifier using several languages? We use a multi-layer architecture (UI Designer > server-side business object as datalayer > MySQL connector incl. calls).
Thanks a lot for any thoughts.
Best regards
Christian
Jennifer HäfnerHas successfully completed the online course Intermediate (200)Has successfully completed the online course Advanced (300)Has successfully completed the online course Basics (100)Has successfully completed the online course Advanced (310)Has successfully completed the online course Advanced (320)Has successfully completed the Intermediate CertificationHas successfully completed the Advanced Certification2 years ago #30277::Hi Christian,
Having multiple languages in Simplifier basically works like having only two: each language needs its own PO file. The respective language can be set using the Client-Side Business Object ‘SIMP_UI5Helper’ – ‘setLanguage’ with the respective language code.
I understand that you also want to translate the labels of the EntityStatus, is that correct? Then I’d recommend adding a language column to the EntityStatus table (or having a separate table for that, depending on your use case) and adding the label text in each language.
When fetching the status labels from the database in a Business Object, you can add the language code to the input parameters and pass it to the SQL connector, e.g. ‘WHERE language = <language_code>’.
When changing the language in the application, you then need to execute the statement again that fetches the entity status labels in the correct language (e.g. by using an event that is fired when the language is changed).
Let me know if you have any questions.
Christian2 years ago #30292::Hi Jennifer
thank you very much for the detailed answer! I guess I will go the route you proposed…
Entity <> EntityStatus (id, labelKey) <> translationTable (labelKey, languageKey, label)
With this approach, everything can stay the same and is done via the WHERE statement, which is the most flexibel approach in my view.
Thank you and best regards
Christian
You must be logged in to reply to this topic.