Repository navigation
I18n localize - compile-time - #32105
Closed
petebacondarwin wants to merge 7 commits into
Closed
petebacondarwin wants to merge 7 commits into
petebacondarwin wants to merge 7 commits into
Conversation
petebacondarwin
force-pushed
the
i18n-localize-babel
branch
from
August 16, 2019 08:37
2f23beb to
9aa8438
Compare
petebacondarwin
force-pushed
the
i18n-localize-babel
branch
12 times, most recently
from
August 29, 2019 21:19
673baa2 to
c1c1177
Compare
ocombe
reviewed
Aug 30, 2019
Contributor
|
Note: all the commits up to |
ocombe
reviewed
Aug 30, 2019
ocombe
reviewed
Aug 30, 2019
ocombe
reviewed
Aug 30, 2019
petebacondarwin
force-pushed
the
i18n-localize-babel
branch
8 times, most recently
from
September 3, 2019 16:08
6cdc0e5 to
b3df960
Compare
petebacondarwin
force-pushed
the
i18n-localize-babel
branch
6 times, most recently
from
September 13, 2019 11:58
d1b9f88 to
4a81f7f
Compare
petebacondarwin
force-pushed
the
i18n-localize-babel
branch
from
September 25, 2019 07:39
4a81f7f to
1daf473
Compare
…placeholder Previously if a translation contains a placeholder that does not exist in the message being translated, that placeholder is evaluated as `undefined`. Translations should never contain such placeholder names so now `translate` will throw a helpful error in instead.
The missing translation and invalid placeholder warnings now contain the "meaning" if one was provided.
Previously the metadata and placeholder blocks were serialized in a variety of places. Moreover the code for creating the `LocalizedString` AST node was doing serialization, which break the separation of concerns. Now this is all done by the code that renders the AST and is refactored into helper functions to avoid repeating the behaviour.
Metadata blocks are delimited by colons. Previously the code naively just looked for the next colon in the string as the end marker. This commit supports escaping colons within the metadata content. The Angular compiler has been updated to add escaping as required.
In an attempt to be compatible with previous translation files the Angular compiler was generating instructions that always included the message id. This was because it was not possible to accurately re-generate the id from the calls to `$localize()` alone. In line with https://hackmd.io/EQF4_-atSXK4XWg8eAha2g this commit changes the compiler so that it only renders ids if they are "custom" ones provided by the template author. BREAKING CHANGE: When translating messages generated by the Angular compiler from i18n tags in templates, the `$localize.translate()` function will compute message ids, if no custom id is provided, using a common digest function that only relies upon the information available in the `$localize()` calls. This computed message id will not be the same as the message ids stored in legacy translation files. Such files will need to be migrated to use the new common digest function. This only affects developers who have been trialling `$localize`, have been calling `loadTranslations()`, and are not exclusively using custom ids in their templates.
This commit provides the main pieces for inlining translations at compile-time.
petebacondarwin
force-pushed
the
i18n-localize-babel
branch
from
September 26, 2019 15:50
1daf473 to
8093b11
Compare
Contributor
Author
|
Closing in favour of #32881 |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Blocked on #32594
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information