angular-cn/packages/compiler-cli/test/compliance
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
..
BUILD.bazel refactor(ivy): implement a virtual file-system layer in ngtsc + ngcc (#30921) 2019-06-25 16:25:24 -07:00
README.md build: use bazel version from node modules (#26691) 2018-10-30 16:19:13 -04:00
mock_compile.ts refactor(ivy): update the compiler to emit `$localize` tags (#31609) 2019-08-30 12:53:26 -07:00
mock_compiler_spec.ts test(compiler-cli): compliance tests not always reporting test failure (#30597) 2019-05-22 16:22:52 -07:00
r3_compiler_compliance_spec.ts refactor(ivy): remove styling state storage and introduce direct style writing (#32591) 2019-09-16 14:12:48 -07:00
r3_view_compiler_binding_spec.ts perf(ivy): replace select instruction with advance (#32516) 2019-09-10 06:30:28 -04:00
r3_view_compiler_di_spec.ts refactor(ivy): move directive, component and pipe factories to ngFactoryFn (#31953) 2019-08-27 13:57:00 -07:00
r3_view_compiler_directives_spec.ts refactor(ivy): move directive, component and pipe factories to ngFactoryFn (#31953) 2019-08-27 13:57:00 -07:00
r3_view_compiler_i18n_spec.ts fix(ivy): i18n - update the compiler to output `MessageId`s (#32594) 2019-09-17 09:17:45 -07:00
r3_view_compiler_input_outputs_spec.ts refactor(ivy): Move instructions back to ɵɵ (#30546) 2019-05-20 16:37:47 -07:00
r3_view_compiler_listener_spec.ts refactor(ivy): move directive, component and pipe factories to ngFactoryFn (#31953) 2019-08-27 13:57:00 -07:00
r3_view_compiler_providers_spec.ts refactor(ivy): move directive, component and pipe factories to ngFactoryFn (#31953) 2019-08-27 13:57:00 -07:00
r3_view_compiler_spec.ts perf(ivy): chain multiple property instructions (#31078) 2019-06-19 15:42:37 -07:00
r3_view_compiler_styling_spec.ts refactor(ivy): remove styling state storage and introduce direct style writing (#32591) 2019-09-16 14:12:48 -07:00
r3_view_compiler_template_spec.ts perf(ivy): replace select instruction with advance (#32516) 2019-09-10 06:30:28 -04:00

README.md

Tests in this directory should be run with:

yarn bazel test --define=compile=aot  packages/compiler-cli/test/compliance:compliance