-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Internationalization framework #4146
Description
This is just a placeholder/discussion issue for internationalization work we need to do.
As we create more complex components, there is more default text that we need to include (e.g. labels and titles, whether visible or for screen readers). Allowing page authors to change these defaults (whether to translate them or simply to change them) is currently done through custom attributes on the elements but this approach is not very scalable and muddies the component's API.
We should come up with an i18n and text customization approach that
- Allows us to ship translations for default text we have in components.
- Allows page authors to override/translate any default text.
- Support interpolation. (e.g. "page {{x}} of {{y}}")
We should research what a good existing approach for this is. A starting thought could be: a JSON based system which is just a map of <UniqueTextKey, Value> (e.g. "{amp.LightBox.nextButtonTitle": "See next Item"}). Components use the key instead of hardcoding the text and runtime does the repalcement and interpolation. We provide a translated map for English and a few other languages and page authors can override any key with their value of choice by providing a partial override map.