Custom Datasource API - Intercepting responses for localization

Answered
Henry asked on May 2, 2023

Hello,
 
We are in the process of localizing our application where localization occurs entirely on the client side. As a part of the response to the /fields API call, we are setting the folder field for some fields; these values are not localized because they are set on the server side. We were wondering if there is some API that lets us intercept the custom datasource API responses so that we can replace the `folder` values with their translated text. Or, if there is not an existing API, what is the recommended way to localize these values?
Please let us know if we can provide any clarifications and/or additional information!
 
Kind regards,
Henry

4 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster May 3, 2023

Hello Henry,

Thank you for reaching out to us.

Kindly note that the localization only applies to all the predefined Flexmonster UI labels. As far as the folder's name is defined on your side, it is not translated using localization. 
We recommend replacing the folder values with the already translated text on the server side. Alternatively, you can define the folder name on the client side using Mapping:

mapping: {
"Country": {
  caption: "MyCountry",
  folder: "Place"
},
"State": {
  caption: "MyState",
  folder: "Place"
},
"City": {
  caption: "MyCity",
  folder: "Place"
}
}

Please let us know if it works for you. Looking forward to hearing from you.

Kind regards,
Nadia

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster May 15, 2023

Hello Henry,

Hope you are doing well.

We were wondering if you had a chance to test a suggested approach.

Looking forward to hearing your feedback.

Kind regards,
Nadia

Public
Henry May 15, 2023

Hi Nadia,
 
Whoops, sorry about that, I forgot to reply back to the ticket. We are going to translate the folders on the server side. We also tried the mapping object, but I think we ran into some complications into how we are using the folders to group measures and calculated values together - the implementation ended up being simpler/cleaner when the translations were done on the server side.
 
Thanks for the follow up!
 
Kind regards,
Henry

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster May 16, 2023

Hello Henry,

Thank you for the feedback.

We are glad to hear that it works for you!

As always, feel free to contact us if other questions arise.

Kind regards,
Nadia

Please login or Register to Submit Answer