MichaelChirico / potools

Tools for working with translations in R
https://michaelchirico.github.io/potools/
58 stars 2 forks source link

Misleading error during translation (extra \n made to seem like extra %s) #245

Closed MichaelChirico closed 3 years ago

MichaelChirico commented 3 years ago
File: read_translation.R
Call: gettextf( "\n **Note: a similar message was previously translated as: **\n%s", msgstr[[jj]] )
Message: **Note: a similar message was previously translated as: **\n%s
                                                                     ^^
How would you translate this message into Japanese?
\n **注:以前似てるメッセージがこのように訳しました:**\n%s

** Oops! Invalid translation -- received 2 unique templated arguments but there are 1 in the original. Retrying... **

The issue is I was reading from the original Call's message which starts with \n, but this leading whitespace is eliminated from the actual message in the .pot.

Still, I found myself starting looking for what I'd done wrong -- the message makes it seem like I used %s too many times, when really \n is the culprit.

hadley commented 3 years ago

Is this the same as #8? (on plane with not-very-good wifi, so can't easily check myself)

hadley commented 3 years ago

Is this the same as #8? (on plane with not-very-good wifi, so can't easily check myself)

MichaelChirico commented 3 years ago

no, #8 is still an issue, and thornier... has to do with the text wrapping when the message to translate is very long. here was confusion about the word "template" which also includes terminal/initial newlines, so could be fixed by improving wording.