Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
f89c370
initial exploration of adding a chinese translation of messages
Oct 3, 2019
e7208a4
adding another .mo file that was untracked
Oct 5, 2019
12a169f
trying to get the .pot for src/ files
Oct 13, 2019
e10a714
adding warning()s from C
Oct 15, 2019
b987a1d
C messages with DTPRINT or Rprintf
Oct 15, 2019
4d950a2
adding STOP messages
Oct 15, 2019
f64d93a
DTWARN messages
Oct 15, 2019
a30930d
Error in forder
Oct 15, 2019
57eeace
odds&ends more messages
Oct 15, 2019
9d596ac
cannot use _() with \r
Oct 15, 2019
710400a
update .pot for src files
Oct 15, 2019
6ac71e4
moving pot file to po/
Oct 15, 2019
1c98859
update header metadata for src .pot
Oct 15, 2019
856f723
Merge branch 'translation' of https://github.com/Rdatatable/data.tabl…
Oct 15, 2019
0832f48
run update_pkg_po on the src to get mo files
Oct 16, 2019
bd4f60b
Merge branch 'master' into translation
Oct 16, 2019
9a46ed3
update_pkg_po after merge
Oct 16, 2019
a0139bb
add template message in onAttach() & clear typos/PYDT issue along the…
Oct 16, 2019
a37bde3
remove some strings
Oct 17, 2019
e37d43b
Merge branch 'master' into translation
Oct 18, 2019
0543e44
improve arg checking&message in groupingsets; add some messages
Oct 21, 2019
8f45182
Merge branch 'master' into translation
Oct 21, 2019
48e3b1a
get tests working (fix some bad quotes, adjust to new messages)
Oct 21, 2019
03d3395
update po with latest message edits
Oct 21, 2019
fad9524
Finished the translation assigned to Chun-Hui Gao (#3983)
gaospecial Oct 21, 2019
a518816
(hopefully) apply encoding fix & check compilation
Oct 27, 2019
ce3f11b
improve internal error & regenerate messages
Oct 27, 2019
7be31d7
Finish translation to zh_CN assigned to group 2 (Hongyuan Jia) (#3986)
Oct 29, 2019
53ec99a
balance quotes
Oct 29, 2019
189a3ec
extra nocov
Oct 29, 2019
5082e56
some coverage of fmelt
Oct 29, 2019
a3b6540
complete coverage of fmelt
Oct 29, 2019
0ca5afa
fix test error
Oct 29, 2019
6402947
update message per DeLuns feedback
Oct 31, 2019
f554b79
update message again; some minor tweaks to nearby code
Oct 31, 2019
b063414
Merge branch 'master' into translation
Nov 2, 2019
42b5d44
Translation to zh_CN assigned to group 3 (#3985)
biobai Nov 3, 2019
62a3ce8
minor update
Nov 3, 2019
35eb661
added new message caught by xianghui
Nov 5, 2019
219b726
Translation haogao gu (#4002)
Koohoko Nov 6, 2019
07b5686
Translation finished (soappp) (#4023)
soappp9527 Nov 6, 2019
606937b
fix format tags for two translations
Nov 6, 2019
2769942
Merge branch 'master' into translation
MichaelChirico Nov 6, 2019
526a38b
done some translation!
KingdaShi Nov 10, 2019
8a09631
Merge branch 'master' into translation
Nov 11, 2019
e23fe63
Finish translation to zh_CN assigned to group 5 (Leo Lee) (#3995)
Leo-Lee15 Nov 15, 2019
43735cc
Translation dracodoc (#4034)
dracodoc Nov 18, 2019
fe501d7
re-run update_pkg_po
Nov 18, 2019
b6c3ac7
Merge branch 'translation' of https://github.com/Rdatatable/data.tabl…
Nov 18, 2019
7272820
update binaries
Nov 18, 2019
6dbd5d1
git stMerge branch 'translation' into translation-kingda
Nov 18, 2019
ef49f83
Translation caiquanyou (#4039)
caiquanyou Nov 19, 2019
d722f81
translation(partial) into zh_CN by Yuanchen Xie (#4010)
Nov 19, 2019
ca3e754
Merge branch 'master' into translation
Nov 19, 2019
dd24dbb
update vs recent master
Nov 19, 2019
c13a1fb
Translation to zh_CN - Group 7 (#4019)
amy17519 Nov 20, 2019
c3d09b4
Merge branch 'master' into translation
Nov 20, 2019
ebb273b
Merge branch 'translation' of https://github.com/Rdatatable/data.tabl…
Nov 20, 2019
396a5b2
fix-up of merge
Nov 20, 2019
a613456
update po after merge
Nov 21, 2019
0de9fb8
update fuzzy translations
Nov 21, 2019
2c474db
update mistaken PRIu64->PRId64
Nov 21, 2019
6f2ce85
caught a few more failed merges
Nov 21, 2019
6cd7995
line # update
Nov 21, 2019
2f49de6
Merge branch 'master' into translation
Dec 8, 2019
548d070
rerun update_pkg_po
Dec 8, 2019
5f3af30
Translation shawn (#4050)
Dec 8, 2019
f1be93e
small tweak
Dec 8, 2019
60741b9
Merge branch 'master' into translation
Dec 8, 2019
961ef20
Merge branch 'master' into translation
Dec 12, 2019
dca3e33
Translation yilei (#3989)
Zachary-Wu Dec 12, 2019
f54a69d
updating some small misses from last pull
Dec 12, 2019
533e842
Translation to zh_CN assigned to group 12 (#3987)
renkun-ken Dec 14, 2019
2a4f6e6
no longer using %llu, other small tidying
Dec 14, 2019
faa2dcc
Merge branch 'master' into translation
Dec 16, 2019
4932ded
Merge branch 'master' into translation
Dec 17, 2019
005d5af
Translation fengqifang (#3990)
spxdummy Dec 17, 2019
81ca331
Merge branch 'translation' of https://github.com/Rdatatable/data.tabl…
Dec 17, 2019
c89a455
run update_pkg_po on new merge
Dec 17, 2019
49ba638
done some translation (#4069)
sunshine1126 Dec 17, 2019
a687673
Merge branch 'master' into translation
Dec 17, 2019
5e8281f
touch-up
Dec 17, 2019
1b41217
Translation to zh_CN assigned to group 4 (#3997)
zhiiiyang Dec 18, 2019
edefd0f
update mo
Dec 18, 2019
bde1a56
Merge branch 'master' into translation
Dec 18, 2019
b417528
Merge branch 'master' into translation
Dec 18, 2019
4b7c49e
My part of translation has been completed. It's so happy! (#4051)
Xueliang24 Dec 19, 2019
5e7279e
Merge branch 'master' of github.com:Rdatatable/data.table into transl…
Dec 19, 2019
3cfbcdc
Merge branch 'translation' of github.com:Rdatatable/data.table into t…
Dec 19, 2019
cf92984
some revisions due to foreign char, touch-up, remove fuzzy
Dec 19, 2019
92e4583
Merge branch 'master' into translation
Dec 21, 2019
72fb181
Translation yuliang li (#4055)
JulianYlli12 Dec 22, 2019
71db7e7
tweaks for syntax mistakes
Dec 22, 2019
c9b49e5
Translation to zh_CN - Group 17 (#4049)
shrektan Dec 28, 2019
a34c9c0
Merge branch 'master' into translation
Dec 28, 2019
5094c46
update mo, fix missing field
Dec 28, 2019
3f8cefe
Translation yc0802 (#4054)
yc0802 Dec 28, 2019
a9de5aa
adding "leftover" translations (#4143)
MichaelChirico Dec 28, 2019
4fc08a1
Merge branch 'translation' into translation-kingda
Dec 28, 2019
2864ca6
done some translation!-kingda (#4046)
KingdaShi Dec 29, 2019
67f3614
Merge branch 'translation-kingda' into translation
Dec 29, 2019
b4cb616
Translation leftover pt2 (#4146)
MichaelChirico Dec 30, 2019
8457d36
missing dot
Dec 30, 2019
a39acd9
add note for proceeding to CRAN_Relase
Dec 30, 2019
f975897
%f needed for > integer max
Dec 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .dev/CRAN_Release.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,69 @@
###############################################
# Updating translations
###############################################

# 1) Update messages for new release
## (a) Update C template file: src/data.table.pot
## ideally, we are including _() wrapping in
## new PRs throughout dev cycle, and this step
## becomes about tying up loose ends
## Appending _() char array wrapping to all messages
## that might be shown to the user. This step is slightly
## too greedy, as it includes too many msg, some of which
## need not be translated [more work to do here to make
## this less manual] some things to watch out for:
## * quote embedded (and escaped) within message [could be fixed with smarter regex]
## * multi-line implicit-concat arrays (in C, `"a" "b"` is the same as `"ab"`) should be wrapped "on the outside" not individually
## * `data.table` shares some of its `src` with `pydatatable`, so the requirement to `#include <R.h>` before the `#define _` macro meant we need to be careful about including this macro only in the R headers for these files (hence I created `po.h`)
## * Can't use `_()` _inside_ another functional macro. Only wrap the string passed to the macro later.
for MSG in error warning DTWARN DTPRINT Rprintf STOP Error;
do for SRC_FILE in src/*.c;
# no inplace -i in default mac sed
do sed -E "s/$MSG[(]("[^"]*")/$MSG(_(\1)/g" $SRC_FILE > out;
mv out $SRC_FILE;
done
done

## checking for other lines calling these that didn't get _()-wrapped
for MSG in error warning DTWARN DTPRINT Rprintf STOP Error;
do grep -Er "\b$MSG[(]" src --include=*.c | grep -v _ | grep -Ev "(?://|[*]).*$MSG[(]"

## similar, but a bit more manual to check snprintf usage

## look for char array that haven't been covered yet
grep -Er '"[^"]+"' src --include=*.c | grep -Fv '_("' | grep -v "#include" | grep -v '//.*".*"'

## look for lines starting with a char array (likely continued from prev line & can be combined)
grep -Er '^\s*"' src/*.c

## Now extract these messages with xgettext
cd src
xgettext --keyword=_ -o data.table.pot *.c
cd ..

## (b) Update R template file: src/R-data.table.pot
## much easier, once the update_pkg_po bug is fixed
R --no-save
## a bug fix in R still hadn't made the 2019-12-12 release,
## so run the following to source the corrected function manually
STEM='https://raw.githubusercontent.com/wch/r-source/trunk/src/library/tools/R'
source(file.path(STEM, 'utils.R'))
source(file.path(STEM, 'xgettext.R'))
source(file.path(STEM, 'translations.R'))
## shouldn't be any errors from this...
update_pkg_po('.')
q()

# 2) Open a PR with the new templates & contact the translators
# * zh_CN:
## Translators to submit commits with translations to this PR
## [or perhaps, if we get several languages, each to open
## its own PR and merge to main translation PR]

## 3) Check validity
## update_pkg_po('.') to be run again for the PR
## [can this be done via Travis?]

###############################################
# Basic checks
###############################################
Expand Down
2 changes: 1 addition & 1 deletion R/between.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# is x[i] in between lower[i] and upper[i] ?
between = function(x, lower, upper, incbounds=TRUE, NAbounds=TRUE, check=FALSE) {
if (is.logical(x)) stop("between has been x of type logical")
if (is.logical(x)) stop("between has been passed an argument x of type logical")
if (is.logical(lower)) lower = as.integer(lower) # typically NA (which is logical type)
if (is.logical(upper)) upper = as.integer(upper) # typically NA (which is logical type)
is.px = function(x) inherits(x, "POSIXct")
Expand Down
6 changes: 3 additions & 3 deletions R/data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ replace_dot_alias = function(e) {
}
return(x)
}
if (!mult %chin% c("first","last","all")) stop("mult argument can only be 'first','last' or 'all'")
if (!mult %chin% c("first","last","all")) stop("mult argument can only be 'first', 'last' or 'all'")
missingroll = missing(roll)
if (length(roll)!=1L || is.na(roll)) stop("roll must be a single TRUE, FALSE, positive/negative integer/double including +Inf and -Inf or 'nearest'")
if (is.character(roll)) {
Expand Down Expand Up @@ -820,7 +820,7 @@ replace_dot_alias = function(e) {
if (!typeof(byval[[jj]]) %chin% ORDERING_TYPES) stop("column or expression ",jj," of 'by' or 'keyby' is type ",typeof(byval[[jj]]),". Do not quote column names. Usage: DT[,sum(colC),by=list(colA,month(colB))]")
}
tt = vapply_1i(byval,length)
if (any(tt!=xnrow)) stop("The items in the 'by' or 'keyby' list are length (",paste(tt,collapse=","),"). Each must be length ", xnrow, "; the same length as there are rows in x (after subsetting if i is provided).")
if (any(tt!=xnrow)) stop(gettextf("The items in the 'by' or 'keyby' list are length(s) (%s). Each must be length %d; the same length as there are rows in x (after subsetting if i is provided).", paste(tt, collapse=","), xnrow, domain='R-data.table'))
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converted some messages that are awkward to translate in chunks into one formatted message to be translated as one.

This should probably be done more broadly but it's pretty manual & Chinese matches grammar closely enough. If we ever support Japanese though, probably we'll need complete overhaul...

if (is.null(bynames)) bynames = rep.int("",length(byval))
if (length(idx <- which(!nzchar(bynames))) && !bynull) {
# TODO: improve this and unify auto-naming of jsub and bysub
Expand Down Expand Up @@ -874,7 +874,7 @@ replace_dot_alias = function(e) {
# attempt to auto-name unnamed columns
for (jj in which(nm=="")) {
thisq = q[[jj + 1L]]
if (missing(thisq)) stop("Item ", jj, " of the .() or list() passed to j is missing") #3507
if (missing(thisq)) stop(gettextf("Item %d of the .() or list() passed to j is missing", jj, domain="R-data.table")) #3507
if (is.name(thisq)) nm[jj] = drop_dot(thisq)
# TO DO: if call to a[1] for example, then call it 'a' too
}
Expand Down
2 changes: 1 addition & 1 deletion R/devel.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dcf.repo = function(pkg, repo, field, type){
idx = file(file.path(contrib.url(repo, type=type),"PACKAGES"))
on.exit(close(idx))
dcf = read.dcf(idx, fields=c("Package",field))
if (!pkg %in% dcf[,"Package"]) stop("There is no ", pkg, " package in provided repository.")
if (!pkg %in% dcf[,"Package"]) stop(gettextf("There is no package %s in provided repository.", pkg, domain='R-data.table'))
dcf[dcf[,"Package"]==pkg, field][[1L]]
}

Expand Down
6 changes: 3 additions & 3 deletions R/groupingsets.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ groupingsets.data.table = function(x, j, by, sets, .SDcols, id = FALSE, jj, ...)
stop("All columns used in 'sets' argument must be in 'by' too. Columns used in 'sets' but not present in 'by': ", brackify(setdiff(sets.all.by, by)))
if (id && "grouping" %chin% names(x))
stop("When using `id=TRUE` the 'x' data.table must not have a column named 'grouping'.")
if (!all(sapply(sets, function(x) length(x)==uniqueN(x))))
if (any(sapply(sets, anyDuplicated)))
stop("Character vectors in 'sets' list must not have duplicated column names within a single grouping set.")
if (!identical(lapply(sets, sort), unique(lapply(sets, sort))))
warning("Double counting is going to happen. Argument 'sets' should be unique without taking order into account, unless you really want double counting, then get used to that warning. Otherwise `sets=unique(lapply(sets, sort))` will do the trick.")
if (length(sets) > 1L && (idx<-anyDuplicated(lapply(sets, sort))))
warning("'sets' contains a duplicate (i.e., equivalent up to sorting) element at index ", idx, "; as such, there will be duplicate rows in the output -- note that grouping by A,B and B,A will produce the same aggregations. Use `sets=unique(lapply(sets, sort))` to eliminate duplicates.")
# input arguments handling
jj = if (!missing(jj)) jj else substitute(j)
av = all.vars(jj, TRUE)
Expand Down
4 changes: 2 additions & 2 deletions R/last.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ last = function(x, n=1L, ...) {
}
} else {
if (!requireNamespace("xts", quietly=TRUE))
stop("'xts' class passed to data.table::last function but 'xts' is not available, you should have 'xts' installed already") # nocov
stop(gettextf("'xts' class passed to %s function but 'xts' is not available, you should have 'xts' installed already", "data.table::last", domain="R-data.table")) # nocov
if (verbose)
cat("last: using xts::last: is.xts(x)\n")
xts::last(x, n=n, ...)
Expand Down Expand Up @@ -76,7 +76,7 @@ first = function(x, n=1L, ...) {
}
} else {
if (!requireNamespace("xts", quietly=TRUE))
stop("'xts' class passed to data.table::first function but 'xts' is not available, you should have 'xts' installed already") # nocov
stop(gettextf("'xts' class passed to %s function but 'xts' is not available, you should have 'xts' installed already", "data.table::first", domain="R-data.table")) # nocov
if (verbose)
cat("first: using xts::first: is.xts(x)\n")
xts::first(x, n=n, ...)
Expand Down
2 changes: 2 additions & 0 deletions R/onAttach.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
if (!isTRUE(getOption("datatable.quiet"))) { # new option in v1.12.4, #3489
packageStartupMessage("data.table ", v, if(dev)paste0(" IN DEVELOPMENT built ",d,g),
" using ", getDTthreads(verbose=FALSE), " threads (see ?getDTthreads). Latest news: r-datatable.com")
if (gettext("TRANSLATION CHECK", domain='R-data.table') != "TRANSLATION CHECK")
packageStartupMessage(gettext("**********\n", "Running data.table in English; package support is available in English only. When searching for online help, be sure to also check for the English error message. This can be obtained by looking at the po/R-<locale>.po and po/<locale>.po files in the package source, where the native language and English error messages can be found side-by-side"))
Comment thread
mattdowle marked this conversation as resolved.
if (dev && (Sys.Date() - as.Date(d))>28L)
packageStartupMessage("**********\nThis development version of data.table was built more than 4 weeks ago. Please update: data.table::update.dev.pkg()\n**********")
if (!.Call(ChasOpenMP))
Expand Down
4 changes: 2 additions & 2 deletions R/setkey.R
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ setorder = function(x, ..., na.last=FALSE)
# na.last=FALSE here, to be consistent with data.table's default
# as opposed to DT[order(.)] where na.last=TRUE, to be consistent with base
{
if (!is.data.frame(x)) stop("x must be a data.frame or data.table.")
if (!is.data.frame(x)) stop("x must be a data.frame or data.table")
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same message appears elsewhere without ., aligning means only one translation needed

cols = substitute(list(...))[-1L]
if (identical(as.character(cols),"NULL")) return(x)
if (length(cols)) {
Expand Down Expand Up @@ -357,7 +357,7 @@ CJ = function(..., sorted = TRUE, unique = FALSE)
}
}
nrow = prod( vapply_1i(l, length) ) # lengths(l) will work from R 3.2.0
if (nrow > .Machine$integer.max) stop("Cross product of elements provided to CJ() would result in ",nrow," rows which exceeds .Machine$integer.max == ",.Machine$integer.max)
if (nrow > .Machine$integer.max) stop(gettextf("Cross product of elements provided to CJ() would result in %.0f rows which exceeds .Machine$integer.max == %d", nrow, .Machine$integer.max, domain='R-data.table'))
l = .Call(Ccj, l)
setDT(l)
l = setalloccol(l) # a tiny bit wasteful to over-allocate a fixed join table (column slots only), doing it anyway for consistency since
Expand Down
2 changes: 1 addition & 1 deletion R/test.data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test.data.table = function(script="tests.Rraw", verbose=FALSE, pkg=".", silent=F
# nocov start
fn2 = paste0(fn,".bz2")
if (!file.exists(file.path(fulldir, fn2)))
stop("Neither ",fn," or ",fn2," exist in ",fulldir)
stop(gettextf("Neither %s nor %s exist in %s",fn, fn2, fulldir, domain="R-data.table"))
fn = fn2
# nocov end
# sys.source() below accepts .bz2 directly.
Expand Down
Binary file added inst/po/en@quot/LC_MESSAGES/R-data.table.mo
Binary file not shown.
Binary file added inst/po/en@quot/LC_MESSAGES/data.table.mo
Binary file not shown.
Binary file added inst/po/zh_CN/LC_MESSAGES/R-data.table.mo
Binary file not shown.
Binary file added inst/po/zh_CN/LC_MESSAGES/data.table.mo
Binary file not shown.
Loading