Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new translations for upcoming release #4765

Merged
merged 6 commits into from Oct 31, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 7 additions & 19 deletions .dev/CRAN_Release.cmd
Expand Up @@ -19,40 +19,28 @@
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;
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[(]"
do grep -Er "\b$MSG[(]" src --include=*.c | grep -v _ | grep -Ev "(?:\s*//|[*]).*$MSG[(]"
done

## 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 '//.*".*"'
grep -Er '"[^"]+"' src --include=*.c | grep -Fv '_("' | \
grep -Ev '#include|//.*".*"|strcmp|COERCE_ERROR|install\("|\{"'

## 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()
## NB: this relies on R >= 4.0 to remove a bug in update_pkg_po
Rscript -e "tools::update_pkg_po('.')"

# 2) Open a PR with the new templates & contact the translators
# * zh_CN:
Expand Down
Binary file modified inst/po/en@quot/LC_MESSAGES/R-data.table.mo
Binary file not shown.
Binary file modified inst/po/en@quot/LC_MESSAGES/data.table.mo
Binary file not shown.
Binary file modified inst/po/zh_CN/LC_MESSAGES/data.table.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions po/R-data.table.pot
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: data.table 1.12.9\n"
"POT-Creation-Date: 2020-07-17 14:38\n"
"Project-Id-Version: data.table 1.13.1\n"
"POT-Creation-Date: 2020-10-17 12:05\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down