@unisphere/nx 4.14.4 → 4.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/dist/generators/add-package/templates/new-package/src/languages/README.md +52 -0
  2. package/dist/generators/add-package/templates/new-package/src/languages/en-US.json +1 -0
  3. package/dist/generators/add-package/templates/new-package/src/languages/files/.gitkeep +0 -0
  4. package/dist/generators/add-package/templates/new-package/src/languages/supported-languges.ts +1 -0
  5. package/dist/generators/add-package/templates/new-package/src/lib/use-translation.tsx.template +9 -0
  6. package/dist/generators/add-runtime/templates/new-runtime/src/languages/README.md +32 -0
  7. package/dist/generators/add-runtime/templates/new-runtime/src/languages/en-US.json +1 -0
  8. package/dist/generators/add-runtime/templates/new-runtime/src/languages/files/.gitkeep +0 -0
  9. package/dist/generators/add-runtime/templates/new-runtime/src/languages/supported-languges.ts +1 -0
  10. package/dist/generators/add-runtime/templates/new-runtime/src/lib/runtime.tsx.template +1 -0
  11. package/dist/generators/add-runtime/templates/new-runtime/src/lib/use-translation.tsx.template +9 -0
  12. package/dist/generators/add-visual/templates/new-visual/render-method.template +1 -0
  13. package/dist/migrations/4-15-0/add-languages-support.d.ts +16 -0
  14. package/dist/migrations/4-15-0/add-languages-support.d.ts.map +1 -0
  15. package/dist/migrations/4-15-0/add-languages-support.js +629 -0
  16. package/dist/migrations/4-15-1/templates/_publish-artifacts.template +363 -0
  17. package/dist/migrations/4-15-1/templates/cicd.template +90 -0
  18. package/dist/migrations/4-15-1/templates/documentation-workflow.template +68 -0
  19. package/dist/migrations/4-15-1/upgrade-github-actions-node24.d.ts +17 -0
  20. package/dist/migrations/4-15-1/upgrade-github-actions-node24.d.ts.map +1 -0
  21. package/dist/migrations/4-15-1/upgrade-github-actions-node24.js +80 -0
  22. package/migrations.json +94 -0
  23. package/package.json +1 -1
@@ -0,0 +1,52 @@
1
+ # Languages
2
+
3
+ This folder contains the internationalization (i18n) setup for this package.
4
+
5
+ ## Structure
6
+
7
+ ```
8
+ languages/
9
+ ├── en-US.json # Default English translations (source of truth)
10
+ ├── supported-languges.ts # List of supported language codes
11
+ ├── files/ # Translated language files (e.g., de-DE.json, fr-FR.json)
12
+ │ └── .gitkeep
13
+ ├── _db/ # Translation database for change tracking (git-ignored)
14
+ │ └── .gitignore
15
+ └── README.md # This file
16
+ ```
17
+
18
+ ## How It Works
19
+
20
+ - **`en-US.json`** — The master translation file. All keys are defined here in English.
21
+ - **`supported-languges.ts`** — Exports the list of supported language codes. Add new languages here when translations are available.
22
+ - **`files/`** — Contains translated JSON files for each supported language (excluding en-US). These are generated via the Unisphere CLI export/import workflow.
23
+ - **`_db/`** — Used internally by the CLI to track translation changes between exports. Do not commit.
24
+
25
+ ## Adding Translations
26
+
27
+ 1. Add your translation keys to `en-US.json`
28
+ 2. Run `npx unisphere languages export` to generate CSV files for translators
29
+ 3. After receiving translations, run `npx unisphere languages import` to update the `files/` directory
30
+ 4. Add the new language code to `supported-languges.ts`
31
+
32
+ ## Usage
33
+
34
+ Components in this package use translations via the `useTranslation` hook:
35
+
36
+ ```typescript
37
+ import { useTranslation } from './use-translation';
38
+
39
+ const MyComponent = () => {
40
+ const { t } = useTranslation();
41
+ return <span>{t('myKey')}</span>;
42
+ };
43
+ ```
44
+
45
+ ## CLI Commands
46
+
47
+ ```bash
48
+ npx unisphere languages export # Export translations to CSV for translation services
49
+ npx unisphere languages import # Import translated CSV files back to JSON
50
+ npx unisphere languages serve # Serve language files during local development
51
+ npx unisphere languages bundle # Bundle language files for distribution
52
+ ```
@@ -0,0 +1 @@
1
+ export const supportedLanguages: string[] = ['en-US'];
@@ -0,0 +1,9 @@
1
+ import en from '../languages/en-US.json';
2
+ import { createUseTranslation } from '@unisphere/ui-i18n-react';
3
+ import { supportedLanguages } from '../languages/supported-languges';
4
+
5
+ export const useTranslation = createUseTranslation({
6
+ packageName: '<%= packageJsonName %>',
7
+ defaultTranslations: en as any,
8
+ supportedLanguages,
9
+ });
@@ -0,0 +1,32 @@
1
+ # Languages
2
+
3
+ This folder contains the internationalization (i18n) setup for this runtime.
4
+
5
+ ## Structure
6
+
7
+ ```
8
+ languages/
9
+ ├── en-US.json # Default English translations (source of truth)
10
+ ├── supported-languges.ts # List of supported language codes
11
+ ├── files/ # Translated language files (e.g., de-DE.json, fr-FR.json)
12
+ │ └── .gitkeep
13
+ ├── _db/ # Translation database for change tracking (git-ignored)
14
+ │ └── .gitignore
15
+ └── README.md # This file
16
+ ```
17
+
18
+ ## How It Works
19
+
20
+ - **`en-US.json`** — The master translation file. All keys are defined here in English.
21
+ - **`supported-languges.ts`** — Exports the list of supported language codes. Add new languages here when translations are available.
22
+ - **`files/`** — Contains translated JSON files for each supported language (excluding en-US). These are generated via the Unisphere CLI export/import workflow.
23
+ - **`_db/`** — Used internally by the CLI to track translation changes between exports. Do not commit.
24
+
25
+ ## CLI Commands
26
+
27
+ ```bash
28
+ npx unisphere languages export # Export translations to CSV for translation services
29
+ npx unisphere languages import # Import translated CSV files back to JSON
30
+ npx unisphere languages serve # Serve language files during local development
31
+ npx unisphere languages bundle # Bundle language files for distribution
32
+ ```
@@ -0,0 +1 @@
1
+ export const supportedLanguages: string[] = ['en-US'];
@@ -12,6 +12,7 @@ import {
12
12
  widgetName,
13
13
  } from '<%= typesAlias %>';
