Docs: Skip loading en-US translations in loadResources example#2568
Open
shelldandy wants to merge 1 commit intomainfrom
Open
Docs: Skip loading en-US translations in loadResources example#2568shelldandy wants to merge 1 commit intomainfrom
shelldandy wants to merge 1 commit intomainfrom
Conversation
Update the loadResources.ts code sample to import DEFAULT_LANGUAGE and add an early return when the resolved language is the default, avoiding unnecessary dynamic imports of ~500kb of en-US translations already embedded in source code.
Contributor
|
Hello! 👋 This repository uses Auto for releasing packages using PR labels. ❌ This PR cannot be merged until the following issues are addressed:
🏷️ More info about which labels to use
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Grafana 11 plugin internationalization guide to avoid loading translation resources for the default language, since default-language strings are already provided inline via t() and <Trans>.
Changes:
- Update the
loadResources.tsexample to importDEFAULT_LANGUAGEfrom@grafana/i18n. - Add an early return in
loadResourceswhenresolvedLanguageis the default language to skip the dynamic import.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
loadResources.tscode sample in the plugin i18n guide to importDEFAULT_LANGUAGEfrom@grafana/i18nand add an early return when the resolved language is the defaultt()and<Trans>Related: grafana/logs-drilldown#1839
Related: grafana/grafana#122188
Test plan