So, I tried packaging my HTML5 game with Electron and got an error.
After some debugging, I found that Electron has navigator.languages
, but it’s an empty array, hence this line in _dmSysGetUserPrefferedLanguage()
fails:
var preferred = navigator == undefined ? jsdefault : navigator.languages ? navigator.languages[0] : navigator.language || navigator.userLanguage || navigator.browserLanguage || navigator.systemLanguage || jsdefault;
This can be easily fixed by changing the line to:
var preferred = navigator == undefined ? jsdefault : navigator.languages && navigator.languages[0] || navigator.language || navigator.userLanguage || navigator.browserLanguage || navigator.systemLanguage || jsdefault;