@digitaldefiance/express-suite-starter 2.4.2 → 2.4.4
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitaldefiance/express-suite-starter",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-express-suite": "./dist/src/cli.js"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"publish:public": "npm publish --access public"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@digitaldefiance/i18n-lib": "npm:@digitaldefiance/i18n-lib@4.0.
|
|
34
|
+
"@digitaldefiance/i18n-lib": "npm:@digitaldefiance/i18n-lib@4.0.4",
|
|
35
35
|
"@inquirer/prompts": "^7.5.0",
|
|
36
36
|
"chalk": "^4.1.2",
|
|
37
37
|
"handlebars": "^4.7.8",
|
|
@@ -1,5 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { createI18nStringKeys } from '@digitaldefiance/i18n-lib';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Branded string keys for the {{WorkspaceName}} component.
|
|
5
|
+
*
|
|
6
|
+
* Created using `createI18nStringKeys` for type-safe i18n support.
|
|
7
|
+
* Use `typeof {{WorkspaceName}}StringKey` when referencing the type.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { {{WorkspaceName}}StringKey } from './enumerations/{{workspaceName}}-string-key';
|
|
12
|
+
* import type { BrandedStringsCollection } from '@digitaldefiance/i18n-lib';
|
|
13
|
+
*
|
|
14
|
+
* const strings: BrandedStringsCollection<typeof {{WorkspaceName}}StringKey> = {
|
|
15
|
+
* [{{WorkspaceName}}StringKey.SiteTitle]: 'My Site',
|
|
16
|
+
* };
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export const {{WorkspaceName}}StringKey = createI18nStringKeys('{{WorkspaceName}}', {
|
|
20
|
+
SiteTitle: 'siteTitle',
|
|
21
|
+
SiteDescription: 'siteDescription',
|
|
22
|
+
SiteTagline: 'siteTagline',
|
|
23
|
+
} as const);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Type alias for the branded string key values.
|
|
27
|
+
* Use this when you need to type a variable that holds a string key value.
|
|
28
|
+
*/
|
|
29
|
+
export type {{WorkspaceName}}StringKeyValue = typeof {{WorkspaceName}}StringKey[keyof typeof {{WorkspaceName}}StringKey];
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
I18nBuilder,
|
|
9
9
|
I18nEngine,
|
|
10
10
|
} from '@digitaldefiance/i18n-lib';
|
|
11
|
+
import type { BrandedEnumValue } from '@digitaldefiance/branded-enum';
|
|
11
12
|
import { AppConstants } from './constants';
|
|
12
13
|
import { {{WorkspaceName}}StringKey } from './enumerations/{{workspaceName}}-string-key';
|
|
13
14
|
import { Strings } from './strings-collection';
|
|
@@ -82,8 +83,17 @@ export const i18nContext: IActiveContext<CoreLanguageCode> = {
|
|
|
82
83
|
},
|
|
83
84
|
};
|
|
84
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Translate a string key to the current or specified language.
|
|
88
|
+
*
|
|
89
|
+
* @param name - The branded string key value to translate
|
|
90
|
+
* @param variables - Optional variables to interpolate into the translation
|
|
91
|
+
* @param language - Optional language override
|
|
92
|
+
* @param context - Optional context space override
|
|
93
|
+
* @returns The translated string
|
|
94
|
+
*/
|
|
85
95
|
export const translate = (
|
|
86
|
-
name: {{WorkspaceName}}StringKey
|
|
96
|
+
name: BrandedEnumValue<typeof {{WorkspaceName}}StringKey>,
|
|
87
97
|
variables?: Record<string, string | number>,
|
|
88
98
|
language?: CoreLanguageCode,
|
|
89
99
|
context?: LanguageContextSpace,
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { LanguageCodes } from '@digitaldefiance/i18n-lib';
|
|
1
|
+
import { LanguageCodes, type BrandedMasterStringsCollection, type CoreLanguageCode } from '@digitaldefiance/i18n-lib';
|
|
2
2
|
import { {{WorkspaceName}}StringKey } from './enumerations/{{workspaceName}}-string-key';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Master strings collection for the {{WorkspaceName}} component.
|
|
6
|
+
*
|
|
7
|
+
* This collection provides translations for all supported languages.
|
|
8
|
+
* Uses `BrandedMasterStringsCollection` for type-safe branded enum support.
|
|
9
|
+
*/
|
|
10
|
+
export const Strings: BrandedMasterStringsCollection<typeof {{WorkspaceName}}StringKey, CoreLanguageCode> = {
|
|
5
11
|
[LanguageCodes.EN_US]: {
|
|
6
12
|
[{{WorkspaceName}}StringKey.SiteTitle]: '{{#isEnUs}}{{siteTitle}}{{/isEnUs}}{{^isEnUs}}Your Site Title{{/isEnUs}}',
|
|
7
13
|
[{{WorkspaceName}}StringKey.SiteDescription]: '{{#isEnUs}}{{siteDescription}}{{/isEnUs}}{{^isEnUs}}Your description here{{/isEnUs}}',
|