Skip to content

Commit ea31ee9

Browse files
Mark many src* strings for non-translation
1 parent 04dc8e4 commit ea31ee9

File tree

16 files changed

+82
-80
lines changed

16 files changed

+82
-80
lines changed

src/assign.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ SEXP assign(SEXP dt, SEXP rows, SEXP cols, SEXP newcolnames, SEXP values)
587587
targetcol = VECTOR_ELT(dt,coln);
588588
}
589589
const char *ret = memrecycle(targetcol, rows, 0, targetlen, thisvalue, 0, -1, coln+1, CHAR(STRING_ELT(names, coln)));
590-
if (ret) warning("%s", ret);
590+
if (ret) warning("%s", ret); // # notranslate
591591
}
592592

593593
*_Last_updated = numToDo; // the updates have taken place with no error, so update .Last.updated now

src/bmerge.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ SEXP bmerge(SEXP idt, SEXP xdt, SEXP icolsArg, SEXP xcolsArg, SEXP xoArg, SEXP r
187187
bmerge_r(-1,xN,-1,iN,scols,kk+1,1,1);
188188
}
189189
if (verbose)
190-
Rprintf("bmerge: looping bmerge_r took %.3fs\n", omp_get_wtime()-tic0);
190+
Rprintf(_("bmerge: looping bmerge_r took %.3fs\n"), omp_get_wtime()-tic0);
191191
}
192192
ctr += iN;
193193
if (nqmaxgrp > 1 && mult == ALL) {
@@ -219,7 +219,7 @@ SEXP bmerge(SEXP idt, SEXP xdt, SEXP icolsArg, SEXP xcolsArg, SEXP xoArg, SEXP r
219219
R_Free(retIndex);
220220
}
221221
if (verbose)
222-
Rprintf("bmerge: took %.3fs\n", omp_get_wtime()-tic);
222+
Rprintf(_("bmerge: took %.3fs\n"), omp_get_wtime()-tic);
223223
UNPROTECT(protecti);
224224
return (ans);
225225
}

