@jsverse/transloco 7.0.0 → 7.2.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.
Files changed (116) hide show
  1. package/CHANGELOG.md +15 -8
  2. package/esm2022/lib/transloco.directive.mjs +23 -20
  3. package/esm2022/lib/transloco.providers.mjs +4 -4
  4. package/fesm2022/jsverse-transloco.mjs +25 -22
  5. package/fesm2022/jsverse-transloco.mjs.map +1 -1
  6. package/lib/transloco.directive.d.ts +5 -3
  7. package/lib/transloco.providers.d.ts +2 -2
  8. package/package.json +1 -1
  9. package/schematics/src/assets/i18n/en.json +0 -1
  10. package/schematics/src/collection.json +0 -59
  11. package/schematics/src/component/index.d.ts +0 -2
  12. package/schematics/src/component/index.js +0 -21
  13. package/schematics/src/component/index.js.map +0 -1
  14. package/schematics/src/join/index.d.ts +0 -3
  15. package/schematics/src/join/index.js +0 -79
  16. package/schematics/src/join/index.js.map +0 -1
  17. package/schematics/src/join/schema.d.ts +0 -28
  18. package/schematics/src/join/schema.js +0 -3
  19. package/schematics/src/join/schema.js.map +0 -1
  20. package/schematics/src/join/schema.json +0 -43
  21. package/schematics/src/keys-manager/index.d.ts +0 -5
  22. package/schematics/src/keys-manager/index.js +0 -97
  23. package/schematics/src/keys-manager/index.js.map +0 -1
  24. package/schematics/src/keys-manager/schema.d.ts +0 -19
  25. package/schematics/src/keys-manager/schema.js +0 -3
  26. package/schematics/src/keys-manager/schema.js.map +0 -1
  27. package/schematics/src/keys-manager/schema.json +0 -33
  28. package/schematics/src/migrate/index.d.ts +0 -3
  29. package/schematics/src/migrate/index.js +0 -21
  30. package/schematics/src/migrate/index.js.map +0 -1
  31. package/schematics/src/migrate/ngx-translate-migration.d.ts +0 -3
  32. package/schematics/src/migrate/ngx-translate-migration.js +0 -169
  33. package/schematics/src/migrate/ngx-translate-migration.js.map +0 -1
  34. package/schematics/src/migrate/schema.d.ts +0 -10
  35. package/schematics/src/migrate/schema.js +0 -3
  36. package/schematics/src/migrate/schema.js.map +0 -1
  37. package/schematics/src/migrate/schema.json +0 -23
  38. package/schematics/src/ng-add/files/transloco-loader/transloco-loader.__ts__ +0 -12
  39. package/schematics/src/ng-add/files/transloco-module/transloco-root.module.__ts__ +0 -24
  40. package/schematics/src/ng-add/generators/http-loader.gen.d.ts +0 -4
  41. package/schematics/src/ng-add/generators/http-loader.gen.js +0 -15
  42. package/schematics/src/ng-add/generators/http-loader.gen.js.map +0 -1
  43. package/schematics/src/ng-add/generators/root-module.gen.d.ts +0 -9
  44. package/schematics/src/ng-add/generators/root-module.gen.js +0 -31
  45. package/schematics/src/ng-add/generators/root-module.gen.js.map +0 -1
  46. package/schematics/src/ng-add/generators/translation-files.gen.d.ts +0 -4
  47. package/schematics/src/ng-add/generators/translation-files.gen.js +0 -23
  48. package/schematics/src/ng-add/generators/translation-files.gen.js.map +0 -1
  49. package/schematics/src/ng-add/index.d.ts +0 -3
  50. package/schematics/src/ng-add/index.js +0 -103
  51. package/schematics/src/ng-add/index.js.map +0 -1
  52. package/schematics/src/ng-add/schema.d.ts +0 -42
  53. package/schematics/src/ng-add/schema.js +0 -14
  54. package/schematics/src/ng-add/schema.js.map +0 -1
  55. package/schematics/src/ng-add/schema.json +0 -53
  56. package/schematics/src/ng-migrate/index.d.ts +0 -3
  57. package/schematics/src/ng-migrate/index.js +0 -14
  58. package/schematics/src/ng-migrate/index.js.map +0 -1
  59. package/schematics/src/ng-migrate/ng-migrate.d.ts +0 -5
  60. package/schematics/src/ng-migrate/ng-migrate.js +0 -106
  61. package/schematics/src/ng-migrate/ng-migrate.js.map +0 -1
  62. package/schematics/src/ng-migrate/schema.d.ts +0 -14
  63. package/schematics/src/ng-migrate/schema.js +0 -3
  64. package/schematics/src/ng-migrate/schema.js.map +0 -1
  65. package/schematics/src/ng-migrate/schema.json +0 -27
  66. package/schematics/src/schematics.consts.d.ts +0 -4
  67. package/schematics/src/schematics.consts.js +0 -8
  68. package/schematics/src/schematics.consts.js.map +0 -1
  69. package/schematics/src/scope/index.d.ts +0 -3
  70. package/schematics/src/scope/index.js +0 -101
  71. package/schematics/src/scope/index.js.map +0 -1
  72. package/schematics/src/scope/schema.d.ts +0 -28
  73. package/schematics/src/scope/schema.js +0 -3
  74. package/schematics/src/scope/schema.js.map +0 -1
  75. package/schematics/src/scope/schema.json +0 -84
  76. package/schematics/src/split/index.d.ts +0 -3
  77. package/schematics/src/split/index.js +0 -66
  78. package/schematics/src/split/index.js.map +0 -1
  79. package/schematics/src/split/schema.d.ts +0 -20
  80. package/schematics/src/split/schema.js +0 -3
  81. package/schematics/src/split/schema.js.map +0 -1
  82. package/schematics/src/split/schema.json +0 -35
  83. package/schematics/src/types.d.ts +0 -5
  84. package/schematics/src/types.js +0 -10
  85. package/schematics/src/types.js.map +0 -1
  86. package/schematics/src/upgrade/index.d.ts +0 -3
  87. package/schematics/src/upgrade/index.js +0 -19
  88. package/schematics/src/upgrade/index.js.map +0 -1
  89. package/schematics/src/upgrade/schema.d.ts +0 -6
  90. package/schematics/src/upgrade/schema.js +0 -3
  91. package/schematics/src/upgrade/schema.js.map +0 -1
  92. package/schematics/src/upgrade/schema.json +0 -16
  93. package/schematics/src/upgrade/v2.d.ts +0 -1
  94. package/schematics/src/upgrade/v2.js +0 -89
  95. package/schematics/src/upgrade/v2.js.map +0 -1
  96. package/schematics/src/utils/array.d.ts +0 -3
  97. package/schematics/src/utils/array.js +0 -12
  98. package/schematics/src/utils/array.js.map +0 -1
  99. package/schematics/src/utils/config.d.ts +0 -2
  100. package/schematics/src/utils/config.js +0 -13
  101. package/schematics/src/utils/config.js.map +0 -1
  102. package/schematics/src/utils/find-module.d.ts +0 -23
  103. package/schematics/src/utils/find-module.js +0 -110
  104. package/schematics/src/utils/find-module.js.map +0 -1
  105. package/schematics/src/utils/package.d.ts +0 -5
  106. package/schematics/src/utils/package.js +0 -19
  107. package/schematics/src/utils/package.js.map +0 -1
  108. package/schematics/src/utils/projects.d.ts +0 -8
  109. package/schematics/src/utils/projects.js +0 -56
  110. package/schematics/src/utils/projects.js.map +0 -1
  111. package/schematics/src/utils/translations.d.ts +0 -7
  112. package/schematics/src/utils/translations.js +0 -31
  113. package/schematics/src/utils/translations.js.map +0 -1
  114. package/schematics/src/utils/transloco.d.ts +0 -24
  115. package/schematics/src/utils/transloco.js +0 -93
  116. package/schematics/src/utils/transloco.js.map +0 -1
