Closed gzlock closed 9 years ago
hello, what's your OS version?
HI. Same issue here with windows 7 64 bit french
On Linux, it works fine.Same issue on windows 7 64 bit
I can confirm that "window.navigator.language" through both DevTools and as javascript: proto in addressbar bar returns "en-US". I'm using russian version of Windows XP SP3. The same line of code otuputs "ru" in regular Chrome (through Dev tools) and "ru-RU" in Firefox (through firebug).
UPDATE: It looks like "window.navigator.language" should return configured browser language which you select during browser installation and can always change in settings menu. It does not refer to the system language. The best possible solution for browser would be to use a server script to return Accepts-Language http header (http://stackoverflow.com/a/3335420). There is nothing on the node.js side as well. So there simply no API for getting user locale currently. I found one addon for node.js (node-locale), but it's native and you will have to compile it.
Probably the simpliest solution is to give user a list of supported languages to choose from on first run.
iirc node-locale
is for setting the locale, even; may not be that useful for getting the system locale. You may be able to get the locale though for the current system by way of ENV variables on linux, possibly on mac. Windows will be more difficult though.
Same here
I'm using Korean version of Mac 10.8.5, Window 7
When I set Korean(한국어) or English in my system locale
한국어(Korean)
ko
on Chrome version 31.0.1636.0 dev
en-US
on node-webkit DevToolEnglish
en-US
on Chrome version 31.0.1636.0 dev
en-US
on Node-Webkit DevToolLikewise only console.log('process.env.LANG')
output en-US.UTF-8
https://code.google.com/p/chromium/issues/detail?id=1862
navigator.language is always set to the UI language of Windows regardless of the UI language of Chrome
And more information
@rogerwang Is it done via 723a199 ?
Have the same issue! Windows 8.1 nw 0.11.6, after building with node-webkit-builder, packing into msi file and installing navigator.language and process.env.LANG are empty But in develop mode and builded with node-webkit-builder without packing in msi navigator.language return correct language.
Easy fix: take the folder "locales" generated by NW 9 or present in the official zip packages of NW11 & 12. Copy it next to your node-webkit executable. Tadaa.
The issue apparently comes from NW generating an empty locales
folder at start instead of filling it with lang.pak files
'locales' folder should be shipped with your application.
where is locales files?
Now what can i do to get the user os language I searched for a long time, did not find a way
Content on this page does not help me https://github.com/rogerwang/node-webkit/issues/24