I need to model different translations of a product name in a document model. When the user views that product in a ui I would like that he is only shown the translation matching his selected language.
So for example my product would be DnO and I have the translations:
- de: Haftung von Direktoren und leitenden Angestellten
- en: directors and officers liability
How would I model this in the data modeler and ui designer?
For the data modeler I would probably be able to use a repeat with two fields where one represents the language and the other the translation. But I have no clue how I would then use the ui designer to only show the element with the matching language.
There is already an A12 ticket which covers your use case: <INTERNAL_LINK> You should vote for it 
As you mentioned, the solution with repeats has its limitations. We did some form engine customizations via (CustomWidgetFactory/ Annotations) to have a “multilingual text input field” based on a repeat table, but I would not recommend our code for other projects.
I don’t see an out-of-the-box solution either.
However, as a workaround I could image that you might be able to solve this by adding a filter expressions to the repeat that is used to visualize the multi language fields.
A standard filter expression can only refer to fields and/or constants though. If you would create something like a template expression using a “locale” variable and replace that variable dynamically at runtime according to the user locale, you should only see the repeat entry for the desired language.
Alternatively, you could also create (materialize) variants of the form model for each language if you don’t have too many languages…
This doesn’t work unfortunately. Filter expressions only seem to support a too limited syntax.
[Language] = [CurrentLanguage]
Parse error on line 1:
[Language] = [CurrentLanguage]
-------------^
Expecting 'QSTRING', got '['
at n.t [as constructor] (melies.ts:1435)
at new n (melies.ts:1648)
at e.createDetachedRepeat (melies.ts:3465)
at e.readDetachedRepeat (melies.ts:3093)
at e.readScreenElement (melies.ts:2778)
at melies.ts:2742
at Array.forEach (<anonymous>)
at e.readTopLevelScreen (melies.ts:2741)
at melies.ts:2717
at Array.forEach (<anonymous>)
I see another approach for covering diffrent localizations in one document (accepted as cumbersome
)
- define localizations for the main languages as fields vlalues within in the data model and give them default values using default values in the ui model and designer
- for specific multilanguage fields define auxiliary string fields paired to those fields - in the data model
- define the the secondary language values by default values in the ui modeland designer, too
- use dependent controls to show depending on trigger field values different controls (fields)
- (if needed) hide in the UI unneeded field values by dependent field features in the ui model and designer
looks like a hack but it should work