14
14
  import { HtmlDomRuntimeVisual, KalturaAnalyticsServiceType } from '@unisphere/runtime';
15
+ import { UnisphereI18NRuntimeProxy } from '@unisphere/ui-i18n-react';
15
16
 
16
17
  export class Runtime
17
18
  extends UnisphereRuntimeBase<<%= runtimeName__pascalCase %>RuntimeSettings, Root>
@@ -0,0 +1,9 @@
1
+ import en from '../languages/en-US.json';
2
+ import { createUseTranslation } from '@unisphere/ui-i18n-react';
3
+ import { supportedLanguages } from '../languages/supported-languges';
4
+
5
+ export const useTranslation = createUseTranslation({
6
+ packageName: 'self',
7
+ defaultTranslations: en as any,
8
+ supportedLanguages,
9
+ });
@@ -10,6 +10,7 @@
10
10
 
11
11
  visual.htmlContainer?.render(
12
12
  <ScopedUnisphereWorkspaceProvider unisphereWorkspace={this._workspace} runtimeLogger={this._logger}>
13
+ <UnisphereI18NRuntimeProxy runtimeUri={this._options.runtimeDeployedPath} />
13
14
  <ThemeProvider
14
15
  cssPrefix={'<%= widgetName__lowerDashCase %>-<%= runtimeName__lowerDashCase %>-<%= visualName__lowerDashCase %>'}
15
16
  mode={typeof this._theme === 'string' ? this._theme : this._theme.mode}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Migration: Add Unisphere Languages Support
3
+ *
4
+ * Migrates packages from raw i18next/react-i18next to the Unisphere
5
+ * @unisphere/ui-i18n-react framework with createUseTranslation pattern.
6
+ * Adds UnisphereI18NRuntimeProxy to all runtimes.
7
+ *
8
+ * Steps:
9
+ * 1. For packages with existing en-US.json: move translations, create
10
+ * use-translation.tsx, update imports, remove LanguagesProvider
11
+ * 2. For all runtimes: add UnisphereI18NRuntimeProxy, remove LanguagesProvider usage
12
+ * 3. Update root package.json dependencies
13
+ */
14
+ import { Tree } from '@nx/devkit';
15
+ export default function update(tree: Tree): Promise<void>;
16
+ //# sourceMappingURL=add-languages-support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-languages-support.d.ts","sourceRoot":"","sources":["../../../src/migrations/4-15-0/add-languages-support.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,IAAI,EAML,MAAM,YAAY,CAAC;AAiBpB,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB9D"}