I want to multilingualize the field values shown in the flexmonster grid (the values contained in uniqueName).
https://www.flexmonster.com/doc/localizing-component/#ready-to-use-localizations
According to this document, the only way is to hard code from f/e (mapping.caption),
In the code below, multilingual processing is implemented without that.
https://jsfiddle.net/flexmonster/6mL42ew9/
I was wondering if it's really just hardcoding inside f/e "mapping.caption" , or is there any other way.
Hello,
Thank you for reaching out to us.
In the mentioned JSFiddle, when changing the localization, we also load a different data source (lines 55-58). Flexmonster is a tool for data visualization, and it is not intended to translate the passed data. Therefore, Flexmonster shows the data as configured in the data source. We recommend configuring the data localization by preprocessing the data before passing it to Flexmonster.
Also, you are correct that it is possible to change field names using the mapping.caption
property.
Please let us know if it works for you. Looking forward to hearing from you.
Kind regards,
Nadia
Dose "pre-processing before it's passing to FlexMonster" mean language processing in b/e?
In the /select api, it hands over the uniquename of the field to the request body.
Does that mean that the uniquename that came over should be processed in the backend before statistical or filtering?
Hello,
Thank you for the response.
If you want to translate only the names of the fields (not the entire dataset), we recommend setting the caption
property of the FieldInfoObject
in the /fields response. For example:
// Request:
{
"type": "fields",
"index": "fm-product-sales"
}
// Response:
{
"fields": [
{
"uniqueName": "Category",
"caption": "Catégorie",
},
{
"uniqueName": "Country",
"caption": "Pays",
},
{
"uniqueName": "Price",
"caption": "Prix",
},
{
"uniqueName": "Quantity",
"caption": "Quantité",
},
],
// other properies
}
This way, you can still use the original uniqueName
, while the field names on the UI will be translated.
You are welcome to check our documentation for reference: https://www.flexmonster.com/api/field-info-object/#caption.
Please let us know if it works for you. Looking forward to hearing from you.
Kind regards,
Nadia