New multi-language string attribute - Mendix Forum

New multi-language string attribute

17

Due to complications working with multiple languages inside Mendix I would like a new attribute type which allows for defining a string, and translations for each system language or language assigned to that current user setting the attribute. Basically what this should do is create a new record which is stored in a separate table per module.

[SharedModuleEntity(GUID) | Reference to System.Language/LanguageCode(String) | attributeName(String) | translation of string in language(String) | IsSystemText(Boolean)]

When editing the default values for this attribute they should be displayed as the "system texts" pane inside the main project components in Project explorer. 

Category: EntityName
Item: AttributeName
Text: Editable for current selected language
Parameters: Configurable where Module.EntityName is the starting point for referencing to the parameters.
IsSystemText: Editable boolean (default true)
Owner: Always registered UUID 
ChangedBy: Always registered UUID

XPath constraining this new attribute type requires new token objects to use in this XPath constraint.

[%CurrentUserLanguage%]

[%nl_NL%]

[%en_US%]

[%AllSystemLanguages%]

The xpath constraint would be written as followed 

[attributeName.LanguageCode = '[%nl_NL%]' or '[%en_US%]']
[attributeName.IsSystemText = true()]

Side note: this could also work for enumerations, attributeName.key = '' or attributeName.value = ''

If read rights are set to true, that user role can read the attribute value, but will be limited by the language constraints used in the XPath.

Write access of multi language strings should be possible, and these attributes should be available for editing from any Mendix page,
when placed in the interface, this attribute type should create an editable list of input fields one for each system language (which can be collapsed/expanded via a button on the left or right side of the input field) and the available number of input fields is constrained by the XPath settings or if only access to one language is provided should be displayed as a singular input field without the button to collapse or expand.

I also believe that for this input a second checkbox should be available which can be used to toggle whether this text is a System Text. Which can be useful for application administration purposes and letting your client set their own system texts in the front end.
Also you can limit the write access of attributes based on whether this is true yes or no via XPath. Interfacing wise this can just be a checkbox at the bottom or top of all inputs in the multi-language string listview.

When creating an entity with attributes of this type, only create the lines in the multi-language translation table for each language the user has write access to via XPath at that time. 

You can't leave language inputs empty when another language value is set for this attribute type. And the inputs are available for editing.

 

Probably this concept is still flawed but I really think there should come a solution for this.

asked
0 answers