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

uk: avoid translating fixed strings in protobufs #2507

Closed
wants to merge 1 commit into from

Conversation

mgeisler
Copy link
Collaborator

@mgeisler mgeisler commented Dec 9, 2024

The protobuf exercise asks people to decode a few fixed byte slices:

https://google.github.io/comprehensive-rust/uk/lifetimes/exercise.html

Some of the messages in the slices are fixed English strings, such as “home”. They should thus not be translated into other languages.

This should fix the CI. I guess it wasn’t caught before merging because of a parallel update.

The protobuf exercise asks people to decode a few fixed byte slices:

  https://google.github.io/comprehensive-rust/uk/lifetimes/exercise.html

Some of the messages in the slices are fixed English strings, such as
“home”. They should thus not be translated into other languages.

This should fix the CI. I guess it wasn’t caught before merging
because of a parallel update.
@mgeisler
Copy link
Collaborator Author

mgeisler commented Dec 9, 2024

Made obsolete by #2506.

@reta, in case you weren't aware, the best way to indicate that a string should remain untranslated is to copy the msgid to the msgstr. That way, it won't show up as untranslated.

@mgeisler mgeisler closed this Dec 9, 2024
@mgeisler mgeisler deleted the uk-avoid-protobuf-translations branch December 9, 2024 09:49
@reta
Copy link
Contributor

reta commented Dec 9, 2024

@reta, in case you weren't aware, the best way to indicate that a string should remain untranslated is to copy the msgid to the msgstr. That way, it won't show up as untranslated.

Thanks @mgeisler , yes I am aware of that but it makes a bit difficult to track new messages that require translation (they are always having empty msgstr) vs the ones where translation is not required. Thanks for the hint anyway!

@mgeisler
Copy link
Collaborator Author

@reta, in case you weren't aware, the best way to indicate that a string should remain untranslated is to copy the msgid to the msgstr. That way, it won't show up as untranslated.

Thanks @mgeisler , yes I am aware of that but it makes a bit difficult to track new messages that require translation (they are always having empty msgstr) vs the ones where translation is not required.

Okay, though I don't understand how it makes difficult to track new messages? You will have

msgid "untranslated"
msgstr ""

msgid "no-op translation"
msgstr "no-op translation"

in the uk.po file. So new messages are those with an empty msgstr, the already translated messages (no-op or not) will have a non-empty msgstr.

If a no-op translation changes, you end up with something like

#, fuzzy
msgid "changed no-op translation"
msgstr "no-op translation"

The fuzzy entry will be ignored when building the book, thus resulting in "changed no-op translation" showing up, which is what you'll want.

@reta
Copy link
Contributor

reta commented Dec 10, 2024

The fuzzy entry will be ignored when building the book, thus resulting in "changed no-op translation" showing up, which is what you'll want.

Thanks @mgeisler , this is correct, I have difficulties to track this case:

msgid "untranslated-does-not-need-to"
msgstr ""
msgid "new-translation-that-need-to-be-translated"
msgstr ""

May be this is a flaw in my workflow only, but thanks a lot for sharing your thoughts over it.

@reta
Copy link
Contributor

reta commented Dec 10, 2024

@reta, in case you weren't aware, the best way to indicate that a string should remain untranslated is to copy the msgid to the msgstr. That way, it won't show up as untranslated.

@mgeisler my sincere apologies, I completely misread your initial suggestion, this is exactly the way we (I) should be doing it, sorry about that. Please disregard my previous comment.

@mgeisler
Copy link
Collaborator Author

@reta, in case you weren't aware, the best way to indicate that a string should remain untranslated is to copy the msgid to the msgstr. That way, it won't show up as untranslated.

@mgeisler my sincere apologies, I completely misread your initial suggestion, this is exactly the way we (I) should be doing it, sorry about that. Please disregard my previous comment.

No worries at all! 😄

Since all this is not very obvious to anybody, I guess we should add a line or two about it to the TRANSLATING documentation. Ideally, we should not put these useless strings into the PO files in the first place (and #2478 can help with that), but when they are there, we need to help people get them out of their way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants