angular-cn/packages/compiler/src
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
compiler_util fix(ivy): unable to bind to implicit receiver in embedded views (#30897) 2019-06-11 14:29:42 -07:00
css_parser
expression_parser perf: don't create holey arrays (#32155) 2019-08-21 08:27:43 -07:00
i18n fix(ivy): i18n - use `MessageId` for matching translations (#32594) 2019-09-17 09:17:44 -07:00
jit refactor(compiler): wrap the jit evaluation in an injectable class (#28055) 2019-02-12 20:58:27 -08:00
ml_parser fix(compiler): do not remove whitespace wrapping i18n expansions (#31962) 2019-08-09 12:03:50 -07:00
output refactor(ivy): update the compiler to emit `$localize` tags (#31609) 2019-08-30 12:53:26 -07:00
render3 fix(ivy): i18n - update the compiler to output `MessageId`s (#32594) 2019-09-17 09:17:45 -07:00
schema refactor(compiler): update docs (#29599) 2019-04-02 10:28:52 -07:00
template_parser perf: don't create holey arrays (#32155) 2019-08-21 08:27:43 -07:00
view_compiler fix(ivy): unable to bind to implicit receiver in embedded views (#30897) 2019-06-11 14:29:42 -07:00
assertions.ts refactor(compiler): rename INTERPOLATION_BLACKLIST_REGEXPS (#29593) 2019-04-02 10:36:26 -07:00
ast_path.ts
chars.ts feat(compiler): support tokenizing escaped strings (#28055) 2019-02-12 20:58:27 -08:00
compile_metadata.ts feat(core): allow users to define timing of ViewChild/ContentChild queries (#28810) 2019-02-19 12:56:25 -08:00
compile_reflector.ts
compiler.ts refactor(ivy): move directive, component and pipe factories to ngFactoryFn (#31953) 2019-08-27 13:57:00 -07:00
compiler_facade_interface.ts refactor(ivy): move directive, component and pipe factories to ngFactoryFn (#31953) 2019-08-27 13:57:00 -07:00
config.ts feat: add TypeScript 3 support (#25275) 2018-08-27 21:07:53 -04:00
constant_pool.ts refactor(ivy): update the compiler to emit `$localize` tags (#31609) 2019-08-30 12:53:26 -07:00
core.ts feat(ivy): add `AttributeMarker.I18n` for i18n attributes (#30402) 2019-05-30 16:39:24 -04:00
directive_normalizer.ts refactor(compiler): use `options` argument for parsers (#28055) 2019-02-12 20:58:27 -08:00
directive_resolver.ts
identifiers.ts refactor(ivy): Move instructions back to ɵɵ (#30546) 2019-05-20 16:37:47 -07:00
injectable_compiler.ts refactor(ivy): Move instructions back to ɵɵ (#30546) 2019-05-20 16:37:47 -07:00
injectable_compiler_2.ts refactor(ivy): move directive, component and pipe factories to ngFactoryFn (#31953) 2019-08-27 13:57:00 -07:00
jit_compiler_facade.ts refactor(ivy): move directive, component and pipe factories to ngFactoryFn (#31953) 2019-08-27 13:57:00 -07:00
lifecycle_reflector.ts feat(ivy): implement TestBed (#25369) 2018-08-14 11:58:47 -07:00
metadata_resolver.ts feat(compiler): allow selector-less directives as base classes (#31379) 2019-08-14 12:03:05 -07:00
ng_module_compiler.ts
ng_module_resolver.ts
parse_util.ts feat(ivy): record absolute position of template expressions (#31391) 2019-07-22 09:48:35 -07:00
pipe_resolver.ts
provider_analyzer.ts
resource_loader.ts
selector.ts feat(ivy): add generics to the SelectorMatcher API (#26203) 2018-10-04 10:11:17 -07:00
shadow_css.ts
style_compiler.ts feat(ivy): bridge component styles into the component renderer (#25255) 2018-08-23 16:51:15 -04:00
style_url_resolver.ts
summary_resolver.ts
url_resolver.ts
util.ts perf: don't create holey arrays (#32155) 2019-08-21 08:27:43 -07:00
version.ts