Widget translation

0
Within widgets I am aware you can add strings of translateable via the xml - type="translatableString"    however if I want to create  a widget with a large amount of ui compontents and strings I need to add a lot of translateable parameters to my XML.  Without trying to sound lazy, is there not a means in which I could leverage the list of transalations from the modeler?    I noticed that the login form uses a resource called I18NMap - https://github.com/mendix/LoginForm/blob/master/src/LoginForm/widget/LoginForm.js#L331   Is it possible to do a similar thing in other widgets?    Thanks.   
asked
2 answers
0

just let  a microflow return a comma seperated string for all attributes and entities you need.

You still have to do the configuration for these attributes in the modeler.

answered
0

At this moment there is no good solution to this problem.

Add a lot of translatableString if it could be defined by the modeler.

If there are much text, but it is static you can use the i18n of dojo 

https://dojotoolkit.org/reference-guide/1.10/quickstart/internationalization/resource-bundling.html#quickstart-internationalization-resource-bundling

// WidgetName\widget\nls\messages.js
define({
    root: {
        hello: "Hello world"
    },
    nl: true
});

// WidgetName\widget\nls\nl\messages.js
define({
    hello: "Hoi wereld"
});

// WidgetName\widget\WidgetName.js
define([
    /* ... */
    "dojo/i18n!WidgetName/widget/nls/messages"
], function (/* ... */ localMessages) {
    console.log(JSON.stringify(localMessages));
    /* .. your widget */
});

Of course, the ugly quick hack: Inserting a long JSON string with your translations into a single translatableString

 

 

 

answered