src/dogroups.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ SEXP dogroups(SEXP dt, SEXP dtcols, SEXP groups, SEXP grpcols, SEXP jiscols, SEX
451451
int ETA = (int)(avgTimePerGroup*(ngrp-i-1));
452452
if (hasPrinted || ETA >= 0) {
453453
if (verbose && !hasPrinted) Rprintf(_("\n"));
454-
Rprintf("\r"); // \r is not internationalizable
454+
Rprintf("\r"); // # notranslate. \r is not internationalizable
455455
Rprintf(_("Processed %d groups out of %d. %.0f%% done. Time elapsed: %ds. ETA: %ds."), i+1, ngrp, 100.0*(i+1)/ngrp, (int)(now-startTime), ETA);
456456
}
457457
nextTime = now+1;
@@ -466,9 +466,9 @@ SEXP dogroups(SEXP dt, SEXP dtcols, SEXP groups, SEXP grpcols, SEXP jiscols, SEX
466466
else UNPROTECT(1); // the jval. Don't want them to build up. The first jval can stay protected till the end ok.
467467
}
468468
if (showProgress && hasPrinted) {
469-
Rprintf("\r"); // \r is not internationalizable
469+
Rprintf("\r"); // # notranslate. \r is not internationalizable
470470
Rprintf(_("Processed %d groups out of %d. %.0f%% done. Time elapsed: %ds. ETA: %ds."), ngrp, ngrp, 100.0, (int)(wallclock()-startTime), 0);
471-
Rprintf("\n"); // separated so this & the earlier message are identical for translation purposes.
471+
Rprintf("\n"); // # notranslate. separated so this & the earlier message are identical for translation purposes.
472472
}
473473
if (isNull(lhs) && ans!=NULL) {
474474
if (ansloc < LENGTH(VECTOR_ELT(ans,0))) {

src/fmelt.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ SEXP getvarcols(SEXP DT, SEXP dtnames, Rboolean varfactor, Rboolean verbose, str
597597
internal_error(__func__, "getvarcols %d %d", length(VECTOR_ELT(data->valuecols, 0)), data->lmax); // # nocov
598598
if (isNull(data->variable_table)) {
599599
if ((data->lvalues == 1) & data->measure_is_list) {
600-
warning("measure.vars is a list with length=1, which as long documented should return integer indices in the 'variable' column, but currently returns character column names. To increase consistency in the next release, we plan to change 'variable' to integer, so users who were relying on this behavior should change measure.vars=list('col_name') (output variable is column name now, but will become column index/integer) to measure.vars='col_name' (variable is column name before and after the planned change).");
600+
warning(_("measure.vars is a list with length=1, which as long documented should return integer indices in the 'variable' column, but currently returns character column names. To increase consistency in the next release, we plan to change 'variable' to integer, so users who were relying on this behavior should change measure.vars=list('col_name') (output variable is column name now, but will become column index/integer) to measure.vars='col_name' (variable is column name before and after the planned change)."));
601601
}
602602
if (!varfactor) {
603603
SET_VECTOR_ELT(ansvars, 0, target=allocVector(STRSXP, data->totlen));
@@ -612,7 +612,7 @@ SEXP getvarcols(SEXP DT, SEXP dtnames, Rboolean varfactor, Rboolean verbose, str
612612
for (int j=0, ansloc=0, level=1; j<data->lmax; ++j) {
613613
const int thislen = data->narm ? length(VECTOR_ELT(data->not_NA_indices, j)) : data->nrow;
614614
char buff[20];
615-
snprintf(buff, 20, "%d", level++);
615+
snprintf(buff, 20, "%d", level++); // # notranslate
616616
for (int k=0; k<thislen; ++k) SET_STRING_ELT(target, ansloc++, mkChar(buff));
617617
}
618618
}
@@ -649,7 +649,7 @@ SEXP getvarcols(SEXP DT, SEXP dtnames, Rboolean varfactor, Rboolean verbose, str
649649
for (int j=0, ansloc=0; j<data->lmax; ++j) {
650650
const int thislen = data->narm ? length(VECTOR_ELT(data->not_NA_indices, j)) : data->nrow;
651651
char buff[20];
652-
snprintf(buff, 20, "%d", nlevel+1);
652+
snprintf(buff, 20, "%d", nlevel+1); // # notranslate
653653
SET_STRING_ELT(levels, nlevel++, mkChar(buff)); // generate levels = 1:nlevels
654654
for (int k=0; k<thislen; ++k) td[ansloc++] = nlevel;
655655
}

src/forder.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static bool notFirst=false;
5959
static char msg[1001];
6060
// use STOP in this file (not error()) to ensure cleanup() is called first
6161
// snprintf to msg first in case nrow (just as an example) is provided in the message because cleanup() sets nrow to 0
62-
#define STOP(...) do {snprintf(msg, 1000, __VA_ARGS__); cleanup(); error("%s", msg);} while(0) // http://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html#Swallowing-the-Semicolon
62+
#define STOP(...) do {snprintf(msg, 1000, __VA_ARGS__); cleanup(); error("%s", msg);} while(0) // # notranslate. http://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html#Swallowing-the-Semicolon
6363

6464
#undef warning
6565
#define warning(...) Do not use warning in this file // since it can be turned to error via warn=2
@@ -511,7 +511,7 @@ SEXP forder(SEXP DT, SEXP by, SEXP retGrpArg, SEXP retStatsArg, SEXP sortGroupsA
511511
STOP(_("retStats must be TRUE or FALSE")); // # nocov # covered in reuseSorting forder
512512
retstats = LOGICAL(retStatsArg)[0]==TRUE;
513513
if (!retstats && retgrp)
514-
error("retStats must be TRUE whenever retGrp is TRUE"); // # nocov # covered in reuseSorting forder
514+
error(_("retStats must be TRUE whenever retGrp is TRUE")); // # nocov # covered in reuseSorting forder
515515
if (!IS_TRUE_OR_FALSE(sortGroupsArg))
516516
STOP(_("sort must be TRUE or FALSE")); // # nocov # covered in reuseSorting forder
517517
sortType = LOGICAL(sortGroupsArg)[0]==TRUE; // if sortType is 1, it is later flipped between +1/-1 according to ascArg. Otherwise ascArg is ignored when sortType==0
@@ -1619,7 +1619,7 @@ void putIndex(SEXP x, SEXP cols, SEXP o) {
16191619
bool GetUseIndex(void) {
16201620
SEXP opt = GetOption(install("datatable.use.index"), R_NilValue);
16211621
if (!IS_TRUE_OR_FALSE(opt))
1622-
error("'datatable.use.index' option must be TRUE or FALSE"); // # nocov
1622+
error(_("'datatable.use.index' option must be TRUE or FALSE")); // # nocov
16231623
return LOGICAL(opt)[0];
16241624
}
16251625

@@ -1632,7 +1632,7 @@ bool GetAutoIndex(void) {
16321632
if (isNull(opt))
16331633
return false;
16341634
if (!IS_TRUE_OR_FALSE(opt))
1635-
error("'datatable.forder.auto.index' option must be TRUE or FALSE"); // # nocov
1635+
error(_("'datatable.forder.auto.index' option must be TRUE or FALSE")); // # nocov
16361636
return LOGICAL(opt)[0];
16371637
}
16381638

@@ -1649,25 +1649,25 @@ SEXP forderReuseSorting(SEXP DT, SEXP by, SEXP retGrpArg, SEXP retStatsArg, SEXP
16491649
if (verbose)
16501650
tic = omp_get_wtime();
16511651
if (isNull(DT))
1652-
error("DT is NULL");
1652+
error(_("DT is NULL"));
16531653
if (!IS_TRUE_OR_FALSE(retGrpArg))
1654-
error("retGrp must be TRUE or FALSE");
1654+
error(_("retGrp must be TRUE or FALSE"));
16551655
bool retGrp = (bool)LOGICAL(retGrpArg)[0];
16561656
if (!IS_TRUE_OR_FALSE(retStatsArg))
1657-
error("retStats must be TRUE or FALSE");
1657+
error(_("retStats must be TRUE or FALSE"));
16581658
bool retStats = (bool)LOGICAL(retStatsArg)[0];
16591659
if (!retStats && retGrp)
1660-
error("retStats must be TRUE whenever retGrp is TRUE"); // retStats doesnt cost anything and it will be much easier to optimize use of index
1660+
error(_("retStats must be TRUE whenever retGrp is TRUE")); // retStats doesnt cost anything and it will be much easier to optimize use of index
16611661
if (!IS_TRUE_OR_FALSE(sortGroupsArg))
1662-
error("sort must be TRUE or FALSE");
1662+
error(_("sort must be TRUE or FALSE"));
16631663
bool sortGroups = (bool)LOGICAL(sortGroupsArg)[0];
16641664
if (!isLogical(naArg) || LENGTH(naArg) != 1)
1665-
error("na.last must be logical TRUE, FALSE or NA of length 1");
1665+
error(_("na.last must be logical TRUE, FALSE or NA of length 1"));
16661666
bool na = (bool)LOGICAL(naArg)[0];
16671667
if (!isInteger(ascArg))
1668-
error("order must be integer"); // # nocov # coerced to int in R
1668+
error(_("order must be integer")); // # nocov # coerced to int in R
16691669
if (!isLogical(reuseSortingArg) || LENGTH(reuseSortingArg) != 1)
1670-
error("reuseSorting must be logical TRUE, FALSE or NA of length 1");
1670+
error(_("reuseSorting must be logical TRUE, FALSE or NA of length 1"));
16711671
int reuseSorting = LOGICAL(reuseSortingArg)[0];
16721672
if (!length(DT))
16731673
return allocVector(INTSXP, 0);
@@ -1679,7 +1679,7 @@ SEXP forderReuseSorting(SEXP DT, SEXP by, SEXP retGrpArg, SEXP retStatsArg, SEXP
16791679
opt = -1;
16801680
} else {
16811681
if (verbose)
1682-
Rprintf("forderReuseSorting: opt not possible: is.data.table(DT)=%d, sortGroups=%d, all1(ascArg)=%d\n", INHERITS(DT,char_datatable), sortGroups, all1(ascArg));
1682+
Rprintf(_("forderReuseSorting: opt not possible: is.data.table(DT)=%d, sortGroups=%d, all1(ascArg)=%d\n"), INHERITS(DT,char_datatable), sortGroups, all1(ascArg));
16831683
opt = 0;
16841684
}
16851685
} else if (reuseSorting) {
@@ -1698,7 +1698,7 @@ SEXP forderReuseSorting(SEXP DT, SEXP by, SEXP retGrpArg, SEXP retStatsArg, SEXP
16981698
opt = 1; // keyOpt
16991699
ans = PROTECT(allocVector(INTSXP, 0)); protecti++;
17001700
if (verbose)
1701-
Rprintf("forderReuseSorting: using key: %s\n", CHAR(STRING_ELT(idxName(DT, by), 0)));
1701+
Rprintf(_("forderReuseSorting: using key: %s\n"), CHAR(STRING_ELT(idxName(DT, by), 0)));
17021702
}
17031703
if (opt == -1 && GetUseIndex()) {
17041704
SEXP idx = getIndex(DT, by);
@@ -1733,31 +1733,31 @@ SEXP forderReuseSorting(SEXP DT, SEXP by, SEXP retGrpArg, SEXP retStatsArg, SEXP
17331733
opt = 2; // idxOpt but need to drop groups or stats
17341734
} else if (!hasGrp && retGrp && !hasStats && retStats) {
17351735
if (verbose)
1736-
Rprintf("forderReuseSorting: index found but not for retGrp and retStats: %s\n", CHAR(STRING_ELT(idxName(DT, by), 0)));
1736+
Rprintf(_("forderReuseSorting: index found but not for retGrp and retStats: %s\n"));, CHAR(STRING_ELT(idxName(DT, by), 0)));
17371737
} else if (!hasGrp && retGrp) {
17381738
if (verbose)
1739-
Rprintf("forderReuseSorting: index found but not for retGrp: %s\n", CHAR(STRING_ELT(idxName(DT, by), 0)));
1739+
Rprintf(_("forderReuseSorting: index found but not for retGrp: %s\n"));, CHAR(STRING_ELT(idxName(DT, by), 0)));
17401740
} else if (!hasStats && retStats) {
17411741
if (verbose)
1742-
Rprintf("forderReuseSorting: index found but not for retStats: %s\n", CHAR(STRING_ELT(idxName(DT, by), 0)));
1742+
Rprintf(_("forderReuseSorting: index found but not for retStats: %s\n"));, CHAR(STRING_ELT(idxName(DT, by), 0)));
17431743
} else {
17441744
internal_error_with_cleanup(__func__, "reuseSorting forder index optimization unhandled branch of retGrp-retStats"); // # nocov
17451745
}
17461746
} else {
17471747
if (!hasStats) {
17481748
if (verbose)
1749-
Rprintf("forderReuseSorting: index found but na.last=TRUE and no stats available: %s\n", CHAR(STRING_ELT(idxName(DT, by), 0)));
1749+
Rprintf(_("forderReuseSorting: index found but na.last=TRUE and no stats available: %s\n"));, CHAR(STRING_ELT(idxName(DT, by), 0)));
17501750
} else if (idxAnyNF(idx)) {
17511751
if (verbose)
1752-
Rprintf("forderReuseSorting: index found but na.last=TRUE and NAs present: %s\n", CHAR(STRING_ELT(idxName(DT, by), 0)));
1752+
Rprintf(_("forderReuseSorting: index found but na.last=TRUE and NAs present: %s\n"));, CHAR(STRING_ELT(idxName(DT, by), 0)));
17531753
} else {
17541754
internal_error_with_cleanup(__func__, "reuseSorting forder index optimization unhandled branch of last.na=T"); // # nocov
17551755
}
17561756
}
17571757
if (opt == 2) {
17581758
ans = idx;
17591759
if (verbose)
1760-
Rprintf("forderReuseSorting: using existing index: %s\n", CHAR(STRING_ELT(idxName(DT, by), 0)));
1760+
Rprintf(_("forderReuseSorting: using existing index: %s\n"));, CHAR(STRING_ELT(idxName(DT, by), 0)));
17611761
}
17621762
}
17631763
}
@@ -1769,11 +1769,11 @@ SEXP forderReuseSorting(SEXP DT, SEXP by, SEXP retGrpArg, SEXP retStatsArg, SEXP
17691769
GetAutoIndex()) { // disabled by default, use datatable.forder.auto.index=T to enable, do not export/document, use for debugging only
17701770
putIndex(DT, by, ans);
17711771
if (verbose)
1772-
Rprintf("forderReuseSorting: setting index (retGrp=%d, retStats=%d) on DT: %s\n", retGrp, retStats, CHAR(STRING_ELT(idxName(DT, by), 0)));
1772+
Rprintf(_("forderReuseSorting: setting index (retGrp=%d, retStats=%d) on DT: %s\n"));, retGrp, retStats, CHAR(STRING_ELT(idxName(DT, by), 0)));
17731773
}
17741774
}
17751775
if (verbose)
1776-
Rprintf("forderReuseSorting: opt=%d, took %.3fs\n", opt, omp_get_wtime()-tic);
1776+
Rprintf(_("forderReuseSorting: opt=%d, took %.3fs\n"));, opt, omp_get_wtime()-tic);
17771777
UNPROTECT(protecti);
17781778
return ans;
17791779
}

