@o3r/transloco 0.0.0 → 14.4.0-rc.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 (122) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +64 -0
  3. package/builders/helpers/localization-generator.d.ts +126 -0
  4. package/builders/helpers/localization-generator.d.ts.map +1 -0
  5. package/builders/helpers/localization-generator.js +303 -0
  6. package/builders/helpers/localization-generator.js.map +1 -0
  7. package/builders/i18n/index.d.ts +7 -0
  8. package/builders/i18n/index.d.ts.map +1 -0
  9. package/builders/i18n/index.js +39 -0
  10. package/builders/i18n/index.js.map +1 -0
  11. package/builders/i18n/schema.d.ts +30 -0
  12. package/builders/i18n/schema.d.ts.map +1 -0
  13. package/builders/i18n/schema.js +3 -0
  14. package/builders/i18n/schema.js.map +1 -0
  15. package/builders/i18n/schema.json +35 -0
  16. package/builders/localization/index.d.ts +23 -0
  17. package/builders/localization/index.d.ts.map +1 -0
  18. package/builders/localization/index.js +416 -0
  19. package/builders/localization/index.js.map +1 -0
  20. package/builders/localization/schema.d.ts +29 -0
  21. package/builders/localization/schema.d.ts.map +1 -0
  22. package/builders/localization/schema.js +3 -0
  23. package/builders/localization/schema.js.map +1 -0
  24. package/builders/localization/schema.json +78 -0
  25. package/builders/localization-extractor/index.d.ts +8 -0
  26. package/builders/localization-extractor/index.d.ts.map +1 -0
  27. package/builders/localization-extractor/index.js +181 -0
  28. package/builders/localization-extractor/index.js.map +1 -0
  29. package/builders/localization-extractor/schema.d.ts +25 -0
  30. package/builders/localization-extractor/schema.d.ts.map +1 -0
  31. package/builders/localization-extractor/schema.js +3 -0
  32. package/builders/localization-extractor/schema.js.map +1 -0
  33. package/builders/localization-extractor/schema.json +62 -0
  34. package/builders/localization-extractor/validations.d.ts +17 -0
  35. package/builders/localization-extractor/validations.d.ts.map +1 -0
  36. package/builders/localization-extractor/validations.js +54 -0
  37. package/builders/localization-extractor/validations.js.map +1 -0
  38. package/builders/metadata-check/helpers/index.d.ts +2 -0
  39. package/builders/metadata-check/helpers/index.d.ts.map +1 -0
  40. package/builders/metadata-check/helpers/index.js +5 -0
  41. package/builders/metadata-check/helpers/index.js.map +1 -0
  42. package/builders/metadata-check/helpers/localization-metadata-comparison-helper.d.ts +14 -0
  43. package/builders/metadata-check/helpers/localization-metadata-comparison-helper.d.ts.map +1 -0
  44. package/builders/metadata-check/helpers/localization-metadata-comparison-helper.js +34 -0
  45. package/builders/metadata-check/helpers/localization-metadata-comparison-helper.js.map +1 -0
  46. package/builders/metadata-check/index.d.ts +7 -0
  47. package/builders/metadata-check/index.d.ts.map +1 -0
  48. package/builders/metadata-check/index.js +12 -0
  49. package/builders/metadata-check/index.js.map +1 -0
  50. package/builders/metadata-check/schema.d.ts +5 -0
  51. package/builders/metadata-check/schema.d.ts.map +1 -0
  52. package/builders/metadata-check/schema.js +3 -0
  53. package/builders/metadata-check/schema.js.map +1 -0
  54. package/builders/metadata-check/schema.json +46 -0
  55. package/builders/package.json +3 -0
  56. package/builders.json +25 -0
  57. package/collection.json +29 -0
  58. package/fesm2022/o3r-transloco-rules-engine.mjs +57 -0
  59. package/fesm2022/o3r-transloco-rules-engine.mjs.map +1 -0
  60. package/fesm2022/o3r-transloco.mjs +1177 -0
  61. package/fesm2022/o3r-transloco.mjs.map +1 -0
  62. package/package.json +190 -2
  63. package/rules-engine/package.json +4 -0
  64. package/schemas/localization.metadata.schema.json +84 -0
  65. package/schemas/localization.schema.json +116 -0
  66. package/schemas/rules-engine.localization-action.schema.json +26 -0
  67. package/schematics/add-localization-key/index.d.ts +13 -0
  68. package/schematics/add-localization-key/index.d.ts.map +1 -0
  69. package/schematics/add-localization-key/index.js +227 -0
  70. package/schematics/add-localization-key/index.js.map +1 -0
  71. package/schematics/add-localization-key/schema.d.ts +20 -0
  72. package/schematics/add-localization-key/schema.d.ts.map +1 -0
  73. package/schematics/add-localization-key/schema.js +3 -0
  74. package/schematics/add-localization-key/schema.js.map +1 -0
  75. package/schematics/add-localization-key/schema.json +49 -0
  76. package/schematics/cms-adapter/index.d.ts +8 -0
  77. package/schematics/cms-adapter/index.d.ts.map +1 -0
  78. package/schematics/cms-adapter/index.js +81 -0
  79. package/schematics/cms-adapter/index.js.map +1 -0
  80. package/schematics/localization-base/index.d.ts +14 -0
  81. package/schematics/localization-base/index.d.ts.map +1 -0
  82. package/schematics/localization-base/index.js +359 -0
  83. package/schematics/localization-base/index.js.map +1 -0
  84. package/schematics/localization-base/templates/src/assets/locales/__empty__.gitkeep +0 -0
  85. package/schematics/localization-to-component/index.d.ts +13 -0
  86. package/schematics/localization-to-component/index.d.ts.map +1 -0
  87. package/schematics/localization-to-component/index.js +264 -0
  88. package/schematics/localization-to-component/index.js.map +1 -0
  89. package/schematics/localization-to-component/schema.d.ts +12 -0
  90. package/schematics/localization-to-component/schema.d.ts.map +1 -0
  91. package/schematics/localization-to-component/schema.js +3 -0
  92. package/schematics/localization-to-component/schema.js.map +1 -0
  93. package/schematics/localization-to-component/schema.json +31 -0
  94. package/schematics/localization-to-component/templates/__name__-localization.json +3 -0
  95. package/schematics/localization-to-component/templates/__name__-translation.ts.template +5 -0
  96. package/schematics/migration-localization-to-transloco/index.d.ts +8 -0
  97. package/schematics/migration-localization-to-transloco/index.d.ts.map +1 -0
  98. package/schematics/migration-localization-to-transloco/index.js +194 -0
  99. package/schematics/migration-localization-to-transloco/index.js.map +1 -0
  100. package/schematics/migration-localization-to-transloco/schema.d.ts +15 -0
  101. package/schematics/migration-localization-to-transloco/schema.d.ts.map +1 -0
  102. package/schematics/migration-localization-to-transloco/schema.js +3 -0
  103. package/schematics/migration-localization-to-transloco/schema.js.map +1 -0
  104. package/schematics/migration-localization-to-transloco/schema.json +30 -0
  105. package/schematics/ng-add/helpers/devtools-registration.d.ts +8 -0
  106. package/schematics/ng-add/helpers/devtools-registration.d.ts.map +1 -0
  107. package/schematics/ng-add/helpers/devtools-registration.js +37 -0
  108. package/schematics/ng-add/helpers/devtools-registration.js.map +1 -0
  109. package/schematics/ng-add/index.d.ts +8 -0
  110. package/schematics/ng-add/index.d.ts.map +1 -0
  111. package/schematics/ng-add/index.js +62 -0
  112. package/schematics/ng-add/index.js.map +1 -0
  113. package/schematics/ng-add/schema.d.ts +11 -0
  114. package/schematics/ng-add/schema.d.ts.map +1 -0
  115. package/schematics/ng-add/schema.js +3 -0
  116. package/schematics/ng-add/schema.js.map +1 -0
  117. package/schematics/ng-add/schema.json +38 -0
  118. package/schematics/package.json +3 -0
  119. package/types/o3r-transloco-rules-engine.d.ts +40 -0
  120. package/types/o3r-transloco-rules-engine.d.ts.map +1 -0
  121. package/types/o3r-transloco.d.ts +804 -0
  122. package/types/o3r-transloco.d.ts.map +1 -0
