Skip to content

Create Plugin: add loadResources in scenes template#2477

Open
hugohaggmark wants to merge 2 commits intomainfrom
hugoh/fix-scenes-template
Open

Create Plugin: add loadResources in scenes template#2477
hugohaggmark wants to merge 2 commits intomainfrom
hugoh/fix-scenes-template

Conversation

@hugohaggmark
Copy link
Contributor

@hugohaggmark hugohaggmark commented Feb 24, 2026

What this PR does / why we need it:

This pull request updates the internationalization (i18n) setup instructions and templates for Grafana plugins, particularly improving support for plugins that use @grafana/scenes. The documentation is now clearer about the differences in translation initialization for plugins with and without @grafana/scenes, and the plugin template code is updated to properly load translation resources when @grafana/scenes is used.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @grafana/create-plugin@6.10.2-canary.2477.22383481688.0
# or 
yarn add @grafana/create-plugin@6.10.2-canary.2477.22383481688.0

@github-actions
Copy link
Contributor

github-actions bot commented Feb 24, 2026

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

✨ This PR can be merged and will trigger a new patch release.
NOTE: When merging a PR with the release label please avoid merging another PR. For further information see here.

@hugohaggmark hugohaggmark added patch Increment the patch version when merged release Create a release when this pr is merged labels Feb 24, 2026
@hugohaggmark hugohaggmark requested review from joshhunt and removed request for academo February 24, 2026 13:20
Copy link
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 improves plugin internationalization guidance and scaffolding for plugins that use @grafana/scenes, ensuring Scenes translation resources get loaded during plugin translation initialization.

Changes:

  • Update the scenes-app template to pass @grafana/scenes loadResources into initPluginTranslations.
  • Clarify i18n docs by splitting module.ts initialization instructions for plugins with and without @grafana/scenes.
  • Extend the Grafana <12.1.0 doc to include @grafana/scenes loader behavior across versions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/create-plugin/templates/scenes-app/src/module.tsx Ensures Scenes i18n resources are loaded by adding loadResources to initPluginTranslations.
docusaurus/docs/how-to-guides/plugin-internationalization.md Adds separate module.ts initialization examples for plugins that do and don’t use @grafana/scenes.
docusaurus/docs/how-to-guides/plugin-internationalization-grafana-11.md Adds version-aware initialization example that includes the Scenes loader even when Grafana loads plugin resources.

Copy link
Collaborator

@jackw jackw left a comment

Choose a reason for hiding this comment

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

Code changes LGTM! 🚀

import pluginJson from 'plugin.json';

await initPluginTranslations(pluginJson.id);
await initPluginTranslations(pluginJson.id, [loadResources]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this enough or do we need the scenes esm build fix merged and then bump scenes in the package.json template too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, this can't be merged until the esm fix, should I change this to a Draft PR meanwhile?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nah, it's fine. I just wanted to make sure what order things needed to happen in. 👍

@hugohaggmark hugohaggmark changed the title chore: add loadResources in scenes template Create Plugin: add loadResources in scenes template Feb 24, 2026
@github-project-automation github-project-automation bot moved this from 📬 Triage to 🔬 In review in Grafana Catalog Team Feb 24, 2026
Copy link
Contributor

@urbiz-grafana urbiz-grafana left a comment

Choose a reason for hiding this comment

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

Doc updates LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Increment the patch version when merged release Create a release when this pr is merged

Projects

Status: 🔬 In review
Status: 🔍 In review

Development

Successfully merging this pull request may close these issues.

4 participants