Using esri/intl for t9n messages in a custom widget

1458
3
01-13-2021 09:42 AM
MatejVrtich
Esri Contributor

Hi,

Since 4.18 version of the JS API, there is a new concept for t9n using the esri/intl instead of a dojo/i18n module.

What is a proper way of using the new esri/intl module to localize messages in a custom widget development?

It should be helpful to have a starter project for a custom widget development which should show the best practices reflecting the recent development in the API regarding the Dojo removal (removal of declared, i18n, ...using ES modules?).

Thanks,

Matej

Tags (3)
0 Kudos
3 Replies
shaylavi
Esri Contributor

Well aside from all the many ESRI conference videos where they demonstrate live and upload the repository, I personally rely on the source code of all the existing widgets, which you can easily find as part of the documentation or ESRI's github.

You have an example for that at the editor widget - https://github.com/Esri/arcgis-js-api/blob/4master/widgets/Editor.tsx

 

Shay
0 Kudos
MatejVrtich
Esri Contributor

Hi Shay and thank you for your comment.

I'm aware of the resources you provided but I am looking for something more detailed.

As the https://github.com/Esri/arcgis-js-api/blob/4master/widgets/Editor.tsx, it imports "EditorMessages" from "esri/widgets/Editor/t9n/Editor", but this package is not listed in the repo as it is already compiled/bundled.

What I am after is the description of a proper way (best practice) how to work with t9 messages in a custom widget development, which includes the use of this module (more or less documented in the API ref), but also the example of how to bundle the messages in a custom widget for re-use in other apps (using rollup or webpack). I was looking at https://github.com/Esri/arcgis-js-cli as it has a template for a custom widget, however it does not use the t9 module at all.

Regards,

Matej

KellyHutchins
Esri Frequent Contributor

I'm still testing/learning the t9n approach so not sure I'd say this is a best practice example but have a working example here: 

 

https://github.com/kellyhutchins/arcgis-core-demo-app