Skip to content

Commit 1509782

Browse files
Add 'notranslate' in R files, add a mark new strings for translation
1 parent 5e5ee93 commit 1509782

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

R/between.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ inrange = function(x,lower,upper,incbounds=TRUE) {
7575
ops = if (incbounds) c(4L, 2L) else c(5L, 3L) # >=,<= and >,<
7676
verbose = isTRUE(getOption("datatable.verbose"))
7777
if (verbose) {last.started.at=proc.time();catf("forderv(query) took ... ");flush.console()}
78-
if (verbose) {cat(timetaken(last.started.at),"\n"); flush.console()}
78+
if (verbose) {cat(timetaken(last.started.at),"\n"); flush.console()} # notranslate
7979
ans = bmerge(
8080
shallow(subject), query,
8181
icols=1L:2L, xcols=c(1L, 1L),

R/data.table.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ replace_dot_alias = function(e) {
577577
} else {
578578
irows = as.integer(fsort(as.numeric(irows))) ## nocov; parallelized for numeric, but overhead of type conversion
579579
}
580-
if (verbose) {cat(timetaken(last.started.at), "\n");flush.console()}
580+
if (verbose) {cat(timetaken(last.started.at), "\n");flush.console()} # notranslate
581581
}
582582
## make sure, all columns are taken from x and not from i.
583583
## This is done by simply telling data.table to continue as if there was a simple subset

R/print.data.table.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ print.data.table = function(x, topn=getOption("datatable.print.topn"),
5757
catf("Null data.%s (0 rows and 0 cols)\n", class) # See FAQ 2.5 and NEWS item in v1.8.9
5858
} else {
5959
catf("Empty data.%s (%d rows and %d cols)", class, NROW(x), NCOL(x))
60-
if (length(x)>0L) cat(": ",paste(head(names(x),6L),collapse=","),if(length(x)>6L)"...",sep="")
61-
cat("\n")
60+
if (length(x)>0L) cat(": ",paste(head(names(x),6L),collapse=","),if(length(x)>6L)"...",sep="") # notranslate
61+
cat("\n") # notranslate
6262
}
6363
return(invisible(x))
6464
}

R/test.data.table.R

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ test.data.table = function(script="tests.Rraw", verbose=FALSE, pkg=".", silent=F
110110
datatable.old.fread.datetime.character = FALSE
111111
)
112112

113-
cat("getDTthreads(verbose=TRUE):\n") # for tracing on CRAN; output to log before anything is attempted
113+
cat("getDTthreads(verbose=TRUE):\n") # notranslate: for tracing on CRAN; output to log before anything is attempted
114114
getDTthreads(verbose=TRUE) # includes the returned value in the verbose output (rather than dangling '[1] 4'); e.g. "data.table is using 4 threads"
115115
catf("test.data.table() running: %s\n", fn) # print fn to log before attempting anything on it (in case it is missing); on same line for slightly easier grep
116116
assign("testDir", function(x) file.path(fulldir, x), envir=env)
@@ -226,6 +226,7 @@ test.data.table = function(script="tests.Rraw", verbose=FALSE, pkg=".", silent=F
226226
# does show the full file output these days, so the 13 line limit no longer bites so much. It still bit recently
227227
# when receiving output of R CMD check sent over email, though.
228228
tz = Sys.getenv("TZ", unset=NA)
229+
# notranslate start
229230
cat("\n", date(), # so we can tell exactly when these tests ran on CRAN to double-check the result is up to date
230231
" endian==", .Platform$endian,
231232
", sizeof(long double)==", .Machine$sizeof.longdouble,
@@ -239,6 +240,7 @@ test.data.table = function(script="tests.Rraw", verbose=FALSE, pkg=".", silent=F
239240
", .libPaths()==", paste0("'", .libPaths(), "'", collapse = ","),
240241
", ", .Call(Cdt_zlib_version),
241242
"\n", sep="")
243+
# notranslate end
242244

243245
if (inherits(err,"try-error")) {
244246
# nocov start
@@ -303,7 +305,7 @@ compactprint = function(DT, topn=2L) {
303305
print(copy(DT)[,(cn):="",verbose=FALSE], topn=topn, class=FALSE)
304306
} else {
305307
print(DT, class=FALSE) # "Empty data.table (0 rows) of <ncol> columns ...
306-
if (ncol(DT)) cat(cn,"\n")
308+
if (ncol(DT)) cat(cn,"\n") # notranslate
307309
}
308310
invisible()
309311
}
@@ -376,14 +378,15 @@ test = function(num,x,y=TRUE,error=NULL,warning=NULL,message=NULL,output=NULL,no
376378
if (memtest==1L) gc() # see #5515 for before/after
377379
inum = as.integer(num)
378380
timings[inum, RSS:=max(rss(),RSS), verbose=FALSE] # TODO prefix inum with .. for clarity when that works
379-
if (length(memtest.id) && memtest.id[1L]<=inum && inum<=memtest.id[2L]) cat(rss(),"\n") # after 'testing id ...' output; not using between() as it has verbose output when getOption(datatable.verbose)
381+
if (length(memtest.id) && memtest.id[1L]<=inum && inum<=memtest.id[2L]) cat(rss(),"\n") # notranslate. after 'testing id ...' output; not using between() as it has verbose output when getOption(datatable.verbose)
380382
if (memtest==2L) gc()
381383
}
382384
assign("lasttime", proc.time()[3L], parent.frame(), inherits=TRUE) # after gc() to exclude gc() time from next test when memtest
383385
}, add=TRUE )
384-
if (showProgress)
385-
# \r can't be in gettextf msg
386-
cat("\rRunning test id", numStr, " ") # nocov.
386+
if (showProgress) {
387+
cat("\r") # notranslate: \r can't be in gettextf msg
388+
catf("Running test id", numStr, " ") # nocov.
389+
}
387390
# See PR #4090 for comments about change here in Dec 2019.
388391
# If a segfault error occurs in future and we'd like to know after which test, then arrange for the
389392
# try(sys.source()) in test.data.table() to be run in a separate R process. That process could write out
@@ -534,15 +537,15 @@ test = function(num,x,y=TRUE,error=NULL,warning=NULL,message=NULL,output=NULL,no
534537
if (!fail) {
535538
catf("Test %s ran without errors but failed check that x equals y:\n", numStr)
536539
failPrint = function(x, xsub) {
537-
cat(">", substitute(x), "=", xsub, "\n")
540+
cat(">", substitute(x), "=", xsub, "\n") # notranslate
538541
if (is.data.table(x)) compactprint(x) else {
539542
nn = length(x)
540543
catf("First %d of %d (type '%s'): \n", min(nn, 6L), length(x), typeof(x))
541544
# head.matrix doesn't restrict columns
542545
if (length(d <- dim(x))) do.call(`[`, c(list(x, drop = FALSE), lapply(pmin(d, 6L), seq_len)))
543546
else print(head(x))
544547
if (typeof(x) == 'character' && anyNonAscii(x)) {
545-
cat("Non-ASCII string detected, raw representation:\n")
548+
catf("Non-ASCII string detected, raw representation:\n")
546549
print(lapply(head(x), charToRaw))
547550
}
548551
}

0 commit comments

Comments
 (0)