Recent answers to How can I make general.useragent.locale variablehttps://support.mozilla.org/en-US/questions/9833672014-01-16T00:49:00-08:00There is no window defined when Firefox is running the code in mozilla.cfg and anyway you would have2014-01-16T00:49:00-08:00cor-elhttps://support.mozilla.org/en-US/questions/983367#answer-523056<p>There is no window defined when Firefox is running the code in mozilla.cfg and anyway you would have to use other code to reference to a browser window.
</p><p>You can try this code:
</p>
<pre>locale = Cc["@mozilla.org/chrome/chrome-registry;1"] .getService(Components.interfaces.nsIXULChromeRegistry).getSelectedLocale("global");
lockPref("general.useragent.locale", locale);
</pre>
<ul><li><a href="http://mxr.mozilla.org/mozilla-central/source/uriloader/exthandler/nsHandlerService.js#152" rel="nofollow">http://mxr.mozilla.org/mozilla-central/source/uriloader/exthandler/nsHandlerService.js#152</a>
</li></ul>Thanks for your quick response
I configured the mozilla.cfg file, although wasn't able to set the va2014-01-16T00:00:04-08:00JosBxlhttps://support.mozilla.org/en-US/questions/983367#answer-523038<p>Thanks for your quick response
I configured the mozilla.cfg file, although wasn't able to set the variable here.
</p><p>I tried adding but this did not work:
var languagesetting = window.navigator.language;
lockPref("general.useragent.locale", languagesetting);
</p><p>Seems like the command 'window.navigator.language' is not recognised, nor is window.navigator.userLanguage
</p><p>Do you have any idea how I can set this?
</p>You should be able to do this via a mozilla.cfg autoconfig file.
This file is run as JavaScript with2014-01-14T18:34:38-08:00cor-elhttps://support.mozilla.org/en-US/questions/983367#answer-522644<p>You should be able to do this via a mozilla.cfg autoconfig file.
</p><p>This file is run as JavaScript with full chrome privileges and can contain more advanced code, so you should be able to check the system language and set general.useragent.locale accordingly.
</p>
<ul><li><a href="http://mike.kaply.com/2012/03/16/customizing-firefox-autoconfig-files/" rel="nofollow">http://mike.kaply.com/2012/03/16/customizing-firefox-autoconfig-files/</a>
</li><li><a href="http://mike.kaply.com/2012/03/22/customizing-firefox-advanced-autoconfig-files/" rel="nofollow">http://mike.kaply.com/2012/03/22/customizing-firefox-advanced-autoconfig-files/</a>
</li></ul>
<p>I don't know how to get the system language setting, but you should be able to read registry keys and environment variables if necessary.
</p>