@taon-dev/i18n 21.0.50 → 21.0.51

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 (119) hide show
  1. package/VERIFIED-BUILD-DATA.jsonc +3 -3
  2. package/browser/fesm2022/i18n-browser.mjs +88 -6
  3. package/browser/fesm2022/i18n-browser.mjs.map +1 -1
  4. package/browser/package.json +1 -1
  5. package/browser/types/i18n-browser.d.ts +11 -26
  6. package/browser-prod/fesm2022/i18n-browser-prod.mjs +88 -6
  7. package/browser-prod/fesm2022/i18n-browser-prod.mjs.map +1 -1
  8. package/browser-prod/package.json +1 -1
  9. package/browser-prod/types/i18n-browser-prod.d.ts +11 -26
  10. package/full-dts/build-info._auto-generated_.d.ts +1 -1
  11. package/full-dts/index._auto-generated_.d.ts +1 -2
  12. package/full-dts/local-translation.d.ts +8 -1
  13. package/lib/build-info._auto-generated_.d.ts +1 -1
  14. package/lib/build-info._auto-generated_.js +1 -1
  15. package/lib/index._auto-generated_.d.ts +0 -1
  16. package/lib/index._auto-generated_.js +0 -1
  17. package/lib/index._auto-generated_.js.map +1 -1
  18. package/lib/local-translation.d.ts +8 -1
  19. package/lib/local-translation.js +90 -6
  20. package/lib/local-translation.js.map +1 -1
  21. package/lib/package.json +1 -1
  22. package/lib-esm/lib/build-info._auto-generated_.d.ts +1 -1
  23. package/lib-esm/lib/build-info._auto-generated_.js +1 -1
  24. package/lib-esm/lib/index._auto-generated_.d.ts +0 -1
  25. package/lib-esm/lib/index._auto-generated_.js +0 -1
  26. package/lib-esm/lib/index._auto-generated_.js.map +1 -1
  27. package/lib-esm/lib/local-translation.d.ts +8 -1
  28. package/lib-esm/lib/local-translation.js +90 -8
  29. package/lib-esm/lib/local-translation.js.map +1 -1
  30. package/lib-prod/build-info._auto-generated_.d.ts +1 -1
  31. package/lib-prod/build-info._auto-generated_.js +1 -1
  32. package/lib-prod/index._auto-generated_.d.ts +0 -1
  33. package/lib-prod/index._auto-generated_.js +0 -1
  34. package/lib-prod/index._auto-generated_.js.map +1 -1
  35. package/lib-prod/local-translation.d.ts +8 -1
  36. package/lib-prod/local-translation.js +90 -6
  37. package/lib-prod/local-translation.js.map +1 -1
  38. package/lib-prod/package.json +1 -1
  39. package/package.json +1 -1
  40. package/ts-source/browser-code/build-info._auto-generated_.ts +2 -2
  41. package/ts-source/browser-code/i18n/lib.translation.ts +1 -1
  42. package/ts-source/browser-code/i18n/translation.ts.en-US.i18n.data.ts +1 -1
  43. package/ts-source/browser-code/i18n/translation.ts.pl-PL.i18n.data.ts +1 -1
  44. package/ts-source/browser-code/index._auto-generated_.ts +1 -2
  45. package/ts-source/browser-code/index.scss +1 -1
  46. package/ts-source/browser-code/index.ts +1 -1
  47. package/ts-source/browser-code/local-translation.ts +33 -1
  48. package/ts-source/browser-code/start-cli.ts +1 -1
  49. package/ts-source/browser-code/translate.directive.ts +1 -1
  50. package/ts-source/browser-code/translate.pipe.ts +1 -1
  51. package/ts-source/browser-code/translate.service.ts +1 -1
  52. package/ts-source/browser-code/translation-manager.ts +1 -1
  53. package/ts-source/browser-code/translation.models.ts +1 -1
  54. package/ts-source/browser-code/translation.ts +1 -1
  55. package/ts-source/browser-code/utils-i18n-extract-gettext-translate-from-html.ts +1 -1
  56. package/ts-source/browser-code/utils-i18n-html.ts +1 -1
  57. package/ts-source/browser-code/utils-po-file.ts +1 -1
  58. package/ts-source/browser-code-prod/build-info._auto-generated_.ts +2 -2
  59. package/ts-source/browser-code-prod/i18n/lib.translation.ts +1 -1
  60. package/ts-source/browser-code-prod/i18n/translation.ts.en-US.i18n.data.ts +1 -1
  61. package/ts-source/browser-code-prod/i18n/translation.ts.pl-PL.i18n.data.ts +1 -1
  62. package/ts-source/browser-code-prod/index._auto-generated_.ts +1 -2
  63. package/ts-source/browser-code-prod/index.scss +1 -1
  64. package/ts-source/browser-code-prod/index.ts +1 -1
  65. package/ts-source/browser-code-prod/local-translation.ts +33 -1
  66. package/ts-source/browser-code-prod/start-cli.ts +1 -1
  67. package/ts-source/browser-code-prod/translate.directive.ts +1 -1
  68. package/ts-source/browser-code-prod/translate.pipe.ts +1 -1
  69. package/ts-source/browser-code-prod/translate.service.ts +1 -1
  70. package/ts-source/browser-code-prod/translation-manager.ts +1 -1
  71. package/ts-source/browser-code-prod/translation.models.ts +1 -1
  72. package/ts-source/browser-code-prod/translation.ts +1 -1
  73. package/ts-source/browser-code-prod/utils-i18n-extract-gettext-translate-from-html.ts +1 -1
  74. package/ts-source/browser-code-prod/utils-i18n-html.ts +1 -1
  75. package/ts-source/browser-code-prod/utils-po-file.ts +1 -1
  76. package/ts-source/websql-code/build-info._auto-generated_.ts +2 -2
  77. package/ts-source/websql-code/i18n/lib.translation.ts +1 -1
  78. package/ts-source/websql-code/i18n/translation.ts.en-US.i18n.data.ts +1 -1
  79. package/ts-source/websql-code/i18n/translation.ts.pl-PL.i18n.data.ts +1 -1
  80. package/ts-source/websql-code/index._auto-generated_.ts +1 -2
  81. package/ts-source/websql-code/index.scss +1 -1
  82. package/ts-source/websql-code/index.ts +1 -1
  83. package/ts-source/websql-code/local-translation.ts +33 -1
  84. package/ts-source/websql-code/start-cli.ts +1 -1
  85. package/ts-source/websql-code/translate.directive.ts +1 -1
  86. package/ts-source/websql-code/translate.pipe.ts +1 -1
  87. package/ts-source/websql-code/translate.service.ts +1 -1
  88. package/ts-source/websql-code/translation-manager.ts +1 -1
  89. package/ts-source/websql-code/translation.models.ts +1 -1
  90. package/ts-source/websql-code/translation.ts +1 -1
  91. package/ts-source/websql-code/utils-i18n-extract-gettext-translate-from-html.ts +1 -1
  92. package/ts-source/websql-code/utils-i18n-html.ts +1 -1
  93. package/ts-source/websql-code/utils-po-file.ts +1 -1
  94. package/ts-source/websql-code-prod/build-info._auto-generated_.ts +2 -2
  95. package/ts-source/websql-code-prod/i18n/lib.translation.ts +1 -1
  96. package/ts-source/websql-code-prod/i18n/translation.ts.en-US.i18n.data.ts +1 -1
  97. package/ts-source/websql-code-prod/i18n/translation.ts.pl-PL.i18n.data.ts +1 -1
  98. package/ts-source/websql-code-prod/index._auto-generated_.ts +1 -2
  99. package/ts-source/websql-code-prod/index.scss +1 -1
  100. package/ts-source/websql-code-prod/index.ts +1 -1
  101. package/ts-source/websql-code-prod/local-translation.ts +33 -1
  102. package/ts-source/websql-code-prod/start-cli.ts +1 -1
  103. package/ts-source/websql-code-prod/translate.directive.ts +1 -1
  104. package/ts-source/websql-code-prod/translate.pipe.ts +1 -1
  105. package/ts-source/websql-code-prod/translate.service.ts +1 -1
  106. package/ts-source/websql-code-prod/translation-manager.ts +1 -1
  107. package/ts-source/websql-code-prod/translation.models.ts +1 -1
  108. package/ts-source/websql-code-prod/translation.ts +1 -1
  109. package/ts-source/websql-code-prod/utils-i18n-extract-gettext-translate-from-html.ts +1 -1
  110. package/ts-source/websql-code-prod/utils-i18n-html.ts +1 -1
  111. package/ts-source/websql-code-prod/utils-po-file.ts +1 -1
  112. package/websql/fesm2022/i18n-websql.mjs +88 -6
  113. package/websql/fesm2022/i18n-websql.mjs.map +1 -1
  114. package/websql/package.json +1 -1
  115. package/websql/types/i18n-websql.d.ts +11 -26
  116. package/websql-prod/fesm2022/i18n-websql-prod.mjs +88 -6
  117. package/websql-prod/fesm2022/i18n-websql-prod.mjs.map +1 -1
  118. package/websql-prod/package.json +1 -1
  119. package/websql-prod/types/i18n-websql-prod.d.ts +11 -26
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -15,4 +15,4 @@ export const APP_ID = 'com.domain.example.i18n';
15
15
  export const BUILD_BASE_HREF = '';
