Skip to content

Internationalization framework #4146

@aghassemi

Description

@aghassemi

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

  1. Allows us to ship translations for default text we have in components.
  2. Allows page authors to override/translate any default text.
  3. 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.

@cramforce @dvoytenko @rudygalfi @ericlindley-g

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions