attempt to add test of Chinese error message#4524
Conversation
|
@shrektan Thanks for testing master and I understand it doesn't work. Just so we can get a test going, do you know how to get R on Windows to produce Chinese? I've tried all kinds of variations of the LANG and LANGUAGE in this PR and none of them seem to generate any Chinese at all. Is it the wrong string, the wrong environment variable? Maybe R on Windows must be set to a different language on startup and can't be done at runtime like this? |
|
Thanks for all your efforts. Frankly speaking, I don't really know and I'm not sure if it's possible without the Windows' language being set up to Chinese. But I will try to find a way (hopefully) this day later when I get back home, where I can set up a Windows machine with English locale to mimic what's happening in the CI. |
|
https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Localization-of-messages contains (bold mine) :
and in https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Testing-a-Unix_002dalike-Installation at the end is :
|
Codecov Report
@@ Coverage Diff @@
## master #4524 +/- ##
=======================================
Coverage 99.60% 99.60%
=======================================
Files 72 73 +1
Lines 13971 14027 +56
=======================================
+ Hits 13916 13972 +56
Misses 55 55
Continue to review full report at Codecov.
|
|
Still no Chinese present in main.Rout. Sigh. |
|
@mattdowle @MichaelChirico The below code works on my PC (Windows 10, English Language, with Chinese Language installed). x <- list(
LC_COLLATE = "Chinese (Simplified)_China.936",
LC_CTYPE = "Chinese (Simplified)_China.936",
LC_MONETARY = "Chinese (Simplified)_China.936",
LC_NUMERIC = "C",
LC_TIME = "Chinese (Simplified)_China.936"
)
for (i in seq_along(x)) {
Sys.setlocale(names(x)[[i]], x[[i]])
}
Sys.setenv('LANGUAGE' = 'zh_CN')After executing the above code, |
…to massage va_list next
… into chinese_test
…tures; no compile options or libraries needed
|
Will merge shortly so that @shrektan can test master to see if it works now please. If it does work now, we can go through and tidy/review in a follow up. If it still doesn't work then we can throw this wrapper away. Although it's a bit hairy, at least it's contained in one file and not too long. And being plain C99, we can be confident it should work on all Windows machines, old and new, MinGW, MSVC, etc. |
|
Regardless of the outcome, thanks for the herculean effort to support this! Awesome stuff. |
|
@MichaelChirico yes very good point. |



For #4402, follow up to #4523