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

Writing RTF document with auto-date formatting behaves unexpectedly in non-english system locales #8

Open
mstackhouse opened this issue Jan 25, 2022 · 0 comments

Comments

@mstackhouse
Copy link
Contributor

Copying issue text from here

@NNaikp could you share your output on timestamp and R language setting? Thanks!

Github doesn't support .rtf so I have attached the file here (tlf-primary.docx) as .docx. Here is also a screenshot from the .rtf file:

image

My default language in Word is UK english.

When I did the review I set Sys.setenv(LANG = "en") as it was showing me error messages in danish. But after some googling I can see that the locale is still Danish, also if I set the language to English:

> Sys.setenv(LANG = "en")
> Sys.getlocale()
[1] "LC_COLLATE=Danish_Denmark.1252;LC_CTYPE=Danish_Denmark.1252;LC_MONETARY=Danish_Denmark.1252;LC_NUMERIC=C;LC_TIME=Danish_Denmark.1252"

After running Sys.setlocale(locale = "English") I see

> Sys.setlocale(locale = "English")
[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252"

Which yields:

image

Maybe pharmaRTF::write_rtf needs to check the locale before sinking the file? I can see from the documentation of Sys.setlocale() that it is OS dependent. The one above is Windows (my local). This one is from a linux server:

> Sys.getlocale()
[1] "LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant