-
Notifications
You must be signed in to change notification settings - Fork 11.9k
feat(@angular-devkit/build-angular): ng extract-i18n support json and arb
#19701
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
Conversation
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
|
@googlebot I fixed it. |
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
ng extract-i18n support jsonng extract-i18n support json
|
If you are extracting to JSON then surely you will need to implement merging translations stored in JSON too? See https://github.com/angular/angular/blob/master/packages/localize/src/tools/src/translate/translation_files/translation_parsers/simple_json_translation_parser.ts |
|
@petebacondarwin What do you mean by "implement merging translations"? Could you tell me the details? |
|
@wenqi73 - there are two main processes in i18n: extraction and merging (sometimes called translation or inlining). The extraction process involves parsing the code for When supporting a particular translation file format, we need to provide a serializer (used when extracting) and a parser (used when merging). |
|
@petebacondarwin It already has the JSON parser in cli,
localize-extract, it works fine!
|
|
Gadzooks! You are right! I didn't see that. Nice. OK so you are good just to add the serializer. Sorry for the noise. |
ng extract-i18n support jsonng extract-i18n support json and arb
|
@petebacondarwin I have added arb format, please have a look😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
We should then document these options too... See https://next.angular.io/cli/extract-i18n. I think that these are specfiied here https://github.com/angular/angular-cli/blob/9c57e45d4e4f433220d909ffb10c1c38f02093c4/packages/angular_devkit/build_angular/src/extract-i18n/schema.json
clydin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add an E2E test file for each of the formats?
You can use the following test file as a base (and the new tests can be placed in the same directory):
https://github.com/angular/angular-cli/blob/cfb368408b532e488acaa1a5a921240f0dc7dfad/tests/legacy-cli/e2e/tests/i18n/ivy-localize-dl-xmb.ts
clydin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes look good.
Can you re-structure the commits so that the PR contains two feature commits: one for JSON and one for ARB (with the tests for each included in their respective commits)?
With that adjustment this should be good to be merged.
Thank you for the contribution.
1243758 to
c9c8642
Compare
|
@clydin Commits have been readjusted. |
clydin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thanks again for the contribution.
|
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. |
@angular/localizesupports extracting asjsonfile, but CLI does not support this.