Hi, FYI the PR was accepted :)
Cheers! Beuc On 12/06/2019 12:06, Beuc wrote: > > Hi, > > This PR's point is improving the "standard-ness" of the Emscripten > environment :) > (One could easily make yet another emscripten-specific change and grab > 'navigator.languages' using EM_JS.) > > With this PR, for instance, my RenPyWeb port can use Python's 'locale' > package without any changes. > Programs using gettext(3) would also work as-is. > > LANG doesn't affect the C runtime until the program calls setlocale(3) > (cf. PR discussion). > This is about language preference detection; changing the language > in-app (sadly) cannot be solved at this level ;) > > Cheers! > Beuc > > On 12/06/2019 11:26, Floh wrote: >> What about a html5.h function to poll the language: >> >> const char* emscripten_get_navigator_language(void); >> >> Would this provide enough functionality while being less "intrusive"? >> >> I don't know how the ENV-variable approach affects C runtime >> functions though, >> but for showing a UI in the user's preferred language this would probably >> suffice (as a user I guess I'd still like to have an additional >> "in-app-option" to >> change the language though). >> >> On Tuesday, 11 June 2019 21:57:23 UTC+2, Beuc wrote: >> >> Hi, >> >> I issued a PR to expose the user's preferred language as >> ENV['LANG']: >> https://github.com/emscripten-core/emscripten/pull/8751 >> <https://github.com/emscripten-core/emscripten/pull/8751> >> >> It's based on navigator.languages which reflects HTTP >> Accept-Language, e.g.: >> - HTTP Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3 >> - navigator.languages = Array(4) [ "fr", "fr-FR", "en-US", "en" ] >> - ENV['LANG'] = fr.UTF-8 >> >> (Currently Emscripten uses a hard-coded 'C.UTF-8'.) >> >> This PR allows starting your WebAssembly program directly using the >> user's preferred language (rather than shoving a language choice in >> their face on start-up ;)). >> Provided your program is i18n'd / multi-language, of course. >> For nodejs no changes. >> >> While this environment variable is pretty standard on desktop, Alon >> expressed concerned that this may be risky to start doing this now. >> >> Hence we moved the discussion to this list :) >> What do you think? >> -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/3a30dd72-dbe1-a455-25f1-b7cc008c6bec%40beuc.net. For more options, visit https://groups.google.com/d/optout.
