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

fix(localize): relax error to warning for missing target #41944

Conversation

petebacondarwin
Copy link
Member

Some localization workflows want to use the extracted source translation
files directy back in the project as a target translation file.

The extraction process generates files that only contain "source" messages
and not "target" messages. This is actually valid for most translation formats
but currently the Angular localization process expects target translation files
to always contain target messages and will stop with an error in this case.

Now, instead of an error, the translation file loader will log a warning,
and then try to falback to a source message, only erroring if this is also
missing.

Fixes #21690

Some localization workflows want to use the extracted source translation
files directy back in the project as a target translation file.

The extraction process generates files that only contain "source" messages
and not "target" messages. This is actually valid for most translation formats
but currently the Angular localization process expects target translation files
to always contain target messages and will stop with an error in this case.

Now, instead of an error, the translation file loader will log a warning,
and then try to falback to a source message, only erroring if this is also
missing.

Fixes angular#21690
@google-cla google-cla bot added the cla: yes label May 4, 2021
@petebacondarwin petebacondarwin added action: review The PR is still awaiting reviews from at least one requested reviewer area: i18n target: patch This PR is targeted for the next patch release labels May 4, 2021
@ngbot ngbot bot modified the milestone: Backlog May 4, 2021
@petebacondarwin petebacondarwin marked this pull request as ready for review May 4, 2021 15:38
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Note: not sure what the change was in tests (the diff is ~3K lines). I assume it's mostly formatting?

@AndrewKushnir AndrewKushnir removed the action: review The PR is still awaiting reviews from at least one requested reviewer label May 4, 2021
@petebacondarwin
Copy link
Member Author

petebacondarwin commented May 4, 2021

Note: not sure what the change was in tests (the diff is ~3K lines). I assume it's mostly formatting?

Oh man! It was one of those things where adding a few more lines makes the formatter go crazy. I couldn't even split it into two commits, because removing the change resulted in no reformatting!

You could try https://github.com/angular/angular/pull/41944/files?diff=split&w=1 if you like.

@petebacondarwin petebacondarwin added the action: merge The PR is ready for merge by the caretaker label May 4, 2021
@AndrewKushnir
Copy link
Contributor

@petebacondarwin I see the diff correctly now (without whitespaces), thanks :) The changes look good.

@mhevery mhevery closed this in 992c70d May 5, 2021
mhevery pushed a commit that referenced this pull request May 5, 2021
Some localization workflows want to use the extracted source translation
files directy back in the project as a target translation file.

The extraction process generates files that only contain "source" messages
and not "target" messages. This is actually valid for most translation formats
but currently the Angular localization process expects target translation files
to always contain target messages and will stop with an error in this case.

Now, instead of an error, the translation file loader will log a warning,
and then try to falback to a source message, only erroring if this is also
missing.

Fixes #21690

PR Close #41944
mhevery pushed a commit that referenced this pull request May 5, 2021
Some localization workflows want to use the extracted source translation
files directy back in the project as a target translation file.

The extraction process generates files that only contain "source" messages
and not "target" messages. This is actually valid for most translation formats
but currently the Angular localization process expects target translation files
to always contain target messages and will stop with an error in this case.

Now, instead of an error, the translation file loader will log a warning,
and then try to falback to a source message, only erroring if this is also
missing.

Fixes #21690

PR Close #41944
@petebacondarwin petebacondarwin deleted the i18n-add-render-target-option branch May 5, 2021 13:52
@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 Jun 5, 2021
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 area: i18n cla: yes target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ng xi18n Xliff no longer produces empty <target/> translations causing the Xliff parser to fail
2 participants