Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ngcc/i18n - legacy message id format #34135

Conversation

@petebacondarwin
Copy link
Member

petebacondarwin commented Nov 28, 2019

This PR is triggered by the use case given in #34056

The idea is that ngcc will now always (unless explicitly turned off) add all the legacy message ids to templates that it compiles. Then we can try to use these for matching translations when we get to actually merging the translations at compile-time.

(The first few commits are just general tidy up and not necessary for this PR)

@petebacondarwin

This comment has been minimized.

Copy link
Member Author

petebacondarwin commented Dec 2, 2019

Merge-assistance: the integration test failure is not related (a problem with terser dependencies).

…e bundle

Placing this configuration in to the bundle avoids having to pass the
value around through lots of function calls, but also could enable
support for different behaviour per bundle in the future.
By ensuring that legacy i18n message ids are rendered into the templates
of components for packages processed by ngcc, we ensure that these packages
can be used in an application that may provide translations in a legacy
format.

Fixes #34056
Now that `@angular/localize` can interpret multiple legacy message ids in the
metablock of a `$localize` tagged template string, this commit adds those
ids to each i18n message extracted from component templates, but only if
the `enableI18nLegacyMessageIdFormat` is not `false`.
This change will enable the Angular compiler to provide these legacy
message ids by default, which will solve problems with ngcc not knowing
whether to generate legacy ids or not.
When first written there was no way to specify the raw text when
programmatically creating a template tagged literal AST node.

This is now fixed in TS and so the hack is no longer needed.
Thanks to @gkalpakl for the better regular expression approach.
@petebacondarwin petebacondarwin force-pushed the petebacondarwin:ngcc-legacy-message-format branch from 50e7354 to a82e75f Dec 3, 2019
@mhevery mhevery closed this in e12933a Dec 3, 2019
mhevery added a commit that referenced this pull request Dec 3, 2019
When first written there was no way to specify the raw text when
programmatically creating a template tagged literal AST node.

This is now fixed in TS and so the hack is no longer needed.

PR Close #34135
mhevery added a commit that referenced this pull request Dec 3, 2019
mhevery added a commit that referenced this pull request Dec 3, 2019
mhevery added a commit that referenced this pull request Dec 3, 2019
…ds (#34135)

This change will enable the Angular compiler to provide these legacy
message ids by default, which will solve problems with ngcc not knowing
whether to generate legacy ids or not.

PR Close #34135
mhevery added a commit that referenced this pull request Dec 3, 2019
Now that `@angular/localize` can interpret multiple legacy message ids in the
metablock of a `$localize` tagged template string, this commit adds those
ids to each i18n message extracted from component templates, but only if
the `enableI18nLegacyMessageIdFormat` is not `false`.

PR Close #34135
mhevery added a commit that referenced this pull request Dec 3, 2019
…e bundle (#34135)

Placing this configuration in to the bundle avoids having to pass the
value around through lots of function calls, but also could enable
support for different behaviour per bundle in the future.

PR Close #34135
mhevery added a commit that referenced this pull request Dec 3, 2019
By ensuring that legacy i18n message ids are rendered into the templates
of components for packages processed by ngcc, we ensure that these packages
can be used in an application that may provide translations in a legacy
format.

Fixes #34056

PR Close #34135
mhevery added a commit that referenced this pull request Dec 3, 2019
Thanks to @gkalpakl for the better regular expression approach.

PR Close #34135
mhevery added a commit that referenced this pull request Dec 3, 2019
When first written there was no way to specify the raw text when
programmatically creating a template tagged literal AST node.

This is now fixed in TS and so the hack is no longer needed.

PR Close #34135
mhevery added a commit that referenced this pull request Dec 3, 2019
mhevery added a commit that referenced this pull request Dec 3, 2019
…ds (#34135)

This change will enable the Angular compiler to provide these legacy
message ids by default, which will solve problems with ngcc not knowing
whether to generate legacy ids or not.

PR Close #34135
mhevery added a commit that referenced this pull request Dec 3, 2019
Now that `@angular/localize` can interpret multiple legacy message ids in the
metablock of a `$localize` tagged template string, this commit adds those
ids to each i18n message extracted from component templates, but only if
the `enableI18nLegacyMessageIdFormat` is not `false`.

PR Close #34135
mhevery added a commit that referenced this pull request Dec 3, 2019
…e bundle (#34135)

Placing this configuration in to the bundle avoids having to pass the
value around through lots of function calls, but also could enable
support for different behaviour per bundle in the future.

PR Close #34135
mhevery added a commit that referenced this pull request Dec 3, 2019
By ensuring that legacy i18n message ids are rendered into the templates
of components for packages processed by ngcc, we ensure that these packages
can be used in an application that may provide translations in a legacy
format.

Fixes #34056

PR Close #34135
@petebacondarwin petebacondarwin deleted the petebacondarwin:ngcc-legacy-message-format branch Dec 4, 2019
@angular-automatic-lock-bot

This comment has been minimized.

Copy link

angular-automatic-lock-bot bot commented Jan 4, 2020

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.