@@ -1,106 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.run = void 0;
4
- const kebabCase = require("lodash.kebabcase");
5
- const glob_1 = require("glob");
6
- const fs_extra_1 = require("fs-extra");
7
- const regex = /<([\w-]*)\s*(?=[^>]*i18n)[^>]*i18n(?:(?:=("|')(?<attrValue>[^>]*?)\2)|(?:-(?<propName>[\w-]*)[^>]*\4=("|')(?<propValue>[^>]*?)\5))?[^>]*(?:>(?<innerText>[^]*?)<\/\1)?/g;
8
- function run({ input, output, langs }) {
9
- const files = (0, glob_1.sync)(`${process.cwd()}/${input}/**/*.html`);
10
- let translation = {};
11
- for (const filePath of files) {
12
- const tpl = (0, fs_extra_1.readFileSync)(filePath, { encoding: 'utf-8' });
13
- translation = { ...translation, ...getTranslation(tpl) };
14
- const newTpl = getNewTemplate(tpl);
15
- (0, fs_extra_1.outputFileSync)(filePath, newTpl);
16
- }
17
- for (const lang of langs) {
18
- const sorted = Object.keys(translation)
19
- .sort()
20
- .reduce((acc, key) => {
21
- acc[key] = translation[key];
22
- return acc;
23
- }, {});
24
- (0, fs_extra_1.outputJsonSync)(`${process.cwd()}/${output}/${lang}.json`, sorted, {
25
- spaces: 2,
26
- });
27
- }
28
- console.log('\n 🌵 Done! 🌵');
29
- console.log('Welcome to a better translation experience 🌐');
30
- console.log('\nFor more information about this script please visit 👉 https://jsverse.github.io/transloco/docs/migration/angular\n');
31
- }
32
- exports.run = run;
33
- function resolveKey(attrValue, value) {
34
- let key = value;
35
- if (!attrValue) {
36
- return kebabCase(value);
37
- }
38
- if (attrValue) {
39
- const splitCustomId = attrValue.split('@@');
40
- const hasCustomId = splitCustomId.length === 2;
41
- key = hasCustomId ? splitCustomId[1] : key;
42
- }
43
- key = kebabCase(key);
44
- return key;
45
- }
46
- function getTranslation(template) {
47
- let result = regex.exec(template);
48
- const translation = {};
49
- while (result) {
50
- const { attrValue, innerText, propValue } = result.groups;
51
- let context;
52
- let comment;
53
- let keyValue = propValue ? propValue : innerText;
54
- let key = keyValue;
55
- if (attrValue) {
56
- const splitCustomId = attrValue.split('@@');
57
- const hasCustomId = splitCustomId.length === 2;
58
- key = hasCustomId ? splitCustomId[1] : key;
59
- const splitContextDescription = attrValue.split('|');
60
- // we have context
61
- if (splitContextDescription.length === 2) {
62
- context = splitContextDescription[0];
63
- comment = splitContextDescription[1].split('@@')[0];
64
- }
65
- else {
66
- if (splitContextDescription[0].startsWith('@@') === false) {
67
- comment = attrValue.split('@@')[0];
68
- }
69
- }
70
- }
71
- key = kebabCase(key);
72
- keyValue = keyValue.trim().replace(/(\r\n|\n|\r)/gm, '');
73
- if (context) {
74
- translation[context] = translation[context] || {};
75
- translation[context][key] = keyValue;
76
- if (comment) {
77
- translation[context][`${key}.comment`] = comment;
78
- }
79
- }
80
- else {
81
- translation[key] = keyValue;
82
- if (comment) {
83
- translation[`${key}.comment`] = comment;
84
- }
85
- }
86
- result = regex.exec(template);
87
- }
88
- return translation;
89
- }
90
- function getNewTemplate(template) {
91
- return template.replace(regex, function (match, tag, mark, attrValue, propName, propMark, propValue, innerText) {
92
- let replace = ' i18n';
93
- const key = resolveKey(attrValue, propValue || innerText);
94
- let value = innerText;
95
- const newValue = `{{ '${key}' | transloco }}`;
96
- if (attrValue) {
97
- replace = ` i18n=${mark}${attrValue}${mark}`;
98
- }
99
- if (propName) {
100
- replace = ` i18n-${propName}`;
101
- value = propValue;
102
- }
103
- return match.replace(replace, '').replace(value, newValue);
104
- });
105
- }
106
- //# sourceMappingURL=ng-migrate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ng-migrate.js","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AO,QAAQ,CAAC,OAAO,CACrB,KAAK,EACL,UACE,KAAK,EACL,GAAG,EACH,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAS;QAET,IAAI,OAAO,GAAG,OAAO,CAAC;QACtB,MAAM,GAAG,GAAG,UAAU,CAAC,SAAS,EAAE,SAAS,IAAI,SAAS,CAAC,CAAC;QAC1D,IAAI,KAAK,GAAG,SAAS,CAAC;QACtB,MAAM,QAAQ,GAAG,OAAO,GAAG,kBAAkB,CAAC;QAE9C,IAAI,SAAS,EAAE;YACb,OAAO,GAAG,SAAS,IAAI,GAAG,SAAS,GAAG,IAAI,EAAE,CAAC;SAC9C;QAED,IAAI,QAAQ,EAAE;YACZ,OAAO,GAAG,SAAS,QAAQ,EAAE,CAAC;YAC9B,KAAK,GAAG,SAAS,CAAC;SACnB;QAED,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC7D,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -1,14 +0,0 @@
1
- export interface SchemaOptions {
2
- /**
3
- * The path to the source root directory.
4
- */
5
- path: string;
6
- /**
7
- * The location of the translation files.
8
- */
9
- translationFilesPath: string;
10
- /**
11
- * The languages of the project.
12
- */
13
- langs: string;
14
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../libs/transloco-schematics/src/ng-migrate/schema.ts"],"names":[],"mappings":""}
@@ -1,27 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "transloco-ng-migrate",
4
- "title": "Run a migration script from Angular i18n",
5
- "type": "object",
6
- "properties": {
7
- "langs": {
8
- "description": "The languages of the project.",
9
- "x-prompt": "Which languages do you use?",
10
- "type": "string",
11
- "default": "en, es"
12
- },
13
- "translationFilesPath": {
14
- "description": "The location of the translation files.",
15
- "x-prompt": "Which folder will contain the translation files?",
16
- "type": "string",
17
- "default": "src/assets/i18n"
18
- },
19
- "path": {
20
- "description": "The path to the source root directory.",
21
- "x-prompt": "Which folder will contain the translation files?",
22
- "type": "string",
23
- "default": "./src/app"
24
- }
25
- },
26
- "required": []
27
- }
@@ -1,4 +0,0 @@
1
- export declare const PROJECT_NAME = "transloco";
2
- export declare const NPM_SCOPE = "@jsverse";
3
- export declare const LIB_NAME = "@jsverse/transloco";
4
- export declare const CONFIG_FILE = "transloco.config.js";
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CONFIG_FILE = exports.LIB_NAME = exports.NPM_SCOPE = exports.PROJECT_NAME = void 0;
4
- exports.PROJECT_NAME = 'transloco';
5
- exports.NPM_SCOPE = '@jsverse';
6
- exports.LIB_NAME = `${exports.NPM_SCOPE}/transloco`;
7
- exports.CONFIG_FILE = 'transloco.config.js';
8
- //# sourceMappingURL=schematics.consts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schematics.consts.js","sourceRoot":"","sources":["../../../../../libs/transloco-schematics/src/schematics.consts.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG,WAAW,CAAC;AAC3B,QAAA,SAAS,GAAG,UAAU,CAAC;AACvB,QAAA,QAAQ,GAAG,GAAG,iBAAS,YAAY,CAAC;AACpC,QAAA,WAAW,GAAG,qBAAqB,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { SchemaOptions } from './schema';
3
- export default function (options: SchemaOptions): Rule;
@@ -1,101 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const node_path_1 = require("node:path");
4
- const strings_1 = require("@angular-devkit/core/src/utils/strings");
5
- const schematics_1 = require("@angular-devkit/schematics");
6
- const typescript_1 = require("typescript");
7
- const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
8
- const util_1 = require("@schematics/angular/utility/standalone/util");
9
- const schematics_consts_1 = require("../schematics.consts");
10
- const array_1 = require("../utils/array");
11
- const find_module_1 = require("../utils/find-module");
12
- const projects_1 = require("../utils/projects");
13
- const translations_1 = require("../utils/translations");
14
- const config_1 = require("../utils/config");
15
- function getProviderValue(options) {
16
- const name = (0, strings_1.dasherize)(options.name);
17
- if (!options.inlineLoader)
18
- return `'${name}'`;
19
- return `{ scope: '${name}', loader }`;
20
- }
21
- function addScopeToModule(tree, modulePath, options) {
22
- const module = tree.read(modulePath);
23
- const moduleSource = (0, typescript_1.createSourceFile)(modulePath, module.toString('utf-8'), typescript_1.ScriptTarget.Latest, true);
24
- const provider = `provideTranslocoScope(${getProviderValue(options)})`;
25
- const changes = [];
26
- changes.push((0, ast_utils_1.addProviderToModule)(moduleSource, modulePath, provider, schematics_consts_1.LIB_NAME)[0]);
27
- changes.push((0, ast_utils_1.addImportToModule)(moduleSource, modulePath, 'TranslocoModule', schematics_consts_1.LIB_NAME)[0]);
28
- changes.push((0, ast_utils_1.insertImport)(moduleSource, modulePath, 'provideTranslocoScope, TranslocoModule', schematics_consts_1.LIB_NAME));
29
- if (options.inlineLoader) {
30
- changes.push((0, ast_utils_1.insertImport)(moduleSource, modulePath, 'loader', './transloco.loader'));
31
- }
32
- (0, util_1.applyChangesToFile)(tree, modulePath, changes);
33
- }
34
- function getTranslationFilesFromAssets(host, translationsPath) {
35
- const langFiles = host.root.dir(translationsPath).subfiles;
36
- return Array.from(new Set(langFiles.map((file) => file.split('.')[0])));
37
- }
38
- function getTranslationFiles(options, host, translationsPath) {
39
- return (options.langs ||
40
- (0, config_1.getConfig)().langs ||
41
- getTranslationFilesFromAssets(host, translationsPath));
42
- }
43
- function addInlineLoader(tree, modulePath, name, langs) {
44
- const loader = `export const loader = [${(0, array_1.stringifyList)((0, array_1.coerceArray)(langs))}].reduce((acc: any, lang: string) => {
45
- acc[lang] = () => import(\`./i18n/\${lang}.json\`);
46
- return acc;
47
- }, {});
48
-
49
- `;
50
- const path = (0, node_path_1.join)((0, node_path_1.dirname)(modulePath), 'transloco.loader.ts');
51
- tree.create(path, loader);
52
- }
53
- function createTranslationFiles(options, rootPath, modulePath, host) {
54
- if (options.skipCreation) {
55
- return (0, schematics_1.empty)();
56
- }
57
- const defaultPath = options.inlineLoader
58
- ? (0, node_path_1.join)((0, node_path_1.dirname)(modulePath), 'i18n')
59
- : (0, node_path_1.join)(rootPath, 'assets', 'i18n', (0, strings_1.dasherize)(options.name));
60
- const translationsPath = options.translationPath
61
- ? (0, node_path_1.join)(rootPath, options.translationPath)
62
- : defaultPath;
63
- return (0, translations_1.createTranslateFilesFromOptions)(host, options, translationsPath);
64
- }
65
- function extractModuleOptions({ path, project, routing, flat, commonModule, }) {
66
- return { path, project, routing, flat, commonModule };
67
- }
68
- function default_1(options) {
69
- return (host, context) => {
70
- const project = (0, projects_1.getProject)(host, options.project);
71
- const rootPath = project?.sourceRoot ?? 'src';
72
- const assetsPath = (0, node_path_1.join)(rootPath, 'assets', 'i18n');
73
- options.langs = getTranslationFiles(options, host, assetsPath);
74
- if (options.module) {
75
- const projectPath = (0, projects_1.getProjectPath)(host, project, options);
76
- const modulePath = (0, find_module_1.findModuleFromOptions)(host, options, projectPath);
77
- if (options.inlineLoader) {
78
- addInlineLoader(host, modulePath, options.name, options.langs);
79
- }
80
- if (modulePath) {
81
- addScopeToModule(host, modulePath, options);
82
- return (0, schematics_1.mergeWith)(createTranslationFiles(options, rootPath, modulePath, host))(host, context);
83
- }
84
- }
85
- return (0, schematics_1.chain)([
86
- (0, schematics_1.externalSchematic)('@schematics/angular', 'module', extractModuleOptions(options)),
87
- (tree) => {
88
- const modulePath = tree.actions.find((action) => !!action.path.match(/\.module\.ts/) &&
89
- !action.path.match(/-routing\.module\.ts/)).path;
90
- addScopeToModule(tree, modulePath, options);
91
- if (options.inlineLoader) {
92
- addInlineLoader(tree, modulePath, options.name, options.langs);
93
- }
94
- const translationRule = createTranslationFiles(options, rootPath, modulePath, host);
95
- return (0, schematics_1.mergeWith)(translationRule);
96
- },
97
- ]);
98
- };
99
- }
100
- exports.default = default_1;
101
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/transloco-schematics/src/scope/index.ts"],"names":[],"mappings":";;AAAA,yCAA0C;AAE1C,oEAAmE;AACnE,2DAQoC;AACpC,2CAA4D;AAC5D,qEAI+C;AAC/C,sEAAiF;AAGjF,4DAAgD;AAChD,0CAA4D;AAC5D,sDAA6D;AAC7D,gDAA+D;AAC/D,wDAAwE;AACxE,4CAA4C;AAI5C,SAAS,gBAAgB,CAAC,OAAsB;IAC9C,MAAM,IAAI,GAAG,IAAA,mBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,OAAO,CAAC,YAAY;QAAE,OAAO,IAAI,IAAI,GAAG,CAAC;IAC9C,OAAO,aAAa,IAAI,aAAa,CAAC;AACxC,CAAC;AAED,SAAS,gBAAgB,CACvB,IAAU,EACV,UAAkB,EAClB,OAAsB;IAEtB,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAErC,MAAM,YAAY,GAAG,IAAA,6BAAgB,EACnC,UAAU,EACV,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EACxB,yBAAY,CAAC,MAAM,EACnB,IAAI,CACL,CAAC;IACF,MAAM,QAAQ,GAAG,yBAAyB,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC;IACvE,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,OAAO,CAAC,IAAI,CACV,IAAA,+BAAmB,EAAC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,4BAAQ,CAAC,CAAC,CAAC,CAAC,CACrE,CAAC;IACF,OAAO,CAAC,IAAI,CACV,IAAA,6BAAiB,EAAC,YAAY,EAAE,UAA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gBACD,MAAM,eAAe,GAAG,sBAAsB,CAC5C,OAAO,EACP,QAAQ,EACR,UAAU,EACV,IAAI,CACL,CAAC;gBAEF,OAAO,IAAA,sBAAS,EAAC,eAAe,CAAC,CAAC;YACpC,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AA/CD,4BA+CC"}
@@ -1,28 +0,0 @@
1
- import { Schema } from '@schematics/angular/module/schema';
2
- export interface SchemaOptions extends Schema {
3
- name: string;
4
- /**
5
- * The languages of the project.
6
- */
7
- langs: string | string[];
8
- /**
9
- * Skip the creation of the translation files.
10
- */
11
- skipCreation: boolean;
12
- /**
13
- * The path of the translation files.
14
- */
15
- translationPath: string;
16
- /**
17
- * Specification of the declaring module..
18
- */
19
- module: string;
20
- /**
21
- * The root project name.
22
- */
23
- project: string;
24
- /**
25
- * Should create scope with inline loader.
26
- */
27
- inlineLoader: boolean;
28
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../libs/transloco-schematics/src/scope/schema.ts"],"names":[],"mappings":""}
@@ -1,84 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "transloco-scope",
4
- "title": "Add new transloco scope module, along with translation files.",
5
- "type": "object",
6
- "properties": {
7
- "name": {
8
- "type": "string",
9
- "description": "The scope name.",
10
- "$default": {
11
- "$source": "argv",
12
- "index": 0
13
- },
14
- "x-prompt": "What scope name would you like?"
15
- },
16
- "module": {
17
- "type": "string",
18
- "description": "The path at which module to add scope to, relative to the workspace root."
19
- },
20
- "inlineLoader": {
21
- "description": "Should create scope with inline loader.",
22
- "type": "boolean",
23
- "alias": "il"
24
- },
25
- "langs": {
26
- "description": "The languages of the project.",
27
- "type": "string",
28
- "alias": "la"
29
- },
30
- "skipCreation": {
31
- "type": "boolean",
32
- "description": "Skip the translation files creation."
33
- },
34
- "translationPath": {
35
- "description": "The to the translation files, relative to the project's root.",
36
- "type": "string"
37
- },
38
- "lintFix": {
39
- "type": "boolean",
40
- "default": false,
41
- "description": "When true, applies lint fixes after generating the module."
42
- },
43
-
44
- "path": {
45
- "type": "string",
46
- "format": "path",
47
- "$default": {
48
- "$source": "workingDirectory"
49
- },
50
- "description": "The path at which to create the NgModule, relative to the workspace root.",
51
- "visible": false
52
- },
53
- "project": {
54
- "type": "string",
55
- "description": "The name of the project.",
56
- "$default": {
57
- "$source": "projectName"
58
- }
59
- },
60
- "routing": {
61
- "type": "boolean",
62
- "description": "Create a routing module.",
63
- "default": false
64
- },
65
- "routingScope": {
66
- "enum": ["Child", "Root"],
67
- "type": "string",
68
- "description": "The scope for the new routing module.",
69
- "default": "Child"
70
- },
71
- "flat": {
72
- "type": "boolean",
73
- "description": "Create the new files at the top level of the current project root. ",
74
- "default": false
75
- },
76
- "commonModule": {
77
- "type": "boolean",
78
- "description": "The new NgModule imports \"CommonModule\". ",
79
- "default": true,
80
- "visible": false
81
- }
82
- },
83
- "required": []
84
- }
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { SchemaOptions } from './schema';
3
- export default function (options: SchemaOptions): Rule;
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const types_1 = require("../types");
4
- const transloco_1 = require("../utils/transloco");
5
- function reduceTranslations(host, dirPath, translationJson, lang, key = '') {
6
- const dir = host.getDir(dirPath);
7
- if (!(0, transloco_1.hasFiles)(dir))
8
- return translationJson;
9
- if ((0, transloco_1.hasSubdirs)(dir)) {
10
- dir.subdirs.forEach((subDirName) => {
11
- const subDir = dir.dir(subDirName);
12
- const nestedKeyPath = (0, transloco_1.getTranslationKey)(key, subDirName);
13
- const nestedKey = nestedKeyPath.split('.').at(-1);
14
- const subTranslationJson = translationJson[key];
15
- if (subTranslationJson) {
16
- reduceTranslations(host, subDir.path, subTranslationJson, lang, nestedKey);
17
- delete translationJson[key][nestedKey];
18
- }
19
- });
20
- }
21
- dir.subfiles
22
- .filter((fileName) => fileName.includes(`${lang}.json`))
23
- .forEach((fileName) => {
24
- if (!translationJson[key]) {
25
- return translationJson;
26
- }
27
- (0, transloco_1.setFileContent)(host, dir.path, fileName, translationJson[key]);
28
- });
29
- delete translationJson[key];
30
- return translationJson;
31
- }
32
- function parserFactory(format) {
33
- switch (format) {
34
- case types_1.TranslationFileFormat.JSON:
35
- return JSON.parse;
36
- case types_1.TranslationFileFormat.PO:
37
- // TODO:
38
- return JSON.parse;
39
- case types_1.TranslationFileFormat.XLIFF:
40
- // TODO:
41
- return JSON.parse;
42
- default:
43
- return JSON.parse;
44
- }
45
- }
46
- function default_1(options) {
47
- return (host) => {
48
- const root = (0, transloco_1.getTranslationsRoot)(host, options);
49
- const parser = parserFactory(options.format);
50
- const translatedFiles = (0, transloco_1.getTranslationFiles)(host, options.source, parser);
51
- const translationEntryPaths = (0, transloco_1.getTranslationEntryPaths)(host, root);
52
- const newTranslation = {};
53
- for (const { lang, translation } of translatedFiles) {
54
- newTranslation[lang] = translationEntryPaths.reduce((acc, { scope, path }) => {
55
- return reduceTranslations(host, path, translation, lang, scope);
56
- }, translation);
57
- }
58
- host.getDir(root).subfiles.forEach((fileName) => {
59
- const lang = fileName.split('.')[0];
60
- (0, transloco_1.setFileContent)(host, root, fileName, newTranslation[lang]);
61
- });
62
- return host;
63
- };
64
- }
65
- exports.default = default_1;
66
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/transloco-schematics/src/split/index.ts"],"names":[],"mappings":";;AAEA,oCAAiD;AACjD,kDAQ4B;AAM5B,SAAS,kBAAkB,CACzB,IAAU,EACV,OAAe,EACf,eAAe,EACf,IAAY,EACZ,GAAG,GAAG,EAAE;IAER,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC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Ac,EAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAzBD,4BAyBC"}
@@ -1,20 +0,0 @@
1
- import { Schema } from '@schematics/angular/module/schema';
2
- import { TranslationFileFormat } from '../types';
3
- export interface SchemaOptions extends Schema {
4
- /**
5
- * The folder that contain the root translation files.
6
- */
7
- translationPath: string;
8
- /**
9
- * The translated files format.
10
- */
11
- format: TranslationFileFormat;
12
- /**
13
- * The source directory that contain the translated files.
14
- */
15
- source: string;
16
- /**
17
- * The root project name.
18
- */
19
- project: string;
20
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../libs/transloco-schematics/src/split/schema.ts"],"names":[],"mappings":""}
@@ -1,35 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "transloco-split",
4
- "title": "Split translated files between the project's translation files.",
5
- "type": "object",
6
- "properties": {
7
- "translationPath": {
8
- "type": "string",
9
- "description": "The folder that contain the root translation files.",
10
- "default": "src/assets/i18n",
11
- "alias": "root"
12
- },
13
- "source": {
14
- "type": "string",
15
- "description": "The path of the source directory that contain the translated files.",
16
- "default": "dist-i18n",
17
- "alias": "o"
18
- },
19
- "format": {
20
- "description": "The translated files format.",
21
- "type": "string",
22
- "default": "JSON",
23
- "enum": ["JSON", "xliff", "po"],
24
- "alias": "f"
25
- },
26
- "project": {
27
- "type": "string",
28
- "description": "The root project name.",
29
- "$default": {
30
- "$source": "projectName"
31
- }
32
- }
33
- },
34
- "required": []
35
- }
@@ -1,5 +0,0 @@
1
- export declare enum TranslationFileFormat {
2
- JSON = "JSON",
3
- XLIFF = "xliff",
4
- PO = "po"
5
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TranslationFileFormat = void 0;
4
- var TranslationFileFormat;
5
- (function (TranslationFileFormat) {
6
- TranslationFileFormat["JSON"] = "JSON";
7
- TranslationFileFormat["XLIFF"] = "xliff";
8
- TranslationFileFormat["PO"] = "po";
9
- })(TranslationFileFormat || (exports.TranslationFileFormat = TranslationFileFormat = {}));
10
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../libs/transloco-schematics/src/types.ts"],"names":[],"mappings":";;;AAAA,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,wCAAe,CAAA;IACf,kCAAS,CAAA;AACX,CAAC,EAJW,qBAAqB,qCAArB,qBAAqB,QAIhC"}
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { SchemaOptions } from './schema';
3
- export default function (options: SchemaOptions): Rule;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const process_1 = require("process");
4
- const schematics_1 = require("@angular-devkit/schematics");
5
- const v2_1 = require("./v2");
6
- function default_1(options) {
7
- return () => {
8
- if (!options.path) {
9
- throw new schematics_1.SchematicsException(`
10
- Please specify the root source of your project.
11
- (e.g. --path ./src/app)
12
- `);
13
- }
14
- (0, v2_1.run)(options.path);
15
- (0, process_1.exit)();
16
- };
17
- }
18
- exports.default = default_1;
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/transloco-schematics/src/upgrade/index.ts"],"names":[],"mappings":";;AAAA,qCAA+B;AAE/B,2DAAuE;AAGvE,6BAA2B;AAE3B,mBAAyB,OAAsB;IAC7C,OAAO,GAAG,EAAE;QACV,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;YACjB,MAAM,IAAI,gCAAmB,CAAC;;;OAG7B,CAAC,CAAC;SACJ;QAED,IAAA,QAAG,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAClB,IAAA,cAAI,GAAE,CAAC;IACT,CAAC,CAAC;AACJ,CAAC;AAZD,4BAYC"}
@@ -1,6 +0,0 @@
1
- export interface SchemaOptions {
2
- /**
3
- * The entry path of the upgrade script.
4
- */
5
- path: string;
6
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../libs/transloco-schematics/src/upgrade/schema.ts"],"names":[],"mappings":""}