16
16
  export const PROJECT_NPM_NAME = '@taon-dev/i18n';
17
17
  export const CURRENT_PACKAGE_TAON_VERSION = 'v21';
18
- export const CURRENT_PACKAGE_VERSION = '21.0.50';
18
+ export const CURRENT_PACKAGE_VERSION = '21.0.51';
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -22,4 +22,3 @@ export * from './translation';
22
22
  export * from './utils-i18n-extract-gettext-translate-from-html';
23
23
  export * from './utils-i18n-html';
24
24
  export * from './utils-po-file';
25
- export * from './i18n/lib.translation';
@@ -3,7 +3,7 @@
3
3
  - TAON READONLY SOURCE
4
4
  - DO NOT MODIFY THIS FILE.
5
5
  - Changes may be overwritten.
6
- - Use command: taon build:lib:watch
6
+ - Use command: taon build:watch:lib
7
7
  inside @taon-dev/i18n project repository
8
8
  for watch development of third party modules like this.
9
9
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -35,6 +35,7 @@ const nllbLanguageCodes: Partial<Record<UtilsI18n.CommonLocaleCode, string>> = {
35
35
  'pl-PL': 'pol_Latn',
36
36
  'de-DE': 'deu_Latn',
37
37
  };
38
+ const CONTEXT_SEPARATOR = '→';
38
39
  export class LocalTranslationService {
39
40
  private translatorPromise?: Promise<any>;
40
41
  private aiReady = false;
@@ -119,6 +120,37 @@ export class LocalTranslationService {
119
120
  },
120
121
  };
