-
Notifications
You must be signed in to change notification settings - Fork 523
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 bug 1616918 - Enforce newline at end of Fluent strings when compa… #1574
Conversation
…ring. This solves a detection problem with simple Fluent strings, where the newline is missing from some Fluent string in history. This enforces trailing newlines, making the selector find the correct similar translation.
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 for the fix!
I've also noticed we always show the Save button in the Source editor. Can we fix that, too? If it's non-trivial, it should be a followup bug (I assume source editor is not used very often).
(Unless you want to also fix the Source Editor, then I'll review again) :-) |
Yeah, I wanted to fix it because it was actually caused by this. Now it should work in all fluent cases. I've also added a bit more code to fix another issue with unsaved changes (I do it here because I find them as the initial translation is also used in the same translation selector, sorry for the review mess). Note that I can reproduce the unsaved changes issue I talked about locally, not sure why it doesn't happen in the case you linked to. |
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.
Great work!
I also can't seem to reproduce https://bugzilla.mozilla.org/show_bug.cgi?id=1614590 anymore. Is this expected or a side effect?
// we want to turn the string into a Fluent message, as that's simpler | ||
// to handle and less prone to errors. We do the same for each history | ||
// entry. | ||
let ftlMessage = fluent.parser.parseEntry(translation); |
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.
Nit: I don't like that we're using two inconsistent names for the seamingly same concept: ftlMessage
and fluentTranslation
.
…ring.
This solves a detection problem with simple Fluent strings, where the newline is missing from some Fluent string in history. This enforces trailing newlines, making the selector find the correct similar translation.