@angular/localize 13.0.0-next.9 → 13.0.0-rc.3

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 (138) hide show
  1. package/{esm2015/index.js → esm2020/index.mjs} +0 -0
  2. package/esm2020/init/index.mjs +12 -0
  3. package/{esm2015/localize.js → esm2020/localize.mjs} +0 -0
  4. package/{esm2015/private.js → esm2020/private.mjs} +0 -0
  5. package/{esm2015/src/localize/index.js → esm2020/src/localize/index.mjs} +0 -0
  6. package/{esm2015/src/localize/src/global.js → esm2020/src/localize/src/global.mjs} +0 -0
  7. package/{esm2015/src/localize/src/localize.js → esm2020/src/localize/src/localize.mjs} +2 -2
  8. package/{esm2015/src/translate.js → esm2020/src/translate.mjs} +0 -0
  9. package/{esm2015/src/utils/index.js → esm2020/src/utils/index.mjs} +0 -0
  10. package/{esm2015/src/utils/src/constants.js → esm2020/src/utils/src/constants.mjs} +0 -0
  11. package/esm2020/src/utils/src/messages.mjs +159 -0
  12. package/{esm2015/src/utils/src/translations.js → esm2020/src/utils/src/translations.mjs} +0 -0
  13. package/fesm2015/{init.js → init.mjs} +3 -3
  14. package/fesm2015/init.mjs.map +1 -0
  15. package/fesm2015/{localize.js → localize.mjs} +7 -7
  16. package/fesm2015/localize.mjs.map +1 -0
  17. package/fesm2020/init.mjs +204 -0
  18. package/fesm2020/init.mjs.map +1 -0
  19. package/fesm2020/localize.mjs +449 -0
  20. package/fesm2020/localize.mjs.map +1 -0
  21. package/init/index.d.ts +1 -1
  22. package/init/package.json +5 -5
  23. package/package.json +43 -18
  24. package/schematics/ng-add/index.js +1 -1
  25. package/src/localize/src/localize.d.ts +1 -1
  26. package/src/utils/src/messages.d.ts +1 -1
  27. package/tools/README.md +4 -0
  28. package/tools/bundles/index.js +1929 -0
  29. package/tools/bundles/index.js.map +6 -0
  30. package/tools/bundles/src/extract/cli.js +1278 -0
  31. package/tools/bundles/src/extract/cli.js.map +6 -0
  32. package/tools/bundles/src/migrate/cli.js +77 -0
  33. package/tools/bundles/src/migrate/cli.js.map +6 -0
  34. package/tools/bundles/src/translate/cli.js +1340 -0
  35. package/tools/bundles/src/translate/cli.js.map +6 -0
  36. package/tools/bundles_metadata.json +1 -0
  37. package/tools/index.d.ts +26 -0
  38. package/tools/src/babel_core.d.ts +38 -0
  39. package/{src/tools → tools}/src/diagnostics.d.ts +1 -1
  40. package/tools/src/extract/cli.d.ts +10 -0
  41. package/{src/tools → tools}/src/extract/duplicates.d.ts +2 -2
  42. package/{src/tools → tools}/src/extract/extraction.d.ts +2 -3
  43. package/{src/tools/src/extract/main.d.ts → tools/src/extract/index.d.ts} +2 -4
  44. package/{src/tools → tools}/src/extract/source_files/es2015_extract_plugin.d.ts +3 -3
  45. package/{src/tools → tools}/src/extract/source_files/es5_extract_plugin.d.ts +3 -3
  46. package/{src/tools → tools}/src/extract/translation_files/arb_translation_serializer.d.ts +2 -2
  47. package/{src/tools → tools}/src/extract/translation_files/format_options.d.ts +1 -1
  48. package/{src/tools → tools}/src/extract/translation_files/icu_parsing.d.ts +1 -1
  49. package/{src/tools → tools}/src/extract/translation_files/json_translation_serializer.d.ts +1 -1
  50. package/{src/tools → tools}/src/extract/translation_files/legacy_message_id_migration_serializer.d.ts +1 -1
  51. package/{src/tools → tools}/src/extract/translation_files/translation_serializer.d.ts +1 -1
  52. package/{src/tools → tools}/src/extract/translation_files/utils.d.ts +1 -1
  53. package/{src/tools → tools}/src/extract/translation_files/xliff1_translation_serializer.d.ts +2 -2
  54. package/{src/tools → tools}/src/extract/translation_files/xliff2_translation_serializer.d.ts +2 -2
  55. package/{src/tools → tools}/src/extract/translation_files/xmb_translation_serializer.d.ts +2 -2
  56. package/{src/tools → tools}/src/extract/translation_files/xml_file.d.ts +1 -1
  57. package/tools/src/migrate/cli.d.ts +10 -0
  58. package/{src/tools/src/migrate/main.d.ts → tools/src/migrate/index.d.ts} +9 -3
  59. package/{src/tools → tools}/src/migrate/migrate.d.ts +1 -1
  60. package/{src/tools → tools}/src/source_file_utils.d.ts +3 -3
  61. package/{src/tools → tools}/src/translate/asset_files/asset_translation_handler.d.ts +2 -2
  62. package/tools/src/translate/cli.d.ts +3 -0
  63. package/{src/tools/src/translate/main.d.ts → tools/src/translate/index.d.ts} +1 -2
  64. package/{src/tools → tools}/src/translate/output_path.d.ts +2 -2
  65. package/{src/tools → tools}/src/translate/source_files/es2015_translate_plugin.d.ts +3 -3
  66. package/{src/tools → tools}/src/translate/source_files/es5_translate_plugin.d.ts +3 -3
  67. package/{src/tools → tools}/src/translate/source_files/locale_plugin.d.ts +2 -2
  68. package/{src/tools → tools}/src/translate/source_files/source_file_translation_handler.d.ts +2 -2
  69. package/{src/tools → tools}/src/translate/translation_files/base_visitor.d.ts +1 -1
  70. package/{src/tools → tools}/src/translate/translation_files/message_serialization/message_renderer.d.ts +1 -1
  71. package/{src/tools → tools}/src/translate/translation_files/message_serialization/message_serializer.d.ts +1 -1
  72. package/{src/tools → tools}/src/translate/translation_files/message_serialization/target_message_renderer.d.ts +1 -1
  73. package/{src/tools → tools}/src/translate/translation_files/translation_loader.d.ts +2 -2
  74. package/{src/tools → tools}/src/translate/translation_files/translation_parsers/arb_translation_parser.d.ts +1 -1
  75. package/{src/tools → tools}/src/translate/translation_files/translation_parsers/serialize_translation_message.d.ts +1 -1
  76. package/{src/tools → tools}/src/translate/translation_files/translation_parsers/simple_json_translation_parser.d.ts +1 -1
  77. package/{src/tools → tools}/src/translate/translation_files/translation_parsers/translation_parse_error.d.ts +1 -1
  78. package/{src/tools → tools}/src/translate/translation_files/translation_parsers/translation_parser.d.ts +2 -2
  79. package/{src/tools → tools}/src/translate/translation_files/translation_parsers/translation_utils.d.ts +1 -1
  80. package/{src/tools → tools}/src/translate/translation_files/translation_parsers/xliff1_translation_parser.d.ts +1 -1
  81. package/{src/tools → tools}/src/translate/translation_files/translation_parsers/xliff2_translation_parser.d.ts +1 -1
  82. package/{src/tools → tools}/src/translate/translation_files/translation_parsers/xtb_translation_parser.d.ts +1 -1
  83. package/{src/tools → tools}/src/translate/translator.d.ts +2 -2
  84. package/bundles/localize-init.umd.js +0 -218
  85. package/bundles/localize-init.umd.js.map +0 -1
  86. package/bundles/localize.umd.js +0 -782
  87. package/bundles/localize.umd.js.map +0 -1
  88. package/esm2015/init/index.js +0 -12
  89. package/esm2015/init/init.externs.js +0 -0
  90. package/esm2015/localize.externs.js +0 -0
  91. package/esm2015/src/localize/localize.externs.js +0 -0
  92. package/esm2015/src/utils/src/messages.js +0 -159
  93. package/esm2015/src/utils/utils.externs.js +0 -0
  94. package/fesm2015/init.js.map +0 -1
  95. package/fesm2015/localize.js.map +0 -1
  96. package/init.d.ts +0 -7
  97. package/src/tools/src/diagnostics.js +0 -68
  98. package/src/tools/src/extract/duplicates.js +0 -84
  99. package/src/tools/src/extract/extraction.js +0 -134
  100. package/src/tools/src/extract/main.js +0 -184
  101. package/src/tools/src/extract/source_files/es2015_extract_plugin.js +0 -36
  102. package/src/tools/src/extract/source_files/es5_extract_plugin.js +0 -49
  103. package/src/tools/src/extract/translation_files/arb_translation_serializer.js +0 -107
  104. package/src/tools/src/extract/translation_files/format_options.js +0 -52
  105. package/src/tools/src/extract/translation_files/icu_parsing.js +0 -224
  106. package/src/tools/src/extract/translation_files/json_translation_serializer.js +0 -47
  107. package/src/tools/src/extract/translation_files/legacy_message_id_migration_serializer.js +0 -63
  108. package/src/tools/src/extract/translation_files/translation_serializer.js +0 -13
  109. package/src/tools/src/extract/translation_files/utils.js +0 -102
  110. package/src/tools/src/extract/translation_files/xliff1_translation_serializer.js +0 -242
  111. package/src/tools/src/extract/translation_files/xliff2_translation_serializer.js +0 -231
  112. package/src/tools/src/extract/translation_files/xmb_translation_serializer.js +0 -139
  113. package/src/tools/src/extract/translation_files/xml_file.js +0 -117
  114. package/src/tools/src/migrate/main.js +0 -79
  115. package/src/tools/src/migrate/migrate.js +0 -48
  116. package/src/tools/src/source_file_utils.js +0 -443
  117. package/src/tools/src/translate/asset_files/asset_translation_handler.js +0 -65
  118. package/src/tools/src/translate/main.js +0 -157
  119. package/src/tools/src/translate/output_path.js +0 -28
  120. package/src/tools/src/translate/source_files/es2015_translate_plugin.js +0 -60
  121. package/src/tools/src/translate/source_files/es5_translate_plugin.js +0 -58
  122. package/src/tools/src/translate/source_files/locale_plugin.js +0 -95
  123. package/src/tools/src/translate/source_files/source_file_translation_handler.js +0 -127
  124. package/src/tools/src/translate/translation_files/base_visitor.js +0 -31
  125. package/src/tools/src/translate/translation_files/message_serialization/message_renderer.js +0 -20
  126. package/src/tools/src/translate/translation_files/message_serialization/message_serializer.js +0 -100
  127. package/src/tools/src/translate/translation_files/message_serialization/target_message_renderer.js +0 -84
  128. package/src/tools/src/translate/translation_files/translation_loader.js +0 -148
  129. package/src/tools/src/translate/translation_files/translation_parsers/arb_translation_parser.js +0 -111
  130. package/src/tools/src/translate/translation_files/translation_parsers/serialize_translation_message.js +0 -32
  131. package/src/tools/src/translate/translation_files/translation_parsers/simple_json_translation_parser.js +0 -96
  132. package/src/tools/src/translate/translation_files/translation_parsers/translation_parse_error.js +0 -47
  133. package/src/tools/src/translate/translation_files/translation_parsers/translation_parser.js +0 -13
  134. package/src/tools/src/translate/translation_files/translation_parsers/translation_utils.js +0 -175
  135. package/src/tools/src/translate/translation_files/translation_parsers/xliff1_translation_parser.js +0 -175
  136. package/src/tools/src/translate/translation_files/translation_parsers/xliff2_translation_parser.js +0 -166
  137. package/src/tools/src/translate/translation_files/translation_parsers/xtb_translation_parser.js +0 -133
  138. package/src/tools/src/translate/translator.js +0 -53
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/source_files/es2015_translate_plugin" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/source_files/es2015_translate_plugin" />
2
2
  /**
3
3
  * @license
4
4
  * Copyright Google LLC All Rights Reserved.
@@ -6,9 +6,9 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
- import { PathManipulation } from '@angular/compiler-cli/src/ngtsc/file_system';
9
+ import { PathManipulation } from '@angular/compiler-cli/private/localize';
10
10
  import { ɵParsedTranslation } from '@angular/localize';
11
- import { PluginObj } from '@babel/core';
11
+ import { PluginObj } from '../../babel_core';
12
12
  import { Diagnostics } from '../../diagnostics';
13
13
  import { TranslatePluginOptions } from '../../source_file_utils';
14
14
  /**
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/source_files/es5_translate_plugin" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/source_files/es5_translate_plugin" />
2
2
  /**
3
3
  * @license
4
4
  * Copyright Google LLC All Rights Reserved.
@@ -6,9 +6,9 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
- import { PathManipulation } from '@angular/compiler-cli/src/ngtsc/file_system';
9
+ import { PathManipulation } from '@angular/compiler-cli/private/localize';
10
10
  import { ɵParsedTranslation } from '@angular/localize';
11
- import { PluginObj } from '@babel/core';
11
+ import { PluginObj } from '../../babel_core';
12
12
  import { Diagnostics } from '../../diagnostics';
13
13
  import { TranslatePluginOptions } from '../../source_file_utils';
14
14
  /**
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/source_files/locale_plugin" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/source_files/locale_plugin" />
2
2
  /**
3
3
  * @license
4
4
  * Copyright Google LLC All Rights Reserved.
@@ -6,7 +6,7 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
- import { PluginObj } from '@babel/core';
9
+ import { PluginObj } from '../../babel_core';
10
10
  import { TranslatePluginOptions } from '../../source_file_utils';
11
11
  /**
12
12
  * This Babel plugin will replace the following code forms with a string literal containing the
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/source_files/source_file_translation_handler" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/source_files/source_file_translation_handler" />
2
2
  /**
3
3
  * @license
4
4
  * Copyright Google LLC All Rights Reserved.
@@ -6,7 +6,7 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
- import { AbsoluteFsPath, FileSystem, PathSegment } from '@angular/compiler-cli/src/ngtsc/file_system';
9
+ import { AbsoluteFsPath, FileSystem, PathSegment } from '@angular/compiler-cli/private/localize';
10
10
  import { Diagnostics } from '../../diagnostics';
11
11
  import { TranslatePluginOptions } from '../../source_file_utils';
12
12
  import { OutputPathFn } from '../output_path';
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/translation_files/base_visitor" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/translation_files/base_visitor" />
2
2
  /**
3
3
  * @license
4
4
  * Copyright Google LLC All Rights Reserved.
@@ -5,7 +5,7 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- /// <amd-module name="@angular/localize/src/tools/src/translate/translation_files/message_serialization/message_renderer" />
8
+ /// <amd-module name="@angular/localize/tools/src/translate/translation_files/message_serialization/message_renderer" />
9
9
  export interface MessageRenderer<T> {
10
10
  message: T;
11
11
  startRender(): void;
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/translation_files/message_serialization/message_serializer" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/translation_files/message_serialization/message_serializer" />
2
2
  /**
3
3
  * @license
4
4
  * Copyright Google LLC All Rights Reserved.
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/translation_files/message_serialization/target_message_renderer" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/translation_files/message_serialization/target_message_renderer" />
2
2
  /**
3
3
  * @license
4
4
  * Copyright Google LLC All Rights Reserved.
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/translation_files/translation_loader" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/translation_files/translation_loader" />
2
2
  /**
3
3
  * @license
4
4
  * Copyright Google LLC All Rights Reserved.
@@ -6,7 +6,7 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
- import { AbsoluteFsPath, ReadonlyFileSystem } from '@angular/compiler-cli/src/ngtsc/file_system';
9
+ import { AbsoluteFsPath, ReadonlyFileSystem } from '@angular/compiler-cli/private/localize';
10
10
  import { DiagnosticHandlingStrategy, Diagnostics } from '../../diagnostics';
11
11
  import { TranslationBundle } from '../translator';
12
12
  import { TranslationParser } from './translation_parsers/translation_parser';
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/translation_files/translation_parsers/arb_translation_parser" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/translation_files/translation_parsers/arb_translation_parser" />
2
2
  /**
3
3
  * @license
4
4
  * Copyright Google LLC All Rights Reserved.
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/translation_files/translation_parsers/serialize_translation_message" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/translation_files/translation_parsers/serialize_translation_message" />
2
2
  /**
3
3
  * @license
4
4
  * Copyright Google LLC All Rights Reserved.
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/translation_files/translation_parsers/simple_json_translation_parser" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/translation_files/translation_parsers/simple_json_translation_parser" />
2
2
  import { ParseAnalysis, ParsedTranslationBundle, TranslationParser } from './translation_parser';
3
3
  interface SimpleJsonFile {
4
4
  locale: string;
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/translation_files/translation_parsers/translation_parse_error" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/translation_files/translation_parsers/translation_parse_error" />
2
2
  /**
3
3
  * @license
4
4
  * Copyright Google LLC All Rights Reserved.
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/translation_files/translation_parsers/translation_parser" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/translation_files/translation_parsers/translation_parser" />
2
2
  /**
3
3
  * @license
4
4
  * Copyright Google LLC All Rights Reserved.
@@ -6,7 +6,7 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
- import { ɵMessageId, ɵParsedTranslation } from '@angular/localize/private';
9
+ import { ɵMessageId, ɵParsedTranslation } from '@angular/localize';
10
10
  import { Diagnostics } from '../../../diagnostics';
11
11
  /**
12
12
  * Indicates that a parser can parse a given file, with a hint that can be used to speed up actual
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/translation_files/translation_parsers/translation_utils" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/translation_files/translation_parsers/translation_utils" />
2
2
  /**
3
3
  * @license
4
4
  * Copyright Google LLC All Rights Reserved.
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/translation_files/translation_parsers/xliff1_translation_parser" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/translation_files/translation_parsers/xliff1_translation_parser" />
2
2
  import { ParseAnalysis, ParsedTranslationBundle, TranslationParser } from './translation_parser';
3
3
  import { XmlTranslationParserHint } from './translation_utils';
4
4
  /**
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/translation_files/translation_parsers/xliff2_translation_parser" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/translation_files/translation_parsers/xliff2_translation_parser" />
2
2
  import { ParseAnalysis, ParsedTranslationBundle, TranslationParser } from './translation_parser';
3
3
  import { XmlTranslationParserHint } from './translation_utils';
4
4
  /**
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/translation_files/translation_parsers/xtb_translation_parser" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/translation_files/translation_parsers/xtb_translation_parser" />
2
2
  import { ParseAnalysis, ParsedTranslationBundle, TranslationParser } from './translation_parser';
3
3
  import { XmlTranslationParserHint } from './translation_utils';
4
4
  /**
@@ -1,4 +1,4 @@
1
- /// <amd-module name="@angular/localize/src/tools/src/translate/translator" />
1
+ /// <amd-module name="@angular/localize/tools/src/translate/translator" />
2
2
  /**
3
3
  * @license
4
4
  * Copyright Google LLC All Rights Reserved.
@@ -6,7 +6,7 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
- import { AbsoluteFsPath, PathSegment, ReadonlyFileSystem } from '@angular/compiler-cli/src/ngtsc/file_system';
9
+ import { AbsoluteFsPath, PathSegment, ReadonlyFileSystem } from '@angular/compiler-cli/private/localize';
10
10
  import { ɵMessageId, ɵParsedTranslation } from '@angular/localize';
11
11
  import { Diagnostics } from '../diagnostics';
12
12
  import { OutputPathFn } from './output_path';
@@ -1,218 +0,0 @@
1
- /**
2
- * @license Angular v13.0.0-next.9
3
- * (c) 2010-2021 Google LLC. https://angular.io/
4
- * License: MIT
5
- */
6
-
7
- (function (global, factory) {
8
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
9
- typeof define === 'function' && define.amd ? define('@angular/localize/init', ['exports'], factory) :
10
- (global = global || self, factory((global.ng = global.ng || {}, global.ng.localize = global.ng.localize || {}, global.ng.localize.init = {})));
11
- }(this, (function (exports) { 'use strict';
12
-
13
- /**
14
- * @license
15
- * Copyright Google LLC All Rights Reserved.
16
- *
17
- * Use of this source code is governed by an MIT-style license that can be
18
- * found in the LICENSE file at https://angular.io/license
19
- */
20
- var __globalThis = typeof globalThis !== 'undefined' && globalThis;
21
- var __window = typeof window !== 'undefined' && window;
22
- var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
23
- self instanceof WorkerGlobalScope && self;
24
- var __global = typeof global !== 'undefined' && global;
25
- // Always use __globalThis if available; this is the spec-defined global variable across all
26
- // environments.
27
- // Then fallback to __global first; in Node tests both __global and __window may be defined.
28
- var _global = __globalThis || __global || __window || __self;
29
-
30
- /**
31
- * @license
32
- * Copyright Google LLC All Rights Reserved.
33
- *
34
- * Use of this source code is governed by an MIT-style license that can be
35
- * found in the LICENSE file at https://angular.io/license
36
- */
37
- /**
38
- * Tag a template literal string for localization.
39
- *
40
- * For example:
41
- *
42
- * ```ts
43
- * $localize `some string to localize`
44
- * ```
45
- *
46
- * **Providing meaning, description and id**
47
- *
48
- * You can optionally specify one or more of `meaning`, `description` and `id` for a localized
49
- * string by pre-pending it with a colon delimited block of the form:
50
- *
51
- * ```ts
52
- * $localize`:meaning|description@@id:source message text`;
53
- *
54
- * $localize`:meaning|:source message text`;
55
- * $localize`:description:source message text`;
56
- * $localize`:@@id:source message text`;
57
- * ```
58
- *
59
- * This format is the same as that used for `i18n` markers in Angular templates. See the
60
- * [Angular 18n guide](guide/i18n-common-prepare#mark-text-for-translations).
61
- *
62
- * **Naming placeholders**
63
- *
64
- * If the template literal string contains expressions, then the expressions will be automatically
65
- * associated with placeholder names for you.
66
- *
67
- * For example:
68
- *
69
- * ```ts
70
- * $localize `Hi ${name}! There are ${items.length} items.`;
71
- * ```
72
- *
73
- * will generate a message-source of `Hi {$PH}! There are {$PH_1} items`.
74
- *
75
- * The recommended practice is to name the placeholder associated with each expression though.
76
- *
77
- * Do this by providing the placeholder name wrapped in `:` characters directly after the
78
- * expression. These placeholder names are stripped out of the rendered localized string.
79
- *
80
- * For example, to name the `items.length` expression placeholder `itemCount` you write:
81
- *
82
- * ```ts
83
- * $localize `There are ${items.length}:itemCount: items`;
84
- * ```
85
- *
86
- * **Escaping colon markers**
87
- *
88
- * If you need to use a `:` character directly at the start of a tagged string that has no
89
- * metadata block, or directly after a substitution expression that has no name you must escape
90
- * the `:` by preceding it with a backslash:
91
- *
92
- * For example:
93
- *
94
- * ```ts
95
- * // message has a metadata block so no need to escape colon
96
- * $localize `:some description::this message starts with a colon (:)`;
97
- * // no metadata block so the colon must be escaped
98
- * $localize `\:this message starts with a colon (:)`;
99
- * ```
100
- *
101
- * ```ts
102
- * // named substitution so no need to escape colon
103
- * $localize `${label}:label:: ${}`
104
- * // anonymous substitution so colon must be escaped
105
- * $localize `${label}\: ${}`
106
- * ```
107
- *
108
- * **Processing localized strings:**
109
- *
110
- * There are three scenarios:
111
- *
112
- * * **compile-time inlining**: the `$localize` tag is transformed at compile time by a
113
- * transpiler, removing the tag and replacing the template literal string with a translated
114
- * literal string from a collection of translations provided to the transpilation tool.
115
- *
116
- * * **run-time evaluation**: the `$localize` tag is a run-time function that replaces and
117
- * reorders the parts (static strings and expressions) of the template literal string with strings
118
- * from a collection of translations loaded at run-time.
119
- *
120
- * * **pass-through evaluation**: the `$localize` tag is a run-time function that simply evaluates
121
- * the original template literal string without applying any translations to the parts. This
122
- * version is used during development or where there is no need to translate the localized
123
- * template literals.
124
- *
125
- * @param messageParts a collection of the static parts of the template string.
126
- * @param expressions a collection of the values of each placeholder in the template string.
127
- * @returns the translated string, with the `messageParts` and `expressions` interleaved together.
128
- *
129
- * @globalApi
130
- * @publicApi
131
- */
132
- var $localize = function (messageParts) {
133
- var expressions = [];
134
- for (var _i = 1; _i < arguments.length; _i++) {
135
- expressions[_i - 1] = arguments[_i];
136
- }
137
- if ($localize.translate) {
138
- // Don't use array expansion here to avoid the compiler adding `__read()` helper unnecessarily.
139
- var translation = $localize.translate(messageParts, expressions);
140
- messageParts = translation[0];
141
- expressions = translation[1];
142
- }
143
- var message = stripBlock(messageParts[0], messageParts.raw[0]);
144
- for (var i = 1; i < messageParts.length; i++) {
145
- message += expressions[i - 1] + stripBlock(messageParts[i], messageParts.raw[i]);
146
- }
147
- return message;
148
- };
149
- var BLOCK_MARKER = ':';
150
- /**
151
- * Strip a delimited "block" from the start of the `messagePart`, if it is found.
152
- *
153
- * If a marker character (:) actually appears in the content at the start of a tagged string or
154
- * after a substitution expression, where a block has not been provided the character must be
155
- * escaped with a backslash, `\:`. This function checks for this by looking at the `raw`
156
- * messagePart, which should still contain the backslash.
157
- *
158
- * @param messagePart The cooked message part to process.
159
- * @param rawMessagePart The raw message part to check.
160
- * @returns the message part with the placeholder name stripped, if found.
161
- * @throws an error if the block is unterminated
162
- */
163
- function stripBlock(messagePart, rawMessagePart) {
164
- return rawMessagePart.charAt(0) === BLOCK_MARKER ?
165
- messagePart.substring(findEndOfBlock(messagePart, rawMessagePart) + 1) :
166
- messagePart;
167
- }
168
- /**
169
- * Find the end of a "marked block" indicated by the first non-escaped colon.
170
- *
171
- * @param cooked The cooked string (where escaped chars have been processed)
172
- * @param raw The raw string (where escape sequences are still in place)
173
- *
174
- * @returns the index of the end of block marker
175
- * @throws an error if the block is unterminated
176
- */
177
- function findEndOfBlock(cooked, raw) {
178
- /***********************************************************************************************
179
- * This function is repeated in `src/utils/messages.ts` and the two should be kept in sync.
180
- * The reason is that this file is marked as having side-effects, and if we import `messages.ts`
181
- * into it, the whole of `src/utils` will be included in this bundle and none of the functions
182
- * will be tree shaken.
183
- ***********************************************************************************************/
184
- for (var cookedIndex = 1, rawIndex = 1; cookedIndex < cooked.length; cookedIndex++, rawIndex++) {
185
- if (raw[rawIndex] === '\\') {
186
- rawIndex++;
187
- }
188
- else if (cooked[cookedIndex] === BLOCK_MARKER) {
189
- return cookedIndex;
190
- }
191
- }
192
- throw new Error("Unterminated $localize metadata block in \"" + raw + "\".");
193
- }
194
-
195
- /**
196
- * @license
197
- * Copyright Google LLC All Rights Reserved.
198
- *
199
- * Use of this source code is governed by an MIT-style license that can be
200
- * found in the LICENSE file at https://angular.io/license
201
- */
202
-
203
- /**
204
- * @license
205
- * Copyright Google LLC All Rights Reserved.
206
- *
207
- * Use of this source code is governed by an MIT-style license that can be
208
- * found in the LICENSE file at https://angular.io/license
209
- */
210
- // Attach $localize to the global context, as a side-effect of this module.
211
- _global.$localize = $localize;
212
-
213
- exports.$localize = $localize;
214
-
215
- Object.defineProperty(exports, '__esModule', { value: true });
216
-
217
- })));
218
- //# sourceMappingURL=localize-init.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"localize-init.umd.js","sources":["../../../../../packages/localize/src/localize/src/global.ts","../../../../../packages/localize/src/localize/src/localize.ts","../../../../../packages/localize/src/localize/index.ts","../../../../../packages/localize/init/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// **********************************************************************************************\n// This code to access the global object is mostly copied from `packages/core/src/util/global.ts`\n\ndeclare global {\n // The definition of `WorkerGlobalScope` must be compatible with the one in `lib.webworker.d.ts`,\n // because all files under `packages/` are compiled together as part of the\n // [legacy-unit-tests-saucelabs][1] CI job, including the `lib.webworker.d.ts` typings brought in\n // by [service-worker/worker/src/service-worker.d.ts][2].\n //\n // [1]:\n // https://github.com/angular/angular/blob/ffeea63f43e6a7fd46be4a8cd5a5d254c98dea08/.circleci/config.yml#L681\n // [2]:\n // https://github.com/angular/angular/blob/316dc2f12ce8931f5ff66fa5f8da21c0d251a337/packages/service-worker/worker/src/service-worker.d.ts#L9\n interface WorkerGlobalScope extends EventTarget, WindowOrWorkerGlobalScope {}\n\n var WorkerGlobalScope: {prototype: WorkerGlobalScope; new (): WorkerGlobalScope;};\n}\n\nconst __globalThis = typeof globalThis !== 'undefined' && globalThis;\nconst __window = typeof window !== 'undefined' && window;\nconst __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&\n self instanceof WorkerGlobalScope && self;\nconst __global = typeof global !== 'undefined' && global;\n// Always use __globalThis if available; this is the spec-defined global variable across all\n// environments.\n// Then fallback to __global first; in Node tests both __global and __window may be defined.\nexport const _global: any = __globalThis || __global || __window || __self;\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** @nodoc */\nexport interface LocalizeFn {\n (messageParts: TemplateStringsArray, ...expressions: readonly any[]): string;\n\n /**\n * A function that converts an input \"message with expressions\" into a translated \"message with\n * expressions\".\n *\n * The conversion may be done in place, modifying the array passed to the function, so\n * don't assume that this has no side-effects.\n *\n * The expressions must be passed in since it might be they need to be reordered for\n * different translations.\n */\n translate?: TranslateFn;\n /**\n * The current locale of the translated messages.\n *\n * The compile-time translation inliner is able to replace the following code:\n *\n * ```\n * typeof $localize !== \"undefined\" && $localize.locale\n * ```\n *\n * with a string literal of the current locale. E.g.\n *\n * ```\n * \"fr\"\n * ```\n */\n locale?: string;\n}\n\n/** @nodoc */\nexport interface TranslateFn {\n (messageParts: TemplateStringsArray,\n expressions: readonly any[]): [TemplateStringsArray, readonly any[]];\n}\n\n/**\n * Tag a template literal string for localization.\n *\n * For example:\n *\n * ```ts\n * $localize `some string to localize`\n * ```\n *\n * **Providing meaning, description and id**\n *\n * You can optionally specify one or more of `meaning`, `description` and `id` for a localized\n * string by pre-pending it with a colon delimited block of the form:\n *\n * ```ts\n * $localize`:meaning|description@@id:source message text`;\n *\n * $localize`:meaning|:source message text`;\n * $localize`:description:source message text`;\n * $localize`:@@id:source message text`;\n * ```\n *\n * This format is the same as that used for `i18n` markers in Angular templates. See the\n * [Angular 18n guide](guide/i18n-common-prepare#mark-text-for-translations).\n *\n * **Naming placeholders**\n *\n * If the template literal string contains expressions, then the expressions will be automatically\n * associated with placeholder names for you.\n *\n * For example:\n *\n * ```ts\n * $localize `Hi ${name}! There are ${items.length} items.`;\n * ```\n *\n * will generate a message-source of `Hi {$PH}! There are {$PH_1} items`.\n *\n * The recommended practice is to name the placeholder associated with each expression though.\n *\n * Do this by providing the placeholder name wrapped in `:` characters directly after the\n * expression. These placeholder names are stripped out of the rendered localized string.\n *\n * For example, to name the `items.length` expression placeholder `itemCount` you write:\n *\n * ```ts\n * $localize `There are ${items.length}:itemCount: items`;\n * ```\n *\n * **Escaping colon markers**\n *\n * If you need to use a `:` character directly at the start of a tagged string that has no\n * metadata block, or directly after a substitution expression that has no name you must escape\n * the `:` by preceding it with a backslash:\n *\n * For example:\n *\n * ```ts\n * // message has a metadata block so no need to escape colon\n * $localize `:some description::this message starts with a colon (:)`;\n * // no metadata block so the colon must be escaped\n * $localize `\\:this message starts with a colon (:)`;\n * ```\n *\n * ```ts\n * // named substitution so no need to escape colon\n * $localize `${label}:label:: ${}`\n * // anonymous substitution so colon must be escaped\n * $localize `${label}\\: ${}`\n * ```\n *\n * **Processing localized strings:**\n *\n * There are three scenarios:\n *\n * * **compile-time inlining**: the `$localize` tag is transformed at compile time by a\n * transpiler, removing the tag and replacing the template literal string with a translated\n * literal string from a collection of translations provided to the transpilation tool.\n *\n * * **run-time evaluation**: the `$localize` tag is a run-time function that replaces and\n * reorders the parts (static strings and expressions) of the template literal string with strings\n * from a collection of translations loaded at run-time.\n *\n * * **pass-through evaluation**: the `$localize` tag is a run-time function that simply evaluates\n * the original template literal string without applying any translations to the parts. This\n * version is used during development or where there is no need to translate the localized\n * template literals.\n *\n * @param messageParts a collection of the static parts of the template string.\n * @param expressions a collection of the values of each placeholder in the template string.\n * @returns the translated string, with the `messageParts` and `expressions` interleaved together.\n *\n * @globalApi\n * @publicApi\n */\nexport const $localize: LocalizeFn = function(\n messageParts: TemplateStringsArray, ...expressions: readonly any[]) {\n if ($localize.translate) {\n // Don't use array expansion here to avoid the compiler adding `__read()` helper unnecessarily.\n const translation = $localize.translate(messageParts, expressions);\n messageParts = translation[0];\n expressions = translation[1];\n }\n let message = stripBlock(messageParts[0], messageParts.raw[0]);\n for (let i = 1; i < messageParts.length; i++) {\n message += expressions[i - 1] + stripBlock(messageParts[i], messageParts.raw[i]);\n }\n return message;\n};\n\nconst BLOCK_MARKER = ':';\n\n/**\n * Strip a delimited \"block\" from the start of the `messagePart`, if it is found.\n *\n * If a marker character (:) actually appears in the content at the start of a tagged string or\n * after a substitution expression, where a block has not been provided the character must be\n * escaped with a backslash, `\\:`. This function checks for this by looking at the `raw`\n * messagePart, which should still contain the backslash.\n *\n * @param messagePart The cooked message part to process.\n * @param rawMessagePart The raw message part to check.\n * @returns the message part with the placeholder name stripped, if found.\n * @throws an error if the block is unterminated\n */\nfunction stripBlock(messagePart: string, rawMessagePart: string) {\n return rawMessagePart.charAt(0) === BLOCK_MARKER ?\n messagePart.substring(findEndOfBlock(messagePart, rawMessagePart) + 1) :\n messagePart;\n}\n\n/**\n * Find the end of a \"marked block\" indicated by the first non-escaped colon.\n *\n * @param cooked The cooked string (where escaped chars have been processed)\n * @param raw The raw string (where escape sequences are still in place)\n *\n * @returns the index of the end of block marker\n * @throws an error if the block is unterminated\n */\nfunction findEndOfBlock(cooked: string, raw: string): number {\n /***********************************************************************************************\n * This function is repeated in `src/utils/messages.ts` and the two should be kept in sync.\n * The reason is that this file is marked as having side-effects, and if we import `messages.ts`\n * into it, the whole of `src/utils` will be included in this bundle and none of the functions\n * will be tree shaken.\n ***********************************************************************************************/\n for (let cookedIndex = 1, rawIndex = 1; cookedIndex < cooked.length; cookedIndex++, rawIndex++) {\n if (raw[rawIndex] === '\\\\') {\n rawIndex++;\n } else if (cooked[cookedIndex] === BLOCK_MARKER) {\n return cookedIndex;\n }\n }\n throw new Error(`Unterminated $localize metadata block in \"${raw}\".`);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nexport {_global} from './src/global';\nexport {$localize, LocalizeFn, TranslateFn} from './src/localize';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {$localize, _global, LocalizeFn} from '../src/localize';\n\nexport {$localize, LocalizeFn, TranslateFn} from '../src/localize';\n\n// Attach $localize to the global context, as a side-effect of this module.\n_global.$localize = $localize;\n\n// `declare global` allows us to escape the current module and place types on the global namespace\ndeclare global {\n /**\n * Tag a template literal string for localization.\n *\n * For example:\n *\n * ```ts\n * $localize `some string to localize`\n * ```\n *\n * **Providing meaning, description and id**\n *\n * You can optionally specify one or more of `meaning`, `description` and `id` for a localized\n * string by pre-pending it with a colon delimited block of the form:\n *\n * ```ts\n * $localize`:meaning|description@@id:source message text`;\n *\n * $localize`:meaning|:source message text`;\n * $localize`:description:source message text`;\n * $localize`:@@id:source message text`;\n * ```\n *\n * This format is the same as that used for `i18n` markers in Angular templates. See the\n * [Angular 18n guide](guide/i18n-common-prepare#mark-text-for-translations).\n *\n * **Naming placeholders**\n *\n * If the template literal string contains expressions, then the expressions will be automatically\n * associated with placeholder names for you.\n *\n * For example:\n *\n * ```ts\n * $localize `Hi ${name}! There are ${items.length} items.`;\n * ```\n *\n * will generate a message-source of `Hi {$PH}! There are {$PH_1} items`.\n *\n * The recommended practice is to name the placeholder associated with each expression though.\n *\n * Do this by providing the placeholder name wrapped in `:` characters directly after the\n * expression. These placeholder names are stripped out of the rendered localized string.\n *\n * For example, to name the `items.length` expression placeholder `itemCount` you write:\n *\n * ```ts\n * $localize `There are ${items.length}:itemCount: items`;\n * ```\n *\n * **Escaping colon markers**\n *\n * If you need to use a `:` character directly at the start of a tagged string that has no\n * metadata block, or directly after a substitution expression that has no name you must escape\n * the `:` by preceding it with a backslash:\n *\n * For example:\n *\n * ```ts\n * // message has a metadata block so no need to escape colon\n * $localize `:some description::this message starts with a colon (:)`;\n * // no metadata block so the colon must be escaped\n * $localize `\\:this message starts with a colon (:)`;\n * ```\n *\n * ```ts\n * // named substitution so no need to escape colon\n * $localize `${label}:label:: ${}`\n * // anonymous substitution so colon must be escaped\n * $localize `${label}\\: ${}`\n * ```\n *\n * **Processing localized strings:**\n *\n * There are three scenarios:\n *\n * * **compile-time inlining**: the `$localize` tag is transformed at compile time by a\n * transpiler, removing the tag and replacing the template literal string with a translated\n * literal string from a collection of translations provided to the transpilation tool.\n *\n * * **run-time evaluation**: the `$localize` tag is a run-time function that replaces and\n * reorders the parts (static strings and expressions) of the template literal string with strings\n * from a collection of translations loaded at run-time.\n *\n * * **pass-through evaluation**: the `$localize` tag is a run-time function that simply evaluates\n * the original template literal string without applying any translations to the parts. This\n * version is used during development or where there is no need to translate the localized\n * template literals.\n *\n * @param messageParts a collection of the static parts of the template string.\n * @param expressions a collection of the values of each placeholder in the template string.\n * @returns the translated string, with the `messageParts` and `expressions` interleaved together.\n */\n const $localize: LocalizeFn;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;IAAA;;;;;;;IA0BA,IAAM,YAAY,GAAG,OAAO,UAAU,KAAK,WAAW,IAAI,UAAU,CAAC;IACrE,IAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC;IACzD,IAAM,MAAM,GAAG,OAAO,IAAI,KAAK,WAAW,IAAI,OAAO,iBAAiB,KAAK,WAAW;QAClF,IAAI,YAAY,iBAAiB,IAAI,IAAI,CAAC;IAC9C,IAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC;IACzD;IACA;IACA;IACO,IAAM,OAAO,GAAQ,YAAY,IAAI,QAAQ,IAAI,QAAQ,IAAI,MAAM;;IClC1E;;;;;;;IA+CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA+Fa,SAAS,GAAe,UACjC,YAAkC;QAAE,qBAA8B;aAA9B,UAA8B,EAA9B,qBAA8B,EAA9B,IAA8B;YAA9B,oCAA8B;;QACpE,IAAI,SAAS,CAAC,SAAS,EAAE;;YAEvB,IAAM,WAAW,GAAG,SAAS,CAAC,SAAS,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;YACnE,YAAY,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;YAC9B,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;SAC9B;QACD,IAAI,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC5C,OAAO,IAAI,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SAClF;QACD,OAAO,OAAO,CAAC;IACjB,EAAE;IAEF,IAAM,YAAY,GAAG,GAAG,CAAC;IAEzB;;;;;;;;;;;;;IAaA,SAAS,UAAU,CAAC,WAAmB,EAAE,cAAsB;QAC7D,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,YAAY;YAC5C,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;YACtE,WAAW,CAAC;IAClB,CAAC;IAED;;;;;;;;;IASA,SAAS,cAAc,CAAC,MAAc,EAAE,GAAW;;;;;;;QAOjD,KAAK,IAAI,WAAW,GAAG,CAAC,EAAE,QAAQ,GAAG,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,EAAE;YAC9F,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE;gBAC1B,QAAQ,EAAE,CAAC;aACZ;iBAAM,IAAI,MAAM,CAAC,WAAW,CAAC,KAAK,YAAY,EAAE;gBAC/C,OAAO,WAAW,CAAC;aACpB;SACF;QACD,MAAM,IAAI,KAAK,CAAC,gDAA6C,GAAG,QAAI,CAAC,CAAC;IACxE;;IC1MA;;;;;;;;ICAA;;;;;;;IAWA;IACA,OAAO,CAAC,SAAS,GAAG,SAAS;;;;;;;;;;;;"}