Select to view content in your preferred language

how to add i18n localization support for custom widget in ArcGIS Experience builder

997
4
12-06-2023 10:19 PM
UbaidGul_opaz
Emerging Contributor

For a custom widget I want to show different labels and title of different layout items and widget label in different languages. I want my widget to be bilingual. I want all messages or labels to be shown according to the locale suppose locale is Arabic or English ar or en.

0 Kudos
4 Replies
ShengdiZhang
Esri Regular Contributor
0 Kudos
UbaidGul_opaz
Emerging Contributor

Thanks I already checked this documentation. What is not working with me is widget label is still in English and when you hover on the widget icon which inside widget controller its showing same English label also on the window of the widget. 

0 Kudos
Ashok
by
Occasional Contributor

Hi @UbaidGul_opaz ,

 

Firstly, all your custom widget labels should read from translations folder. For example like follows

this.props.intl.formatMessage({id: 'str1', defaultMessage: defaultMessages.str1})

 

Secondly, you need to mention locale at the end of the url of your application. Then it will show you corresponding language labels.. You need to access your app something  like follows.

https://localhost:3001/experience/1/?locale=ar

https://localhost:3001/experience/1/?locale=zh-cn

 

Thanks,

Ashok

0 Kudos
UbaidGul_opaz
Emerging Contributor

I am able to use the code you referring the problem I have is widget label not changing according to locale I have attached a picture which shows the widget header which is not changing as locale changes to Arabic.

0 Kudos