angular-cn/packages/compiler/test
Pete Bacon Darwin b741a1c3e7 fix(ivy): i18n - update the compiler to output `MessageId`s (#32594)
Now that the `$localize` translations are `MessageId` based the
compiler must render `MessageId`s in its generated `$localize` code.
This is because the `MessageId` used by the compiler is computed
from information that does not get passed through to the `$localize`
tagged string.

For example, the generated code for the following template

```html
<div id="static" i18n-title="m|d" title="introduction"></div>
```

will contain these localization statements

```ts
if (ngI18nClosureMode) {
  /**
    * @desc d
    * @meaning m
    */
  const MSG_EXTERNAL_8809028065680254561$$APP_SPEC_TS_1 = goog.getMsg("introduction");
  I18N_1 = MSG_EXTERNAL_8809028065680254561$$APP_SPEC_TS_1;
}
else {
  I18N_1 = $localize \`:m|d@@8809028065680254561:introduction\`;
}
```

Since `$localize` is not able to accurately regenerate the source-message
(and so the `MessageId`) from the generated code, it must rely upon the
`MessageId` being provided explicitly in the generated code.

The compiler now prepends all localized messages with a "metadata block"
containing the id (and the meaning and description if defined).

Note that this metadata block will also allow translation file extraction
from the compiled code - rather than relying on the legacy ViewEngine
extraction code. (This will be implemented post-v9).

Although these metadata blocks add to the initial code size, compile-time
inlining will completely remove these strings and so will not impact on
production bundle size.

PR Close #32594
2019-09-17 09:17:45 -07:00
..
aot perf: don't create holey arrays (#32155) 2019-08-21 08:27:43 -07:00
css_parser build: fix type-check errors introduced during rules_ts 0.21 (#27586) 2018-12-10 16:33:41 -08:00
expression_parser feat(ivy): record absolute position of template expressions (#31391) 2019-07-22 09:48:35 -07:00
i18n fix(compiler): do not remove whitespace wrapping i18n expansions (#31962) 2019-08-09 12:03:50 -07:00
ml_parser fix(compiler): do not remove whitespace wrapping i18n expansions (#31962) 2019-08-09 12:03:50 -07:00
output perf: don't create holey arrays (#32155) 2019-08-21 08:27:43 -07:00
render3 fix(ivy): i18n - update the compiler to output `MessageId`s (#32594) 2019-09-17 09:17:45 -07:00
schema feat(ivy): add `ngcc` ivy switch (#25238) 2018-08-16 13:51:42 -07:00
selector refactor(core): move Meta methods that only have one version from DomAdapter (#32408) 2019-09-03 11:59:39 -07:00
template_parser perf: don't create holey arrays (#32155) 2019-08-21 08:27:43 -07:00
BUILD.bazel build: remove extra unused deps for `compiler:test` (#30482) 2019-05-16 09:43:01 -07:00
compiler_facade_interface_spec.ts test(ivy): verify equality of ngBaseDef metadata between compiler and core (#31210) 2019-07-02 11:06:46 -07:00
config_spec.ts feat(core): set preserveWhitespaces to false by default (#22046) 2018-02-16 09:06:14 -08:00
core_spec.ts test(compiler): update examples and compiler tests (#30626) 2019-05-23 10:31:32 -07:00
directive_lifecycle_spec.ts build: remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
directive_normalizer_spec.ts build: remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
directive_resolver_mock_spec.ts build: remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
directive_resolver_spec.ts test(compiler): update examples and compiler tests (#30626) 2019-05-23 10:31:32 -07:00
integration_spec.ts build(bazel): Turning on strictPropertyInitialization for Angular. (#24572) 2018-06-25 07:57:13 -07:00
metadata_resolver_fixture.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
metadata_resolver_spec.ts fix(compiler): Fix compiler crash due to isSkipSelf of null (#30075) 2019-04-24 17:06:53 -07:00
ng_module_resolver_mock_spec.ts build: remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
ng_module_resolver_spec.ts build: remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
parse_util_spec.ts build: remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
pipe_resolver_mock_spec.ts build: remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
pipe_resolver_spec.ts build: remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
resource_loader_mock_spec.ts build: remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
runtime_compiler_spec.ts build: remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
shadow_css_spec.ts fix(compiler): Don't strip `/*# sourceURL ... */` (#16088) 2018-01-24 12:35:30 -08:00
spies.ts perf: switch angular to use StaticInjector instead of ReflectiveInjector 2017-08-07 15:42:34 -07:00
style_url_resolver_spec.ts build: remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
test_bindings.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
url_resolver_spec.ts build: remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
util_spec.ts refactor: fix typescript strict flag failures in all tests (#30993) 2019-07-18 14:21:26 -07:00