121
122
  }
123
+ private protectInterpolation(text: string): {
124
+ preparedText: string;
125
+ restore: (translatedText: string) => string;
126
+ } {
127
+ const replacements: Array<{
128
+ placeholder: string;
129
+ originalValue: string;
130
+ }> = [];
131
+ const preparedText = text.replace(/\[\[[\s\S]*?\]\]/g, originalValue => {
132
+ const placeholder = `[[${replacements.length}]]`;
133
+ replacements.push({
134
+ placeholder,
135
+ originalValue,
136
+ });
137
+ return placeholder;
138
+ });
139
+ return {
140
+ preparedText,
141
+ restore(translatedText: string): string {
142
+ let result = translatedText;
143
+ for (const replacement of replacements) {
144
+ if (!result.includes(replacement.placeholder)) {
145
+ throw new Error(`Translation model removed interpolation placeholder ` +
146
+ `"${replacement.placeholder}" while translating "${text}".`);
147
+ }
148
+ result = result.replaceAll(replacement.placeholder, replacement.originalValue);
149
+ }
150
+ return result;
151
+ },
152
+ };
153
+ }
122
154
  private getModelsCachePath(): string {
123
155
  const cachePath = crossPlatformPath([
124
156
  UtilsOs.getRealHomeDir(),
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -15,4 +15,4 @@ export const APP_ID = 'com.domain.example.i18n';
15
15
  export const BUILD_BASE_HREF = '';
16
16
  export const PROJECT_NPM_NAME = '@taon-dev/i18n';
17
17
  export const CURRENT_PACKAGE_TAON_VERSION = 'v21';
18
- export const CURRENT_PACKAGE_VERSION = '21.0.50';
18
+ export const CURRENT_PACKAGE_VERSION = '21.0.51';
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -22,4 +22,3 @@ export * from './translation';
22
22
  export * from './utils-i18n-extract-gettext-translate-from-html';
23
23
  export * from './utils-i18n-html';
24
24
  export * from './utils-po-file';
25
- export * from './i18n/lib.translation';
@@ -3,7 +3,7 @@
3
3
  - TAON READONLY SOURCE
4
4
  - DO NOT MODIFY THIS FILE.
5
5
  - Changes may be overwritten.
6
- - Use command: taon build:lib:watch
6
+ - Use command: taon build:watch:lib
7
7
  inside @taon-dev/i18n project repository
8
8
  for watch development of third party modules like this.
9
9
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -35,6 +35,7 @@ const nllbLanguageCodes: Partial<Record<UtilsI18n__NS__CommonLocaleCode, string>
35
35
  'pl-PL': 'pol_Latn',
36
36
  'de-DE': 'deu_Latn',
37
37
  };
38
+ const CONTEXT_SEPARATOR = '→';
38
39
  export class LocalTranslationService {
39
40
  private translatorPromise?: Promise<any>;
40
41
  private aiReady = false;
@@ -119,6 +120,37 @@ export class LocalTranslationService {
119
120
  },
120
121
  };
121
122
  }
123
+ private protectInterpolation(text: string): {
124
+ preparedText: string;
125
+ restore: (translatedText: string) => string;
126
+ } {
127
+ const replacements: Array<{
128
+ placeholder: string;
129
+ originalValue: string;
130
+ }> = [];
131
+ const preparedText = text.replace(/\[\[[\s\S]*?\]\]/g, originalValue => {
132
+ const placeholder = `[[${replacements.length}]]`;
133
+ replacements.push({
134
+ placeholder,
135
+ originalValue,
136
+ });
137
+ return placeholder;
138
+ });
139
+ return {
140
+ preparedText,
141
+ restore(translatedText: string): string {
142
+ let result = translatedText;
143
+ for (const replacement of replacements) {
144
+ if (!result.includes(replacement.placeholder)) {
145
+ throw new Error(`Translation model removed interpolation placeholder ` +
146
+ `"${replacement.placeholder}" while translating "${text}".`);
147
+ }
148
+ result = result.replaceAll(replacement.placeholder, replacement.originalValue);
149
+ }
150
+ return result;
151
+ },
152
+ };
153
+ }
122
154
  private getModelsCachePath(): string {
123
155
  const cachePath = crossPlatformPath([
124
156
  UtilsOs__NS__getRealHomeDir(),
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10
 
@@ -4,7 +4,7 @@
4
4
  - TAON READONLY SOURCE
5
5
  - DO NOT MODIFY THIS FILE.
6
6
  - Changes may be overwritten.
7
- - Use command: taon build:lib:watch
7
+ - Use command: taon build:watch:lib
8
8
  inside @taon-dev/i18n project repository
9
9
  for watch development of third party modules like this.
10
10