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 > > 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? > > Cheers! > Beuc > > -- 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/acc93acd-b423-41f9-995b-b870d02c58dc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
