Skip to content

Docs: Skip loading en-US translations in loadResources example#2568

Open
shelldandy wants to merge 1 commit intomainfrom
fix/i18n-issues
Open

Docs: Skip loading en-US translations in loadResources example#2568
shelldandy wants to merge 1 commit intomainfrom
fix/i18n-issues

Conversation

@shelldandy
Copy link
Copy Markdown
Contributor

Summary

  • Updates the loadResources.ts code sample in the plugin i18n guide to import DEFAULT_LANGUAGE from @grafana/i18n and add an early return when the resolved language is the default
  • This avoids unnecessary dynamic imports of ~500kb of en-US translations that are already embedded in source code via t() and <Trans>

Related: grafana/logs-drilldown#1839
Related: grafana/grafana#122188

Test plan

  • Code sample compiles and reads correctly in context of the guide

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.
@shelldandy shelldandy requested a review from a team as a code owner April 8, 2026 22:14
@shelldandy shelldandy requested a review from joshhunt April 8, 2026 22:14
@shelldandy shelldandy self-assigned this Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Hello! 👋 This repository uses Auto for releasing packages using PR labels.

❌ This PR cannot be merged until the following issues are addressed:

  • This PR is missing one of the following labels: patch, minor, major, no-changelog.
  • Optionally if using a patch, minor or major label also add the release label if you would like this PR to trigger npm package publishing.
🏷️ More info about which labels to use
  • If the changes only affect the docs website, documentation, or this repository's tooling add the no-changelog label.
  • If there are changes to any of the npm packages src files please choose from one of the following labels:
    • 🐛 if this PR fixes a bug add the patch label
    • 🚀 if this PR includes an enhancement add the minor label
    • 💥 if this PR includes a breaking change add the major label
  • Optionally, if you would like this PR to publish new versions of packages when it is merged add the release label.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts example to import DEFAULT_LANGUAGE from @grafana/i18n.
  • Add an early return in loadResources when resolvedLanguage is the default language to skip the dynamic import.

@grafana-plugins-platform-bot grafana-plugins-platform-bot bot moved this from 📬 Triage to 🔬 In review in Grafana Catalog Team Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔬 In review

Development

Successfully merging this pull request may close these issues.

2 participants