@@ -0,0 +1,13 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import type { NgAddLocalizationKeySchematicsSchema } from './schema';
3
+ /**
4
+ * Add localization key to an existing component
5
+ * @param options
6
+ */
7
+ export declare function ngAddLocalizationKeyFn(options: NgAddLocalizationKeySchematicsSchema): Rule;
8
+ /**
9
+ * Add localization key to an existing component
10
+ * @param options
11
+ */
12
+ export declare const ngAddLocalizationKey: (options: any) => Rule;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/add-localization-key/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAIL,IAAI,EAIL,MAAM,4BAA4B,CAAC;AAYpC,OAAO,KAAK,EACV,oCAAoC,EACrC,MAAM,UAAU,CAAC;AA0GlB;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,oCAAoC,GAAG,IAAI,CAsM1F;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,wBAA+C,CAAC"}
@@ -0,0 +1,227 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ngAddLocalizationKey = void 0;
4
+ exports.ngAddLocalizationKeyFn = ngAddLocalizationKeyFn;
5
+ const node_path_1 = require("node:path");
6
+ const prompt_1 = require("@angular/cli/src/utilities/prompt");
7
+ const strings_1 = require("@angular-devkit/core/src/utils/strings");
8
+ const schematics_1 = require("@angular-devkit/schematics");
9
+ const schematics_2 = require("@o3r/schematics");
10
+ const ts = require("typescript");
11
+ /**
12
+ * Error thrown when a component does not have localization architecture
13
+ */
14
+ class NoLocalizationArchitectureError extends Error {
15
+ constructor(componentPath) {
16
+ super(`This component is not localized. If you want to localize this component you can run the following command:\nng g @o3r/transloco:localization-to-component --path="${componentPath}"`);
17
+ }
18
+ }
19
+ /**
20
+ * Error thrown when a localization key already exists
21
+ */
22
+ class KeyAlreadyExistsError extends Error {
23
+ constructor(key, file) {
24
+ super(`There is already a key named ${key} in ${file}.`);
25
+ }
26
+ }
27
+ /**
28
+ * Retrieves localization information from a component
29
+ * @param componentPath Path to the component file
30
+ * @param tree Schematic tree
31
+ * @returns Localization information including paths and variable names
32
+ */
33
+ const getLocalizationInformation = (componentPath, tree) => {
34
+ const componentSourceFile = ts.createSourceFile(componentPath, tree.readText(componentPath), ts.ScriptTarget.ES2015, true);
35
+ const o3rClass = componentSourceFile.statements.find((statement) => ts.isClassDeclaration(statement) && (0, schematics_2.isO3rClassComponent)(statement));
36
+ let localizationJsonPath;
37
+ let defaultTranslationVariableName;
38
+ let translationsVariableName;
39
+ let translationsVariableType;
40
+ o3rClass.members.forEach((member) => {
41
+ if (ts.isPropertyDeclaration(member) && ts.isIdentifier(member.name) && member.type && ts.isTypeReferenceNode(member.type) && ts.isIdentifier(member.type.typeName)) {
42
+ const decorators = [...(ts.getDecorators(member) || [])];
43
+ const localizationDecorator = decorators.find((decorator) => ts.isCallExpression(decorator.expression)
44
+ && ts.isIdentifier(decorator.expression.expression)
45
+ && decorator.expression.expression.escapedText.toString() === 'Localization'
46
+ && ts.isStringLiteral(decorator.expression.arguments[0]));
47
+ if (localizationDecorator) {
48
+ localizationJsonPath = node_path_1.posix.join((0, node_path_1.dirname)(componentPath), localizationDecorator.expression.arguments[0].text);
49
+ translationsVariableName = member.name.escapedText.toString();
50
+ translationsVariableType = member.type.typeName.escapedText.toString();
51
+ if (member.initializer && ts.isIdentifier(member.initializer)) {
52
+ defaultTranslationVariableName = member.initializer.escapedText.toString();
53
+ }
54
+ }
55
+ }
56
+ });
57
+ if (!localizationJsonPath || !tree.exists(localizationJsonPath)) {
58
+ throw new NoLocalizationArchitectureError(componentPath);
59
+ }
60
+ if (!defaultTranslationVariableName) {
61
+ const constructor = o3rClass.members.find((member) => ts.isConstructorDeclaration(member));
62
+ if (constructor?.body) {
63
+ constructor.body.statements.forEach((statement) => {
64
+ if (ts.isExpressionStatement(statement)
65
+ && ts.isBinaryExpression(statement.expression)
66
+ && ts.isPropertyAccessExpression(statement.expression.left)
67
+ && statement.expression.left.name.escapedText.toString() === translationsVariableName
68
+ && ts.isIdentifier(statement.expression.right)) {
69
+ defaultTranslationVariableName = statement.expression.right.escapedText.toString();
70
+ }
71
+ });
72
+ }
73
+ }
74
+ if (!defaultTranslationVariableName) {
75
+ throw new schematics_2.O3rCliError(`Unable to find initialization of ${translationsVariableName} in ${componentPath}.`);
76
+ }
77
+ const importDeclaration = componentSourceFile.statements.find((statement) => ts.isImportDeclaration(statement)
78
+ && ts.isStringLiteral(statement.moduleSpecifier)
79
+ && !!statement.importClause
80
+ && !!statement.importClause.namedBindings
81
+ && ts.isNamedImports(statement.importClause.namedBindings)
82
+ && statement.importClause.namedBindings.elements.some((element) => ts.isIdentifier(element.name) && element.name.escapedText.toString() === defaultTranslationVariableName));
83
+ if (!importDeclaration) {
84
+ throw new schematics_2.O3rCliError(`Unable to find import declaration of ${defaultTranslationVariableName} in ${componentPath}`);
85
+ }
86
+ const translationsPath = node_path_1.posix.join((0, node_path_1.dirname)(componentPath), `${importDeclaration.moduleSpecifier.text}.ts`);
87
+ return {
88
+ localizationJsonPath,
89
+ translationsPath,
90
+ translationsVariableType
91
+ };
92
+ };
93
+ /**
94
+ * Add localization key to an existing component
95
+ * @param options
96
+ */
97
+ function ngAddLocalizationKeyFn(options) {
98
+ return async (tree, context) => {
99
+ try {
100
+ const { selector, templateRelativePath } = (0, schematics_2.getO3rComponentInfoOrThrowIfNotFound)(tree, options.path);
101
+ const { localizationJsonPath, translationsPath, translationsVariableType } = getLocalizationInformation(options.path, tree);
102
+ const keyName = options.key.charAt(0).toLowerCase() + (0, strings_1.classify)(options.key).slice(1);
103
+ const properties = {
104
+ ...options,
105
+ keyName,
106
+ keyValue: `${selector}.${options.keyToKebabCase ? (0, strings_1.dasherize)(options.key) : keyName}`,
107
+ defaultValue: options.value
108
+ };
109
+ const localizationJson = tree.readJson(localizationJsonPath) || {};
110
+ if (localizationJson[properties.keyValue]) {
111
+ throw new KeyAlreadyExistsError(properties.keyValue, localizationJsonPath);
112
+ }
113
+ const translationFileContent = tree.readText(translationsPath);
114
+ if (new RegExp(`${properties.keyName}:`).test(translationFileContent)) {
115
+ throw new KeyAlreadyExistsError(properties.keyName, translationsPath);
116
+ }
117
+ const updateLocalizationFileRule = () => {
118
+ localizationJson[properties.keyValue] = {
119
+ ...(properties.dictionary
120
+ ? {
121
+ dictionary: true
122
+ }
123
+ : {
124
+ defaultValue: properties.defaultValue
125
+ }),
126
+ description: properties.description
127
+ };
128
+ tree.overwrite(localizationJsonPath, JSON.stringify(localizationJson, null, 2));
129
+ return tree;
130
+ };
131
+ const updateTranslationFileRule = () => {
132
+ const translationSourceFile = ts.createSourceFile(translationsPath, tree.readText(translationsPath), ts.ScriptTarget.ES2020, true);
133
+ const result = ts.transform(translationSourceFile, [(ctx) => (rootNode) => {
134
+ const { factory } = ctx;
135
+ const visit = (node) => {
136
+ if (ts.isInterfaceDeclaration(node)
137
+ && node.name.escapedText.toString() === translationsVariableType) {
138
+ return factory.updateInterfaceDeclaration(node, ts.getModifiers(node), node.name, node.typeParameters, node.heritageClauses, node.members.concat(factory.createPropertySignature(undefined, factory.createIdentifier(properties.keyName), undefined, factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword))));
139
+ }
140
+ if (ts.isVariableDeclaration(node)
141
+ && node.type
142
+ && ((ts.isTypeReferenceNode(node.type)
143
+ && ts.isIdentifier(node.type.typeName)
144
+ && node.type.typeName.escapedText.toString() === translationsVariableType)
145
+ || (ts.isTypeReferenceNode(node.type)
146
+ && ts.isIdentifier(node.type.typeName)
147
+ && node.type.typeName.escapedText.toString() === 'Readonly'
148
+ && node.type.typeArguments?.[0]
149
+ && ts.isTypeReferenceNode(node.type.typeArguments[0])
150
+ && ts.isIdentifier(node.type.typeArguments[0].typeName)
151
+ && node.type.typeArguments[0].typeName.escapedText.toString() === translationsVariableType))
152
+ && node.initializer) {
153
+ if (ts.isObjectLiteralExpression(node.initializer)) {
154
+ return factory.updateVariableDeclaration(node, node.name, node.exclamationToken, node.type, factory.updateObjectLiteralExpression(node.initializer, node.initializer.properties.concat(factory.createPropertyAssignment(factory.createIdentifier(properties.keyName), factory.createStringLiteral(properties.keyValue, true)))));
155
+ }
156
+ else if (ts.isAsExpression(node.initializer)
157
+ && ts.isTypeReferenceNode(node.initializer.type)
158
+ && ts.isIdentifier(node.initializer.type.typeName)
159
+ && node.initializer.type.typeName.escapedText.toString() === 'const'
160
+ && ts.isObjectLiteralExpression(node.initializer.expression)) {
161
+ return factory.updateVariableDeclaration(node, node.name, node.exclamationToken, node.type, factory.updateAsExpression(node.initializer, factory.updateObjectLiteralExpression(node.initializer.expression, node.initializer.expression.properties.concat(factory.createPropertyAssignment(factory.createIdentifier(properties.keyName), factory.createStringLiteral(properties.keyValue, true)))), node.initializer.type));
162
+ }
163
+ }
164
+ return ts.visitEachChild(node, visit, ctx);
165
+ };
166
+ return ts.visitNode(rootNode, visit);
167
+ }]);
168
+ const printer = ts.createPrinter({
169
+ removeComments: false,
170
+ newLine: ts.NewLineKind.LineFeed
171
+ });
172
+ tree.overwrite(translationsPath, printer.printFile(result.transformed[0]));
173
+ return tree;
174
+ };
175
+ const updateTemplateFile = () => {
176
+ const templatePath = templateRelativePath && node_path_1.posix.join((0, node_path_1.dirname)(options.path), templateRelativePath);
177
+ if (templatePath) {
178
+ tree.overwrite(templatePath, tree.readText(templatePath).replaceAll(options.value, `{{ translations.${properties.keyName} | o3rTranslate }}`));
179
+ }
180
+ };
181
+ return (0, schematics_1.chain)([
182
+ updateLocalizationFileRule,
183
+ updateTranslationFileRule,
184
+ options.value && options.updateTemplate ? updateTemplateFile : (0, schematics_1.noop)(),
185
+ options.skipLinter ? (0, schematics_1.noop)() : (0, schematics_2.applyEsLintFix)()
186
+ ]);
187
+ }
188
+ catch (e) {
189
+ if (e instanceof schematics_2.NoOtterComponent && context.interactive) {
190
+ const shouldConvertComponent = await (0, schematics_2.askConfirmationToConvertComponent)();
191
+ if (shouldConvertComponent) {
192
+ return (0, schematics_1.chain)([
193
+ (0, schematics_1.externalSchematic)('@o3r/core', 'convert-component', {
194
+ path: options.path
195
+ }),
196
+ ngAddLocalizationKeyFn(options)
197
+ ]);
198
+ }
199
+ }
200
+ else if (e instanceof NoLocalizationArchitectureError && context.interactive) {
201
+ const shouldAddLocalization = await (0, prompt_1.askConfirmation)('This component is not localized. Would you like to add the localization architecture?', true);
202
+ if (shouldAddLocalization) {
203
+ return (0, schematics_1.chain)([
204
+ (0, schematics_1.schematic)('localization-to-component', {
205
+ path: options.path
206
+ }),
207
+ ngAddLocalizationKeyFn(options)
208
+ ]);
209
+ }
210
+ }
211
+ else if (e instanceof KeyAlreadyExistsError && context.interactive) {
212
+ const newKey = await (0, schematics_2.askUserInput)(`${e.message}\nPlease choose another key name:`);
213
+ return ngAddLocalizationKeyFn({
214
+ ...options,
215
+ key: newKey
216
+ });
217
+ }
218
+ throw e;
219
+ }
220
+ };
221
+ }
222
+ /**
223
+ * Add localization key to an existing component
224
+ * @param options
225
+ */
226
+ exports.ngAddLocalizationKey = (0, schematics_2.createOtterSchematic)(ngAddLocalizationKeyFn);
227
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":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C;gBACL,CAAC;YACH,CAAC;iBAAM,IAAI,CAAC,YAAY,+BAA+B,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;gBAC/E,MAAM,qBAAqB,GAAG,MAAM,IAAA,wBAAe,EAAC,uFAAuF,EAAE,IAAI,CAAC,CAAC;gBACnJ,IAAI,qBAAqB,EAAE,CAAC;oBAC1B,OAAO,IAAA,kBAAK,EAAC;wBACX,IAAA,sBAAS,EAAC,2BAA2B,EAAE;4BACrC,IAAI,EAAE,OAAO,CAAC,IAAI;yBACnB,CAAC;wBACF,sBAAsB,CAAC,OAAO,CAAC;qBAChC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;iBAAM,IAAI,CAAC,YAAY,qBAAqB,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;gBACrE,MAAM,MAAM,GAAG,MAAM,IAAA,yBAAY,EAC/B,GAAG,CAAC,CAAC,OAAO,mCAAmC,CAChD,CAAC;gBACF,OAAO,sBAAsB,CAAC;oBAC5B,GAAG,OAAO;oBACV,GAAG,EAAE,MAAM;iBACZ,CAAC,CAAC;YACL,CAAC;YACD,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACU,QAAA,oBAAoB,GAAG,IAAA,iCAAoB,EAAC,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { SchematicOptionObject } from '@o3r/schematics';
2
+ export interface NgAddLocalizationKeySchematicsSchema extends SchematicOptionObject {
3
+ /** Path to the component */
4
+ path: string;
5
+ /** Skip the linter process which includes the run of EsLint and EditorConfig rules */
6
+ skipLinter: boolean;
7
+ /** Localization key without the component prefix */
8
+ key: string;
9
+ /** Description of the localization */
10
+ description?: string | undefined;
11
+ /** Default value of the localization */
12
+ value: string;
13
+ /** Is a dictionary key */
14
+ dictionary: boolean;
15
+ /** Update the template by replacing matching value by the localization key */
16
+ updateTemplate?: boolean | undefined;
17
+ /** Convert the key to kebab-case */
18
+ keyToKebabCase?: boolean | undefined;
19
+ }
20
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/add-localization-key/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,oCAAqC,SAAQ,qBAAqB;IACjF,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IAEb,sFAAsF;IACtF,UAAU,EAAE,OAAO,CAAC;IAEpB,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC;IAEZ,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IAEd,0BAA0B;IAC1B,UAAU,EAAE,OAAO,CAAC;IAEpB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAErC,oCAAoC;IACpC,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACtC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../schematics/add-localization-key/schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,49 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "NgAddLocalizationKeySchematicsSchema",
4
+ "title": "Add Otter Localization key to an existing component",
5
+ "description": "Add Otter Localization key to an existing component",
6
+ "properties": {
7
+ "path": {
8
+ "type": "string",
9
+ "description": "Path to the component"
10
+ },
11
+ "skipLinter": {
12
+ "type": "boolean",
13
+ "description": "Skip the linter process which includes EsLint and EditorConfig rules applying",
14
+ "default": false
15
+ },
16
+ "key": {
17
+ "type": "string",
18
+ "description": "Localization key without the component prefix"
19
+ },
20
+ "description": {
21
+ "type": "string",
22
+ "description": "Description of the localization"
23
+ },
24
+ "value": {
25
+ "type": "string",
26
+ "description": "Default value of the localization",
27
+ "default": ""
28
+ },
29
+ "dictionary": {
30
+ "type": "boolean",
31
+ "description": "Is a dictionary key",
32
+ "default": false
33
+ },
34
+ "updateTemplate": {
35
+ "type": "boolean",
36
+ "description": "Update the template by replacing matching value by the localization key"
37
+ },
38
+ "keyToKebabCase": {
39
+ "type": "boolean",
40
+ "description": "Convert the key to kebab-case",
41
+ "default": false
42
+ }
43
+ },
44
+ "additionalProperties": true,
45
+ "required": [
46
+ "path",
47
+ "key"
48
+ ]
49
+ }
@@ -0,0 +1,8 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ /**
3
+ * Update CMS adapter tools
4
+ * @param options {@link RuleFactory.options}
5
+ * @param options.projectName
6
+ */
7
+ export declare const updateCmsAdapter: (options: any) => Rule;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/cms-adapter/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,IAAI,EAGL,MAAM,4BAA4B,CAAC;AAuFpC;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,wBAA2C,CAAC"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateCmsAdapter = void 0;
4
+ const path = require("node:path");
5
+ const schematics_1 = require("@angular-devkit/schematics");
6
+ const schematics_2 = require("@o3r/schematics");
7
+ /**
8
+ * Update CMS adapter for localization
9
+ * @param options Options for the CMS adapter update
10
+ * @param options.projectName Name of the project to update
11
+ */
12
+ function updateCmsAdapterFn(options) {
13
+ if (!options.projectName) {
14
+ return schematics_1.noop;
15
+ }
16
+ /**
17
+ * Add cms extractors builder into the angular.json
18
+ * @param tree
19
+ * @param context
20
+ */
21
+ const editAngularJson = (tree, context) => {
22
+ const workspace = (0, schematics_2.getWorkspaceConfig)(tree);
23
+ const workspaceProject = options.projectName ? workspace?.projects[options.projectName] : undefined;
24
+ if (!workspace || !workspaceProject) {
25
+ context.logger.error('No project detected, the extractors will not be added');
26
+ return tree;
27
+ }
28
+ if (!workspaceProject.architect) {
29
+ workspaceProject.architect = {};
30
+ }
31
+ workspaceProject.architect['extract-translations'] ||= {
32
+ builder: '@o3r/transloco:extractor',
33
+ options: {
34
+ tsConfig: path.join(workspaceProject?.root || '', 'tsconfig.cms.json'),
35
+ libraries: []
36
+ }
37
+ };
38
+ workspaceProject.architect['check-localization-migration-metadata'] ||= {
39
+ builder: '@o3r/transloco:check-localization-migration-metadata',
40
+ options: {
41
+ migrationDataPath: 'migration-scripts/dist/MIGRATION-*.json'
42
+ }
43
+ };
44
+ workspace.projects[options.projectName] = workspaceProject;
45
+ tree.overwrite('/angular.json', JSON.stringify(workspace, null, 2));
46
+ return tree;
47
+ };
48
+ /**
49
+ * Add cms extractors scripts into the package.json
50
+ * @param tree
51
+ * @param context
52
+ */
53
+ const addExtractorsScripts = (tree, context) => {
54
+ const workspaceProject = options.projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[options.projectName] : undefined;
55
+ if (!workspaceProject) {
56
+ context.logger.error('No package detected, the extractor scripts will not be added');
57
+ return tree;
58
+ }
59
+ const packageJson = (0, schematics_2.readPackageJson)(tree, workspaceProject);
60
+ const packageManagerRunner = (0, schematics_2.getPackageManagerRunner)((0, schematics_2.getWorkspaceConfig)(tree));
61
+ packageJson.scripts ||= {};
62
+ packageJson.scripts['cms-adapters:localizations'] ||= `ng run ${options.projectName}:extract-translations`;
63
+ packageJson.scripts['cms-adapters:metadata'] = Object.keys(packageJson.scripts)
64
+ .filter((s) => /^cms-adapters:(?!metadata$)/.test(s))
65
+ .map((s) => `${packageManagerRunner} ${s}`)
66
+ .join(' && ');
67
+ tree.overwrite(`${workspaceProject.root}/package.json`, JSON.stringify(packageJson, null, 2));
68
+ return tree;
69
+ };
70
+ return (0, schematics_1.chain)([
71
+ addExtractorsScripts,
72
+ editAngularJson
73
+ ]);
74
+ }
75
+ /**
76
+ * Update CMS adapter tools
77
+ * @param options {@link RuleFactory.options}
78
+ * @param options.projectName
79
+ */
80
+ exports.updateCmsAdapter = (0, schematics_2.createOtterSchematic)(updateCmsAdapterFn);
81
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/cms-adapter/index.ts"],"names":[],"mappings":";;;AAAA,kCAAkC;AAClC,2DAMoC;AACpC,gDAKyB;AAEzB;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,OAA6C;IACvE,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACzB,OAAO,iBAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,MAAM,eAAe,GAAG,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAChE,MAAM,SAAS,GAAG,IAAA,+BAAkB,EAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEpG,IAAI,CAAC,SAAS,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACpC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,uDAAuD,CAAC,CAAC;YAC9E,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC;YAChC,gBAAgB,CAAC,SAAS,GAAG,EAAE,CAAC;QAClC,CAAC;QAED,gBAAgB,CAAC,SAAS,CAAC,sBAAsB,CAAC,KAAK;YACrD,OAAO,EAAE,0BAA0B;YACnC,OAAO,EAAE;gBACP,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,IAAI,EAAE,EAAE,mBAAmB,CAAC;gBACtE,SAA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E,CAAC,6BAA6B,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACpD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,oBAAoB,IAAI,CAAC,EAAE,CAAC;aAC1C,IAAI,CAAC,MAAM,CAAC,CAAC;QAEhB,IAAI,CAAC,SAAS,CAAC,GAAG,gBAAgB,CAAC,IAAI,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9F,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,OAAO,IAAA,kBAAK,EAAC;QACX,oBAAoB;QACpB,eAAe;KAChB,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,IAAA,iCAAoB,EAAC,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ /**
3
+ * Add Otter localization support
4
+ * @param options {@link RuleFactory.options}
5
+ * @param options.projectName
6
+ * @param options.enableMessageFormat
7
+ * @param rootPath {@link RuleFactory.rootPath}
8
+ */
9
+ export declare function updateLocalization(options: {
10
+ projectName?: string | null | undefined;
11
+ enableMessageFormat?: boolean;
12
+ }, rootPath: string): Rule;
13
+ export declare const updateI18n: (options: any) => Rule;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/localization-base/index.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,IAAI,EAKL,MAAM,4BAA4B,CAAC;AA4BpC;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAqY9I;AA6CD,eAAO,MAAM,UAAU,wBAAqC,CAAC"}