Skip to content

feat(translations): Add NFS support#3688

Open
rohitratannagar wants to merge 3 commits into
redhat-developer:mainfrom
rohitratannagar:feat/translations-nfs-support
Open

feat(translations): Add NFS support#3688
rohitratannagar wants to merge 3 commits into
redhat-developer:mainfrom
rohitratannagar:feat/translations-nfs-support

Conversation

@rohitratannagar

@rohitratannagar rohitratannagar commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🚀 feat(translations): Add NFS (New Frontend System) support

Jira: https://redhat.atlassian.net/browse/RHIDP-14176

📋 Summary

This PR adds full New Frontend System (NFS) support to the
@red-hat-developer-hub/backstage-plugin-translations and
@red-hat-developer-hub/backstage-plugin-translations-test plugins, while preserving backward compatibility
with the Old Frontend System (OFS) via ./legacy exports.

RHDH (OFS)

Screen.Recording.2026-07-06.at.2.20.26.PM.mov

RHDH-LOCAL (NFS)

Screen.Recording.2026-07-06.at.2.24.38.PM.mov

✨ What's New

🏗️ NFS Plugin Architecture

  • createFrontendPlugin — Translations plugin now exports a default NFS plugin with PageBlueprint and
    TranslationBlueprint extensions
  • translationsApiModule — Replaces the built-in TranslationApi with a custom I18nextTranslationApi
    that exposes getI18nInstance(), required for the debug page and pseudo-localization
  • translationsPseudoLocalizationModule — Standalone module for OFS/dynamic plugin pseudo-localization via
    AppRootWrapperBlueprint
  • translationsTestPlugin — NFS version of the test plugin with its own PageBlueprint and
    TranslationBlueprint

🌍 Self-Contained Translation Refs

  • translationsPluginTranslationRef and translationsTestTranslationRef now include inline translations
    config
  • Language bundles (de, es, fr, it, ja) are auto-registered via #registerDefaults() — nolonger dependent on
    TranslationBlueprint collection, which resolves issues caused by duplicate @backstage/plugin-app-react
    instances (v0.2.1 vs v0.2.4)

📦 Dynamic Plugin Support (OFS)

  • ✅ Added app-config.dynamic.yaml with dynamicRoutes, mountPoints, and translationResources
  • ✅ Added config.d.ts to files array so the config schema is included in the published package
  • ✅ Added app-config.dynamic.yaml to files array
  • ✅ Scalprum modules: PluginRoot (NFS), Alpha, Legacy (OFS), TranslationsApiModule,
    TranslationsPseudoLocalizationModule

🔄 API Graduation

  • translationsPluginTranslationRef promoted from @alpha@public
  • translationsPluginTranslations promoted from @alpha@public
  • alpha.ts export path deprecated in favor of root import

🗑️ Removed (Legacy App Scaffolding)

Removed unnecessary legacy app boilerplate that the NFS framework handles automatically:

Category Files Removed
🖼️ Static assets public/ — favicons, manifest, index.html, robots.txt
🧩 App components Root/, EntityPage.tsx, SearchPage.tsx, apis.ts
🧪 Tests App.test.tsx, e2e-tests/, setupTests.ts
🔧 Config .eslintrc.js, .eslintignore, knip-report.md

🔧 Key Changes

File Change
packages/app/src/App.tsx Replaced ~130 lines of manual routing with createApp({ features: [...] }).
packages/app/src/index.tsx Switched to App.createRoot() instead of manually rendering with ReactDOM.
packages/app/package.json Removed 18 unused dependencies and added @backstage/frontend-defaults and @backstage/frontend-plugin-api.
plugins/translations/src/index.tsx New — Added the NFS plugin using PageBlueprint, ApiBlueprint, and TranslationBlueprint.
plugins/translations/src/legacy.ts New — Added OFS re-exports to maintain backward compatibility.
plugins/translations/package.json Added an exports map, scalprum configuration, and NFS dependencies.
plugins/translations-test/src/index.tsx New — Added an NFS test plugin using PageBlueprint and TranslationBlueprint.
plugins/translations/app-config.dynamic.yaml New — Added dynamic plugin mount configuration for RHDH.
*/translations/ref.ts Embedded translations directly into createTranslationRef for self-contained language loading.
components/LoadedTranslationsTable.tsx Added graceful fallback when getI18nInstance() is unavailable.
components/PseudoLocalizationProvider.tsx Safely skips initialization when getI18nInstance() is unavailable.
app-config.yaml Added NFS route redirects, language configuration, and enabled pseudo-localization.

🔌 RHDH Dynamic Plugin Config

For OFS deployment in RHDH, add to app-config.yaml:

