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): render context of translation file parse errors #38673
fix(localize): render context of translation file parse errors #38673
Conversation
|
a4e7a40
to
4cd7f22
Compare
Previously the position of the error in a translation file when parsing it was not displayed. Just the error message. Now the position (line and column) and some context is displayed along with the error messages. Fixes angular#38377
4cd7f22
to
cb87459
Compare
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 for improving debugging experience 👍
/** | ||
* Serialize the given `element` into a parsed translation using the given `serializer`. | ||
*/ | ||
function serializeTranslationMessage( |
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.
The function looks similar to the one declared in packages/localize/src/tools/src/translate/translation_files/translation_parsers/serialize_translation_message.ts
. I'm wondering if we can align function signatures and return errors (as well as translation) instead of passing diagnostics object?
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.
I did do that originally but it is different enough that the extra work to distinguish the two made the function much more complicated than just having a separate version for this parser.
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.
Yeah, I agree with that (to have separate implementations), but I'm wondering if their type signatures can be aligned and also the code that invokes them (in one case we register errors in the diagnostics object outside of the function, in other case - inside).
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.
Let me see what I can come up with...
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.
Thanks Pete! FYI, I'm happy with the current version too, so if it turns out to be problematic to change it, we can proceed with the current version as well.
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.
I cleaned it up a bit. PTAL.
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 for the updates Pete 👍
…ar#38673) Previously the position of the error in a translation file when parsing it was not displayed. Just the error message. Now the position (line and column) and some context is displayed along with the error messages. Fixes angular#38377 PR Close angular#38673
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. |
Previously the position of the error in a translation file when parsing
it was not displayed. Just the error message.
Now the position (line and column) and some context is displayed
along with the error messages.
Fixes #38377