Try loading bundles with locales not specified in the master file #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Specifying all available bundles in the master file when a product is released may not be convenient. If a localization is provided afterwards, the master module has to be modified, which gets even more difficult when it is compiled to a single output file. This makes possible adding bundles just by populating their locale-specific directories - without modifying the master file, which may not be easy after the product has been deployed and the language packs work just the "unzip" way and cannot include any code performing code modifications.
If the locale is specified in the master module, no additional locale forms are tried. For example, if
{ "fr": true }
is there and the configuration requestsi18n: { locale: "fr-fr" }
, the "fr-fr" bundle is not attempted to load. This makes the dynamic behaviour not affect the existing master modules with explicitly specified locales, if this change should not affect them.Bundles are attempted to load on the first access and the success or failure are remembered by
true
orfalse
in the master object; not to repeat the loading attempts later again.