posit-dev / posit-dev/shinylive
Cannot use other locales even though changing `LC_TIME`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 251
- Forks
- 25
- Avg merge
- 19m
- Merged PRs (30d)
- 2
Description
Hi,
Thank you for this incredible package that will change so many things in the R ecosystem 🤩.
I have a shinylive app running on httpuv::runStaticServer() (and soon on GHpages), which works as intended.
However, the app has a UI in French when run from RStudio, but in English when run from the httpuv server.
Despite my many efforts, I was not able to switch the latter to French.
As a (hopefully) reproducible example, you can add the following code anywhere in the minimal example of shinylive.
I put the output read in the JS console as comments.
Note that I'm running RStudio desktop on Windows 10 on a French computer.
library(lubridate)
print(Sys.getlocale("LC_ALL")) #"fr_FR.UTF-8"
wday(today(), label=TRUE) |> print() #Friday
wday(today(), label=TRUE), locale="French" |> print() #Friday
Sys.setlocale("LC_ALL", locale="French_France.1252")
print(Sys.getlocale("LC_ALL")) #"French_France.1252"
wday(today(), label=TRUE) |> print() #Friday
"French_France.1252" is the output of Sys.getlocale("LC_ALL") when run locally in the R console. Of note, "fr_FR.UTF-8" is not recognized as a correct locale in the R console.
Additionally, the different dateInputs are in English, regardless of Sys.setlocale and of Sys.setenv(LANGUAGE="fr").
I get some JS warning from bootstrap (bootstrap-datepicker.min.js:1) that might be related:
Details
DEPRECATED: This filename doesn't follow the convention, use bootstrap-datepicker.en-CA.js instead. DEPRECATED: The language code "kh" is deprecated and will be removed in 2.0. For Khmer support use "km" instead. DEPRECATED: The language code "kr" is deprecated and will be removed in 2.0. For korean support use "ko" instead. DEPRECATED: This language code "rs-latin" is deprecated (invalid serbian language code) and will be removed in 2.0. For Serbian latin support use "sr-latin" instead. DEPRECATED: This language code "rs" is deprecated (invalid serbian language code) and will be removed in 2.0. For Serbian support use "sr" instead.
I don't get notable errors, except the following, which are already described in other issues and don't seem to cause any trouble
shinylive.js:34938 preload error:wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.
shinylive.js:34938 preload error:falling back to ArrayBuffer instantiation
preload error:Warning in install(dep, repos, info, lib, quiet, mount) :
preload error: Requested package curl not found in webR binary repo.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal shinylive app served by httpuv::runStaticServer() and reproduce the locale difference using lubridate::wday() and the dateInput controls. Inspect the browser console and the bootstrap-datepicker warnings while comparing the RStudio and browser behavior. Done means the French locale is honored in the browser output and date inputs, or the remaining limitation is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, r, typescript
- Domain
- frontend, internationalization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100