Repository navigation
Multiple small issues with messages in the C code #6503
Copy link
Copy link
Open
Labels
questiontranslationissues/PRs related to message translation projectsissues/PRs related to message translation projects
Description
This is a continuation of #6482. I think I won't find any more issues in the C code messages. Some of these are questions, a few indicate real translation hurdles.
- This one is actually possible for me to translate in parts (so we can keep it as is if needed), but I don't like translating individual words and relying on the rest of the code not to need a different translation:
Lines 1933 to 1934 in 9443409
if (verbose) DTPRINT(_(" A line with too-%s fields (%d/%d) was found on line %d of sample jump %d. %s\n"), thisNcol<ncol ? _("few") : _("many"), thisNcol, ncol, jumpLine, jump, jump>0 ? _("Most likely this jump landed awkwardly so type bumps here will be skipped.") : "");
Translation in parts could be done reliably withpgettext, which seems to be currently unavailable even to C code in R's built-in copy ofgettexton Windows. - This one is also translatable in context, but isn't too painful to recombine into a single sentence:
Lines 255 to 259 in 9443409
Rprintf(_("Reduced MSBsize from %zu to "), MSBsize); } while (MSBsize>0 && msbCounts[order[MSBsize-1]] < 2) MSBsize--; if (verbose) { Rprintf(_("%zu by excluding 0 and 1 counts\n"), MSBsize); - This one is very awkward to translate, and we're again relying on
_("no")not to mean something else in a different part of the code:
Line 2038 in 9443409
DTPRINT(_(" 'header' determined to be %s because there are%s number fields in the first and only row\n"), args.header?"TRUE":"FALSE", args.header?_(" no"):"");
Unfortunately, expanding this sentence will duplicate the full line of the code.
The rest are questions unrelated to translations:
- I think we shouldn't be calling it ASCII if its
/is not immediately before0. How about "The character '/' is not just before '0' in the source character set"?
Line 225 in 9443409
if ((uint_fast8_t)('0'-'/') != 1) error(_("The ascii character '/' is not just before '0'"));
Line 227 in 9443409
if ((uint_fast8_t)(':'-'9') != 1) error(_("The ascii character ':' is not just after '9'")); - This one probably used to be correct in the past, but now should refer to a different variable,
.Last.updated:
Line 367 in 9443409
if (!isInteger(var) || LENGTH(var)!=1) error(_(".Last.value in namespace is not a length 1 integer")); - This message is technically correct because the code does expect only symbols at this point, but
data.table:::list2langconverts character strings to symbols. Would it be more helpful to mention character strings in the error message too?
Line 16 in 9443409
error(_("Attempting to substitute '%s' element with object of type '%s' but it has to be 'symbol' type when substituting name of the call argument, functions 'as.name' and 'I' can be used to work out proper substitution, see ?substitute2 examples."), CHAR(STRING_ELT(arg_names, i)), type2char(TYPEOF(sym))); - Should this mention the issue tracker instead?
Line 805 in 9443409
if (isNull(dtnames)) error(_("names(data) is NULL. Please report to data.table-help")); - Is
LENGTH(.) < 0something that's possible in R ≥ 3.3.0?
Line 66 in 9443409
if (!isInteger(idx) || length(idx) < 0) error(_("concat: 'idx' must be an integer vector of length >= 0"));
(Checkboxes indicate either no action needed or a corresponding fix being suggested in #6504)
Metadata
Metadata
Assignees
Labels
questiontranslationissues/PRs related to message translation projectsissues/PRs related to message translation projects
Activity
tdhock commentedon Sep 17, 2024
yes
MichaelChirico commentedon Sep 17, 2024
I guess you're referring to
few/many, not thejump>0complete sentence added at the end. If so: yes, I think we should branch it.Hmm, good point, though I worry "source character set" is a highly technical term --> relatively tough to translate. WDYT about "Unlike the very common case, e.g. ASCII, the character '/' is not just before '0'".
Ping @jangorecki who has the best context here
Good spot. Has it ever been possible? My best guess was this was a somewhat half-baked fix here:
437dc39
Author fixed the
length=0case to work and changed the message to adapt without stopping to think "length<0is not possible" instead of "how do I adaptx<=0 | x>0to includex=0valid?x<0 | x>=0".So I think we can just drop that condition and the corresponding part of the message.
aitap commentedon Sep 17, 2024
Yes, I mean the part about
few/many. Could you please clarify what you meant by "branch it"?Agreed, this phrasing sounds fine.
...which started out as a check for "opposite of
length() > 0". Will remove the condition and adjust the message.MichaelChirico commentedon Sep 17, 2024
thisNcol < ncol ? _("A line with too few fields...") : _("A line with too many fields...)"jangorecki commentedon Sep 17, 2024
No idea really, but I can imagine some hacks in setting up length to negative value, that could have been in play.
rikivillalba commentedon Sep 17, 2024
some contribs
data.table/src/fread.c
Line 1343 in 3b376da
data.table/src/gsumm.c
Lines 224 to 225 in 3b376da
STOP(_("Internal error in %s: %s. Please report to the data.table issues tracker", __func__, internalErr);data.table/src/fread.c
Line 2627 in 3b376da
data.table/src/fread.c
Line 1711 in 3b376da
MichaelChirico commentedon Sep 18, 2024
[aside/FYI @rikivillalba if your permalink includes column numbers (
C10,C23in your 2nd bullet before my edit), it won't render inline in the issue. I don't know why GitHub sometimes includes the column numbers]aitap commentedon Sep 18, 2024
@jangorecki I'm not seeing calls to
SETLENGTHinfmelt.c, but I do know thatdata.tableuses negativeTRUELENGTHfor its internal purposes. Hmm.@rikivillalba Thank you for reminding me! There's quite a lot of debugging printout that consists of argument/variable names that (arguably) should not be translated:
data.table/src/assign.c
Line 440 in d7e95d1
data.table/src/bmerge.c
Line 69 in d7e95d1
data.table/src/dogroups.c
Line 109 in d7e95d1
data.table/src/dogroups.c
Line 138 in d7e95d1
data.table/src/dogroups.c
Line 154 in d7e95d1
data.table/src/dogroups.c
Lines 162 to 163 in d7e95d1
data.table/src/dogroups.c
Line 402 in d7e95d1
data.table/src/forder.c
Line 784 in d7e95d1
jump0size==0) in the middle:data.table/src/fread.c
Lines 1891 to 1896 in d7e95d1
data.table/src/fread.c
Line 2261 in d7e95d1
data.table/src/freadR.c
Line 158 in d7e95d1
data.table/src/fsort.c
Line 122 in d7e95d1
data.table/src/fsort.c
Line 178 in d7e95d1
data.table/src/fwrite.c
Lines 638 to 639 in d7e95d1
data.table/src/gsumm.c
Line 63 in d7e95d1
mygetenv, which may be not that important:data.table/src/openmp-utils.c
Lines 89 to 97 in d7e95d1
data.table/src/reorder.c
Line 39 in d7e95d1
Which of these should have their
_removed? Which should be translated anyway?MichaelChirico commentedon Sep 18, 2024
for those, I think we need a system for marking "notranslate" at the same time, so that CI/release doesn't keep finding these strings that are in translateable calls, just not useful to translate.
In potools, that's
// # notranslate.Let's open another separate issue for those, it's a bit different from the topic at hand.
aitap commentedon Sep 19, 2024
xgettext: the string eventually given togettext()will not be translated becausexgettexthad split it into parts, including"%":data.table/src/assign.c
Lines 944 to 945 in d7e95d1
Edit: hmm, I don't see "at RHS position" at all in the official
*.potfile. Nevertheless, I don't thinkxgettexthandles compile-time string concatenation in general.MichaelChirico commentedon Sep 23, 2024
Re: the previous comment, any suggested fix? The first things that come to mind seem messy. Maybe we should functionalize the macro...
aitap commentedon Sep 23, 2024
The core of the problem is that even if we do follow the recommendation to format the number into a temporary buffer and then use
%sfor all number formats, we still have a combinatorial explosion of 7 (TO) ⋅ 2 (target vector/column %d named '%s') strings thatxgettextwants spelled out in the source code.Can we cheat a little and split the clauses into two sentences? Then we'll have
and
...which is more manageable. The strings could be rephrased further, making them truly separate sentences (
The problem happened when assigning to type '%s' (target vector).).MichaelChirico commentedon Sep 27, 2024
cc @jangorecki. I'm not sure what change you have in mind exactly, but I think the call-out to consult
?substitute2is the most helpful part. I worry adding to the message will make it over-complicated.MichaelChirico commentedon Sep 27, 2024
Good spot, there's a similar fragment below. It's a bit hard to pull apart exactly how we'd make this friendlier. I think the best bet is to make each fragment a standalone sentence. I'll want to read more carefully how exactly those show up in the verbose output. Filing as a separate issue so it's not lost, there's already a lot going on here.