Repository navigation
feat(localize): support merging multiple translation files - #36792
Closed
petebacondarwin wants to merge 3 commits into
Closed
petebacondarwin wants to merge 3 commits into
petebacondarwin wants to merge 3 commits into
Conversation
AndrewKushnir
approved these changes
Apr 24, 2020
AndrewKushnir
left a comment
Contributor
There was a problem hiding this comment.
LGTM, thanks @petebacondarwin 👍 Just left one question/proposal to consider.
petebacondarwin
force-pushed
the
i18n-merging-translation-files
branch
from
April 28, 2020 18:36
7b06907 to
38e2e0d
Compare
AndrewKushnir
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the updates Pete! I've left a few comments, could you please have a look when you get a chance?
AndrewKushnir
self-requested a review
April 29, 2020 00:57
petebacondarwin
force-pushed
the
i18n-merging-translation-files
branch
from
April 29, 2020 08:46
38e2e0d to
ebdaf62
Compare
Previously the `missingTranslation` option had to be checked before calling `warn` or `error` on the `diagnostics` object. Now this boilerplate is hidden inside the `Diagnostics.add()` method, which will open it up to being used for other conditional diagnostics.
This commit introduces `Diagnostics.merge(other)` which will take the messages from `other` and append them to the messages of `this`. The translation loader is updated to use this new method.
petebacondarwin
force-pushed
the
i18n-merging-translation-files
branch
from
April 30, 2020 19:44
ebdaf62 to
faca2a4
Compare
Previously only one translation file per locale could be loaded. Now the user can specify multiple files per locale, and the translations from each of these files will be merged together by message id. The merging is on a first-wins approach. So if to you have three files to be merged: ``` ['a.xlf', 'b.xmb', 'c.json'] ``` Then any message from `a.xlf` will be used rather than a message from `b.xmb` or `c.json` and so on. In practice this means that you should put the files in order of most important first, with "fallback" translations later.
petebacondarwin
force-pushed
the
i18n-merging-translation-files
branch
from
April 30, 2020 19:49
faca2a4 to
c2d094a
Compare
AndrewKushnir
approved these changes
Apr 30, 2020
AndrewKushnir
left a comment
Contributor
There was a problem hiding this comment.
LGTM, thanks Pete (also special thanks for the docs!) 👍
alxhub
pushed a commit
that referenced
this pull request
May 1, 2020
Previously only one translation file per locale could be loaded. Now the user can specify multiple files per locale, and the translations from each of these files will be merged together by message id. The merging is on a first-wins approach. So if to you have three files to be merged: ``` ['a.xlf', 'b.xmb', 'c.json'] ``` Then any message from `a.xlf` will be used rather than a message from `b.xmb` or `c.json` and so on. In practice this means that you should put the files in order of most important first, with "fallback" translations later. PR Close #36792
2 of 3 tasks
|
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. |
profanis
pushed a commit
to profanis/angular
that referenced
this pull request
Sep 5, 2020
) Previously the `missingTranslation` option had to be checked before calling `warn` or `error` on the `diagnostics` object. Now this boilerplate is hidden inside the `Diagnostics.add()` method, which will open it up to being used for other conditional diagnostics. PR Close angular#36792
profanis
pushed a commit
to profanis/angular
that referenced
this pull request
Sep 5, 2020
…angular#36792) This commit introduces `Diagnostics.merge(other)` which will take the messages from `other` and append them to the messages of `this`. The translation loader is updated to use this new method. PR Close angular#36792
profanis
pushed a commit
to profanis/angular
that referenced
this pull request
Sep 5, 2020
…6792) Previously only one translation file per locale could be loaded. Now the user can specify multiple files per locale, and the translations from each of these files will be merged together by message id. The merging is on a first-wins approach. So if to you have three files to be merged: ``` ['a.xlf', 'b.xmb', 'c.json'] ``` Then any message from `a.xlf` will be used rather than a message from `b.xmb` or `c.json` and so on. In practice this means that you should put the files in order of most important first, with "fallback" translations later. PR Close angular#36792
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.
Previously only one translation file per locale could be loaded.
Now the user can specify multiple files per locale, and the translations
from each of these files will be merged together by message id.
Note that the CLI uses the lower level
TranslationParserclasses directly, so will not inherit this new behaviour automatically - cc @clydin.