Extjs I18n (Keys & Translations loaded from remote endpoint)

This is similar to previous post, only difference is that the keys and translations are loaded from a remote source.

For an enterprise level app, its not a good idea to store huge list of keys & translations inside the app itself because it will become unmaintainable at some point and moreover every change would require redeploy of the app. So ideally there should be a remote store where we can store and manage these keys and their corresponding translations in all languages. Below example illustrates how we can fetch I18n keys from a remote endpoint and store them in an in-memory store that can be loaded once at app load and then used for all the translations.

Extjs I18n (Keys & Translations stored in application itself)

ExtJs components does support internalization but for the other content present in component (titles, labels, error messages etc.) we often need to have a utility which can be used to translate the keys to their corresponding translations based on the selected language. Below is one way of creating such a utility which works based on the keys and translations stored inside the app that can be used for adding I18n keys for texts where translations are required.

.