Skip to content

feat(@angular-devkit/build-angular): expose i18nDuplicateTranslation … #22209

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

Merged
merged 1 commit into from
Jan 11, 2022

Conversation

minijus
Copy link
Contributor

@minijus minijus commented Nov 21, 2021

…option of browser and server builders

Closes #22201

@google-cla google-cla bot added the cla: yes label Nov 21, 2021
@minijus minijus force-pushed the 22201 branch 2 times, most recently from bcaf274 to fea0498 Compare November 22, 2021 11:10
@minijus
Copy link
Contributor Author

minijus commented Nov 22, 2021

I feel that I will need some extra guidance on this one :) @alan-agius4 @petebacondarwin @alxhub your advice/feedback would be very appreciated.

Duplicate and missing translations are handled differently, and it makes sense:

  • duplicate translations can be identified during loading
  • missing translations can be identified only during inlining

To handle missing translations Diagnostics are used and there is single place which register them: https://github.com/angular/angular/blob/master/packages/localize/tools/src/source_file_utils.ts#L379

Meanwhile, duplicate translation handling (or loading of translations itself) is duplicated (pun intended):

Couple of questions:

  • Should TranslationsLoader from @angular/localize be used in CLI?
  • If not, should handling of duplicate translations in @angular/angular-cli be based on Diagnostics?
  • Should I18NTranslation (used to be I18NMissingTranslation) somehow point to DiagnosticHandlingStrategy instead?

@alan-agius4
Copy link
Collaborator

Hi @minijus,

Sorry for taking so long to get back to you.

Should TranslationsLoader from @angular/localize be used in CLI?

If that is possible, sure! But, I suspect it's not as straightforward.

If not, should handling of duplicate translations in @angular/angular-cli be based on Diagnostics?

If not, I assume that we can just change the warn here to either be ignored or changed to error.

Should I18NTranslation (used to be I18NMissingTranslation) somehow point to DiagnosticHandlingStrategy instead?

I18NTranslation is generated from a JSON schema and there is no good way that this can be replaced with an import to DiagnosticHandlingStrategy

@alan-agius4
Copy link
Collaborator

@minijus, is this something that you still want to spear head?

@minijus
Copy link
Contributor Author

minijus commented Dec 9, 2021

@minijus, is this something that you still want to spear head?

@alan-agius4 - yes, absolutely. We have a custom extract-i18n builder which splits translations per libs/projects and when building such applications the output is trashed with warnings about duplicate tranaslations. So, I am very much interested/motivated to "fix" it. And the classic part now, "just have not found enough time during last week" :)

I can close this draft PR and open it once it is ready for review if you want to keep PR list clean.

@minijus minijus marked this pull request as ready for review December 12, 2021 14:53
@minijus minijus requested a review from alan-agius4 December 12, 2021 14:53
@alan-agius4 alan-agius4 self-assigned this Dec 14, 2021
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Dec 14, 2021
@alan-agius4 alan-agius4 removed their assignment Dec 14, 2021
@alan-agius4 alan-agius4 added the target: minor This PR is targeted for the next minor release label Dec 14, 2021
Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!!! A couple of small NITS.

Can you please add a test? Maybe amend https://github.com/angular/angular-cli/blob/master/tests/legacy-cli/e2e/tests/i18n/ivy-localize-merging.ts? and amend the commit message to include Closes #22201 as the footer?

@alan-agius4 alan-agius4 added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 15, 2021
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Dec 20, 2021
Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker action: review The PR is still awaiting reviews from at least one requested reviewer and removed cla: yes action: review The PR is still awaiting reviews from at least one requested reviewer labels Jan 10, 2022
@alan-agius4 alan-agius4 removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Jan 10, 2022
@dgp1130 dgp1130 merged commit cbe028e into angular:master Jan 11, 2022
@angular-automatic-lock-bot
Copy link

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 Feb 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose '--i18n-duplicate-translation`option for build target
3 participants