red-hat-developer-hub.backstage-plugin-translations:
  translationResources:
    - importName: translationsPluginTranslations
      module: Alpha
      ref: translationsPluginTranslationRef
  dynamicRoutes:
    - path: /translations
      importName: TranslationsPage
      module: Legacy
  mountPoints:
    - mountPoint: application/provider
      importName: PseudoLocalizationProvider
      module: Legacy

⚠️ Important: module: Legacy is required because PluginRoot now points to the NFS entry. Without it, scalprum
▎ will try to load OFS components from the NFS module and fail silently.


🧪 Test Plan

  • NFS dev app — yarn start in translations workspace, verify translations page loads at /translations
  • Language switching — Select Japanese/German/etc., verify strings translate on both /translations and
    | 🧪 Tests | App.test.tsx, e2e-tests/, setupTests.ts |
    | 🔧 Config | .eslintrc.js, .eslintignore, knip-report.md |

Checklist

  • Added a changeset
  • Updated documentation
  • Added/updated tests
  • Added screenshots (UI changes)

@rhdh-gh-app

rhdh-gh-app Bot commented Jul 6, 2026

Copy link
Copy Markdown

Important

This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior.

Changed Packages

Package Name Package Path Changeset Bump Current Version
app-legacy workspaces/translations/packages/app-legacy none v0.0.0
app workspaces/translations/packages/app none v0.0.0
@red-hat-developer-hub/backstage-plugin-translations-test workspaces/translations/plugins/translations-test minor v0.3.0
@red-hat-developer-hub/backstage-plugin-translations workspaces/translations/plugins/translations minor v0.3.1

@rohitratannagar rohitratannagar force-pushed the feat/translations-nfs-support branch 5 times, most recently from 066309f to 85c0a0b Compare July 6, 2026 09:36
Signed-off-by: rohitratannagar <rohitratannagar2003@gmail.com>
@rohitratannagar rohitratannagar force-pushed the feat/translations-nfs-support branch from 85c0a0b to 7d0841a Compare July 6, 2026 09:40
@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.25%. Comparing base (12b0c0b) to head (6822f69).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3688      +/-   ##
==========================================
- Coverage   54.28%   54.25%   -0.03%     
==========================================
  Files        2347     2349       +2     
  Lines       89650    89698      +48     
  Branches    25062    25078      +16     
==========================================
  Hits        48666    48666              
- Misses      40724    40769      +45     
- Partials      260      263       +3     
Flag Coverage Δ *Carryforward flag
adoption-insights 83.70% <ø> (ø) Carriedforward from 9c3a004
ai-integrations 68.35% <ø> (ø) Carriedforward from 9c3a004
app-defaults 69.79% <ø> (ø) Carriedforward from 9c3a004
augment 46.39% <ø> (ø) Carriedforward from 9c3a004
boost 74.68% <ø> (ø) Carriedforward from 9c3a004
bulk-import 72.46% <ø> (ø) Carriedforward from 9c3a004
cost-management 14.10% <ø> (ø) Carriedforward from 9c3a004
dcm 61.81% <ø> (ø) Carriedforward from 9c3a004
extensions 61.53% <ø> (ø) Carriedforward from 9c3a004
global-floating-action-button 71.18% <ø> (ø) Carriedforward from 9c3a004
global-header 59.71% <ø> (ø) Carriedforward from 9c3a004
homepage 50.23% <ø> (ø) Carriedforward from 9c3a004
install-dynamic-plugins 56.77% <ø> (ø) Carriedforward from 9c3a004
konflux 91.49% <ø> (ø) Carriedforward from 9c3a004
lightspeed 68.81% <ø> (ø) Carriedforward from 9c3a004
mcp-integrations 85.46% <ø> (ø) Carriedforward from 9c3a004
orchestrator 39.47% <ø> (ø) Carriedforward from 9c3a004
quickstart 65.63% <ø> (ø) Carriedforward from 9c3a004
sandbox 79.56% <ø> (ø) Carriedforward from 9c3a004
scorecard 82.67% <ø> (ø) Carriedforward from 9c3a004
theme 61.26% <ø> (ø) Carriedforward from 9c3a004
translations 7.17% <0.00%> (-0.09%) ⬇️
x2a 78.68% <ø> (ø) Carriedforward from 9c3a004

*This pull request uses carry forward flags. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 12b0c0b...6822f69. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: rohitratannagar <rohitratannagar2003@gmail.com>
@rohitratannagar rohitratannagar force-pushed the feat/translations-nfs-support branch 2 times, most recently from 3c9c385 to ec24500 Compare July 6, 2026 11:18
@rohitratannagar rohitratannagar force-pushed the feat/translations-nfs-support branch from ec24500 to 6822f69 Compare July 6, 2026 11:21
@sonarqubecloud

sonarqubecloud Bot commented Jul 6, 2026

Copy link
Copy Markdown

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant