angular-cn/packages/core/test/bundling/todo_i18n
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 feat(ivy): i18n - reorganize entry-points for better reuse (#32488) 2019-09-12 15:35:34 -07:00
OUTSTANDING_WORK.md test(ivy): add bundling test `todo_i18n` (#27420) 2018-12-04 19:59:12 -08:00
base.css test(ivy): add bundling test `todo_i18n` (#27420) 2018-12-04 19:59:12 -08:00
index.html test: fix ivy ts_devserver tests under /packages/core/test/bunding/ (#32520) 2019-09-06 20:03:40 -04:00
index.ts feat(ivy): i18n - reorganize entry-points for better reuse (#32488) 2019-09-12 15:35:34 -07:00
todo.css refactor: remove obsolete font-smoothing property (#28174) 2019-01-23 15:44:35 -08:00
todo_e2e_spec.ts feat(ivy): i18n - reorganize entry-points for better reuse (#32488) 2019-09-12 15:35:34 -07:00
translations.ts fix(ivy): i18n - update the compiler to output `MessageId`s (#32594) 2019-09-17 09:17:45 -07:00