@peassoft/mnr-langs 1.0.0
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/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/package.json +24 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The source of truth for supported UI languages in Memorize'n'Revise.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
/** Utility type */
|
|
7
|
+
type UnionOf<T extends ReadonlyArray<unknown>> = T[number];
|
|
8
|
+
/**
|
|
9
|
+
* Complete list of supported languages.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare const supportedLanguges: readonly ["en", "ru"];
|
|
14
|
+
/**
|
|
15
|
+
* Default language.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare const defaultLanguage: "en";
|
|
20
|
+
/**
|
|
21
|
+
* Type of a supported language
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export type SupportedLanguage = UnionOf<typeof supportedLanguges>;
|
|
26
|
+
/**
|
|
27
|
+
* Get all remaining supported languages except the given one.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export declare function getRemainingLanguages(lang: SupportedLanguage): SupportedLanguage[];
|
|
32
|
+
/**
|
|
33
|
+
* Given a supported language return a path segment for this language.
|
|
34
|
+
*
|
|
35
|
+
* For the default language returns "/". For other supported languages returns "/lang/".
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
export declare function langToPathSegment(lang: SupportedLanguage): '/' | `/${typeof lang}/`;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,mBAAmB;AACnB,KAAK,OAAO,CAAC,CAAC,SAAS,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,uBAAwB,CAAC;AAEvD;;;;GAIG;AACH,eAAO,MAAM,eAAe,MAAuB,CAAC;AAEpD;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,iBAAiB,GAAG,iBAAiB,EAAE,CAElF;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,GAAG,GAAG,GAAG,IAAI,OAAO,IAAI,GAAG,CAGnF"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The source of truth for supported UI languages in Memorize'n'Revise.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Complete list of supported languages.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export const supportedLanguges = ['en', 'ru'];
|
|
12
|
+
/**
|
|
13
|
+
* Default language.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export const defaultLanguage = supportedLanguges[0];
|
|
18
|
+
/**
|
|
19
|
+
* Get all remaining supported languages except the given one.
|
|
20
|
+
*
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export function getRemainingLanguages(lang) {
|
|
24
|
+
return supportedLanguges.filter(l => l !== lang);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Given a supported language return a path segment for this language.
|
|
28
|
+
*
|
|
29
|
+
* For the default language returns "/". For other supported languages returns "/lang/".
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export function langToPathSegment(lang) {
|
|
34
|
+
if (lang === defaultLanguage)
|
|
35
|
+
return '/';
|
|
36
|
+
return `/${lang}/`;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,IAAI,CAAU,CAAC;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;AASpD;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAuB;IAC3D,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAuB;IACvD,IAAI,IAAI,KAAK,eAAe;QAAE,OAAO,GAAG,CAAC;IACzC,OAAO,IAAI,IAAI,GAAG,CAAC;AACrB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@peassoft/mnr-langs",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "The source of truth for supported UI languages in Memorize'n'Revise",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": "./dist/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "eslint ./ && npm run tsc && vitest run",
|
|
12
|
+
"tsc": "tsc --noEmit",
|
|
13
|
+
"build": "del-cli dist && tsc -p tsconfig-build.json && api-extractor run --local --verbose"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@memnrev/eslint-v9-config": "^0.4.0",
|
|
17
|
+
"@microsoft/api-extractor": "^7.54.0",
|
|
18
|
+
"@total-typescript/ts-reset": "^0.6.1",
|
|
19
|
+
"del-cli": "^7.0.0",
|
|
20
|
+
"eslint": "^9.8.0",
|
|
21
|
+
"typescript": "^5.2.0",
|
|
22
|
+
"vitest": "^4.0.8"
|
|
23
|
+
}
|
|
24
|
+
}
|