Skip to content

Commit fdda9a1

Browse files
lokanandaprabhukarthikjeeyarits-mitesh-kumar
authored
feat(Extensions): Add translation support for Extensions (#1410)
* feat(marketplace): Add comprehensive i18n support with German, French, and Spanish translations * Removed translations from Skeletons * Replaced Trans with MarkdownContent from @backstage/core-components * Removed translation in featured.yaml file * Added tranalation for PluginCollection * Rebased with main branch * feat(marketplace): Add exports configuration for alpha subpath * get translated text from util for collections * add api-reports to eslintignore * mark translations resources and refs as alpha * updating api report Signed-off-by: its-mitesh-kumar <[email protected]> * re-updating api report Signed-off-by: its-mitesh-kumar <[email protected]> --------- Signed-off-by: its-mitesh-kumar <[email protected]> Co-authored-by: Karthik <[email protected]> Co-authored-by: its-mitesh-kumar <[email protected]>
1 parent 7a85a65 commit fdda9a1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2247
-364
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-marketplace': minor
3+
'@red-hat-developer-hub/backstage-plugin-marketplace-backend': minor
4+
'@red-hat-developer-hub/backstage-plugin-marketplace-common': minor
5+
'@red-hat-developer-hub/backstage-plugin-catalog-backend-module-marketplace': minor
6+
---
7+
8+
Add internationalization (i18n) support with German, French and Spanish translations in marketplace.

workspaces/marketplace/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ playwright.config.ts
22
.eslintrc.js
33
.prettierrc.js
44
coverage
5+
report-alpha.api.md

workspaces/marketplace/.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ coverage
66
.eslintrc.js
77
report.api.md
88
knip-report.md
9+
report-alpha.api.md

workspaces/marketplace/examples/collections/featured.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ metadata:
55
namespace: marketplace-plugin-demo
66
name: featured
77
title: Featured Plugins
8+
titleKey: collection.featured.title
89
description: A set of great plugins! :)
10+
descriptionKey: collection.featured.description
911
spec:
1012
type: curated
1113
plugins:

workspaces/marketplace/json-schema/collections.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,15 @@
3535
"title": {
3636
"type": "string"
3737
},
38+
"titleKey": {
39+
"type": "string"
40+
},
3841
"description": {
3942
"type": "string"
4043
},
44+
"descriptionKey": {
45+
"type": "string"
46+
},
4147
"tags": {
4248
"type": "array",
4349
"items": {

workspaces/marketplace/packages/app/src/App.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import { githubAuthApiRef } from '@backstage/core-plugin-api';
5353
import { getAllThemes } from '@red-hat-developer-hub/backstage-plugin-theme';
5454

5555
import { DynamicMarketplacePluginRouter as Marketplace } from '@red-hat-developer-hub/backstage-plugin-marketplace';
56+
import { marketplaceTranslations } from '@red-hat-developer-hub/backstage-plugin-marketplace/alpha';
5657

5758
import { apis } from './apis';
5859
import { entityPage } from './components/catalog/EntityPage';
@@ -61,6 +62,10 @@ import { Root } from './components/Root';
6162

6263
const app = createApp({
6364
apis,
65+
__experimentalTranslations: {
66+
availableLanguages: ['en', 'de', 'fr', 'es'],
67+
resources: [marketplaceTranslations],
68+
},
6469
bindRoutes({ bind }) {
6570
bind(catalogPlugin.externalRoutes, {
6671
createComponent: scaffolderPlugin.routes.root,
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
playwright.config.ts
22
!.eslintrc.js
3-
!.prettierrc.js
3+
!.prettierrc.js
4+
report-alpha.api.md
5+
report.api.md
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dist
2+
dist-dynamic
3+
dist-types
4+
coverage
5+
.vscode
6+
.eslintrc.js
7+
report.api.md
8+
knip-report.md
9+
report-alpha.api.md

workspaces/marketplace/plugins/marketplace/dev/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ import {
2323
MarketplaceFullPageRouter,
2424
MarketplaceTabbedPageRouter,
2525
} from '../src/plugin';
26+
import { marketplaceTranslations } from '../src/translations';
2627

2728
createDevApp()
2829
.registerPlugin(marketplacePlugin)
30+
.addTranslationResource(marketplaceTranslations)
31+
.setAvailableLanguages(['en', 'de', 'fr', 'es'])
32+
.setDefaultLanguage('en')
2933
.addThemes(getAllThemes())
3034
.addPage({
3135
element: <MarketplaceFullPageRouter />,

workspaces/marketplace/plugins/marketplace/package.json

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
"types": "src/index.ts",
66
"license": "Apache-2.0",
77
"publishConfig": {
8-
"access": "public",
9-
"main": "dist/index.esm.js",
10-
"types": "dist/index.d.ts"
8+
"access": "public"
119
},
1210
"repository": {
1311
"type": "git",
@@ -24,6 +22,21 @@
2422
]
2523
},
2624
"sideEffects": false,
25+
"exports": {
26+
".": "./src/index.ts",
27+
"./alpha": "./src/alpha.ts",
28+
"./package.json": "./package.json"
29+
},
30+
"typesVersions": {
31+
"*": {
32+
"alpha": [
33+
"src/alpha.ts"
34+
],
35+
"package.json": [
36+
"package.json"
37+
]
38+
}
39+
},
2740
"scripts": {
2841
"start": "backstage-cli package start",
2942
"build": "backstage-cli package build",

0 commit comments

Comments
 (0)