angular-cn/packages/compiler-cli/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
..
compliance fix(ivy): i18n - update the compiler to output `MessageId`s (#32594) 2019-09-17 09:17:45 -07:00
diagnostics fix(language-service): Remove 'context' used for module resolution (#32015) 2019-08-13 11:19:18 -07:00
helpers fix(ivy): handle namespaced imports correctly (#31367) 2019-07-09 09:40:30 -07:00
metadata build: TypeScript 3.5 upgrade (#31615) 2019-07-25 17:05:23 -07:00
ngtsc refactor(ivy): remove styling state storage and introduce direct style writing (#32591) 2019-09-16 14:12:48 -07:00
transformers refactor(core): remove innerHTML and outerHTML testing utilities from DomAdapters (#32278) 2019-08-26 10:39:09 -07:00
BUILD.bazel refactor(ivy): implement a virtual file-system layer in ngtsc + ngcc (#30921) 2019-06-25 16:25:24 -07:00
extract_i18n_spec.ts feat: make the Ivy compiler the default for ngc (#32219) 2019-08-20 16:41:08 -07:00
mocks.ts fix(compiler-cli): Use typescript to resolve modules for metadata (#22856) 2018-07-10 11:11:48 -07:00
ngc_spec.ts feat: make the Ivy compiler the default for ngc (#32219) 2019-08-20 16:41:08 -07:00
ngtools_api_spec.ts fix(ivy): DebugNode.query should query nodes in the logical tree (#29480) 2019-03-26 12:48:37 -07:00
perform_compile_spec.ts fix(compiler): return enableIvy true when using `readConfiguration` (#32234) 2019-08-21 10:06:25 -07:00
perform_watch_spec.ts fix(compiler-cli): Return original sourceFile instead of redirected sourceFile from getSourceFile (#26036) 2019-07-15 17:33:40 -04:00
test_support.ts feat: make the Ivy compiler the default for ngc (#32219) 2019-08-20 16:41:08 -07:00