src/fread.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -424,18 +424,18 @@ static const char* filesize_to_str(size_t fsize)
424424
}
425425
if (ndigits == 0 || (fsize == (fsize >> shift << shift))) {
426426
if (i < NSUFFIXES) {
427-
snprintf(output, BUFFSIZE, "%"PRIu64"%cB (%"PRIu64" bytes)",
427+
snprintf(output, BUFFSIZE, "%"PRIu64"%cB (%"PRIu64" bytes)", // # notranslate
428428
(uint64_t)(lsize >> shift), suffixes[i], (uint64_t)lsize);
429429
return output;
430430
}
431431
} else {
432-
snprintf(output, BUFFSIZE, "%.*f%cB (%"PRIu64" bytes)",
432+
snprintf(output, BUFFSIZE, "%.*f%cB (%"PRIu64" bytes)", // # notranslate
433433
ndigits, (double)fsize / (1LL << shift), suffixes[i], (uint64_t)lsize);
434434
return output;
435435
}
436436
}
437437
if (fsize == 1) return one_byte;
438-
snprintf(output, BUFFSIZE, "%"PRIu64" bytes", (uint64_t)lsize);
438+
snprintf(output, BUFFSIZE, "%"PRIu64" bytes", (uint64_t)lsize); // # notranslate
439439
return output;
440440
}
441441
double copyFile(size_t fileSize) // only called in very very rare cases
@@ -1563,7 +1563,7 @@ int freadMain(freadMainArgs _args) {
15631563
if (time_taken == -1.0) {
15641564
// # nocov start
15651565
if (!verbose)
1566-
DTPRINT("%s. Attempt to copy file in RAM failed.", msg);
1566+
DTPRINT(_("%s. Attempt to copy file in RAM failed."), msg);
15671567
STOP(_("Unable to allocate %s of contiguous virtual RAM."), filesize_to_str(fileSize));
15681568
// # nocov end
15691569
}
@@ -1730,7 +1730,7 @@ int freadMain(freadMainArgs _args) {
17301730
topQuoteRule = quoteRule;
17311731
firstJumpEnd = ch; // to know how many bytes jump 0 is, for nrow estimate later (a less-good estimate when fill=true since line lengths vary more)
17321732
if (verbose) {
1733-
DTPRINT((unsigned)sep<32 ? " sep=%#02x" : " sep='%c'", sep);
1733+
DTPRINT((unsigned)sep<32 ? " sep=%#02x" : " sep='%c'", sep); // # notranslate
17341734
DTPRINT(_(" with %d fields using quote rule %d\n"), topNumFields, quoteRule);
17351735
}
17361736
}
@@ -1780,7 +1780,7 @@ int freadMain(freadMainArgs _args) {
17801780
topSkip = thisRow-thisBlockLines;
17811781
if (topSkip<0) topSkip=0; // inelegant but will do for now to pass single row input such as test 890
17821782
if (verbose) {
1783-
DTPRINT((unsigned)sep<32 ? " sep=%#02x" : " sep='%c'", sep);
1783+
DTPRINT((unsigned)sep<32 ? " sep=%#02x" : " sep='%c'", sep); // # notranslate
17841784
DTPRINT(_(" with %d lines of %d fields using quote rule %d\n"), topNumLines, topNumFields, topQuoteRule);
17851785
}
17861786
}
@@ -1847,7 +1847,7 @@ int freadMain(freadMainArgs _args) {
18471847
if (time_taken == -1.0) {
18481848
// # nocov start
18491849
if (!verbose)
1850-
DTPRINT("%s. Attempt to copy file in RAM failed.", msg);
1850+
DTPRINT(_("%s. Attempt to copy file in RAM failed."), msg);
18511851
STOP(_("Unable to allocate %s of contiguous virtual RAM."), filesize_to_str(fileSize));
18521852
// # nocov end
18531853
}
@@ -2303,7 +2303,7 @@ int freadMain(freadMainArgs _args) {
23032303
nth = omp_get_num_threads();
23042304
if (me!=0) {
23052305
// # nocov start
2306-
snprintf(internalErr, internalErrSize, "Master thread is not thread 0 but thread %d.\n", me);
2306+
snprintf(internalErr, internalErrSize, "Master thread is not thread 0 but thread %d.\n", me); // # notranslate
23072307
stopTeam = true;
23082308
// # nocov end
23092309
}
@@ -2567,7 +2567,7 @@ int freadMain(freadMainArgs _args) {
25672567
}
25682568
else if (headPos!=thisJumpStart && nrowLimit>0) { // do not care for dirty jumps since we do not read data and only want to know types
25692569
// # nocov start
2570-
snprintf(internalErr, internalErrSize, "invalid head position. jump=%d, headPos=%p, thisJumpStart=%p, sof=%p", jump, (void*)headPos, (void*)thisJumpStart, (void*)sof);
2570+
snprintf(internalErr, internalErrSize, "invalid head position. jump=%d, headPos=%p, thisJumpStart=%p, sof=%p", jump, (void*)headPos, (void*)thisJumpStart, (void*)sof); // # notranslate
25712571
stopTeam = true;
25722572
// # nocov end
25732573
}
@@ -2773,7 +2773,7 @@ int freadMain(freadMainArgs _args) {
27732773
if (tTot<0.000001) tTot=0.000001; // to avoid nan% output in some trivially small tests where tot==0.000s
27742774
DTPRINT(_("%8.3fs (%3.0f%%) Memory map %.3fGB file\n"), tMap-t0, 100.0*(tMap-t0)/tTot, 1.0*fileSize/(1024*1024*1024));
27752775
DTPRINT(_("%8.3fs (%3.0f%%) sep="), tLayout-tMap, 100.0*(tLayout-tMap)/tTot);
2776-
DTPRINT(sep=='\t' ? "'\\t'" : (sep=='\n' ? "'\\n'" : "'%c'"), sep);
2776+
DTPRINT(sep=='\t' ? "'\\t'" : (sep=='\n' ? "'\\n'" : "'%c'"), sep); // # notranslate
27772777
DTPRINT(_(" ncol=%d and header detection\n"), ncol);
27782778
DTPRINT(_("%8.3fs (%3.0f%%) Column type detection using %"PRIu64" sample rows\n"),
27792779
tColType-tLayout, 100.0*(tColType-tLayout)/tTot, (uint64_t)sampleLines);
@@ -2793,7 +2793,7 @@ int freadMain(freadMainArgs _args) {
27932793
// if type bumps happened, it's useful to see them at the end after the timing 2 lines up showing the reread time
27942794
// TODO - construct and output the copy and pastable colClasses argument so user can avoid the reread time if they are
27952795
// reading this file or files formatted like it many times (say in a production environment).
2796-
DTPRINT("%s", typeBumpMsg);
2796+
DTPRINT("%s", typeBumpMsg); // # notranslate
27972797
free(typeBumpMsg); // local scope and only populated in verbose mode
27982798
}
27992799
}

0 commit comments

Comments
 (0)