Prohledat stránky podpory

Vyhněte se podvodům. Za účelem poskytnutí podpory vás nikdy nežádáme, abyste zavolali nebo poslali SMS na nějaké telefonní číslo nebo abyste sdělili své osobní údaje. Jakékoliv podezřelé chování nám prosím nahlaste pomocí odkazu „Nahlásit zneužití“.

Zjistit více

Trouble using firefox.cfg with JS in ubuntu18

  • 6 odpovědí
  • 1 má tento problém
  • 1 zobrazení
  • Poslední odpověď od ito-matsuda

more options

I'm setting up Firefox 78.6.1esr in an image and want it to start in French or English given the environment variable (lang or language or otherwise) and I'm having trouble doing so.

I installed the correct French Language pack from http://releases.mozilla.org/pub/firefox/releases/78.6.1esr/linux-x86_64/xpi/ and it is now recognized by Firefox as a valid add-on.

I have `autoconfig.js` in the /distribution/extensions/ directory as well as `firefox.cfg` in the base folder. If in the cfg file I just have ``` // IMPORTANT: code begins next line. pref("intl.locale.requested","fr") ```

It works fine but the moment I try and use something like `getenv(LANG)` suddenly the error appears "Failed to read configuration file" pops up when I try to start Firefox. My understanding was that the cfg was treated like a JS file per https://support.mozilla.org/en-US/kb/customizing-firefox-using-autoconfig but I can't seem to get any JS to run nicely.

Something like the following would be nice // next line const langvar = getenv(LANG); pref("intl.locale.requested", langvar);

would be ideal but I'm missing something.

Any help is greatly appreciated!

I'm setting up Firefox 78.6.1esr in an image and want it to start in French or English given the environment variable (lang or language or otherwise) and I'm having trouble doing so. I installed the correct French Language pack from http://releases.mozilla.org/pub/firefox/releases/78.6.1esr/linux-x86_64/xpi/ and it is now recognized by Firefox as a valid add-on. I have `autoconfig.js` in the /distribution/extensions/ directory as well as `firefox.cfg` in the base folder. If in the cfg file I just have ``` // IMPORTANT: code begins next line. pref("intl.locale.requested","fr") ``` It works fine but the moment I try and use something like `getenv(LANG)` suddenly the error appears "Failed to read configuration file" pops up when I try to start Firefox. My understanding was that the cfg was treated like a JS file per https://support.mozilla.org/en-US/kb/customizing-firefox-using-autoconfig but I can't seem to get any JS to run nicely. Something like the following would be nice // next line const langvar = getenv(LANG); pref("intl.locale.requested", langvar); would be ideal but I'm missing something. Any help is greatly appreciated!

Zvolené řešení

Thanks for the link. I guess it's something special for Autoconfig and not a general Firefox function. I wasn't aware of that.

In the example, the variable name is quoted, so for your script, it would be

const langvar = getenv("LANG");

Does that make any difference?

Přečíst dotaz v kontextu 👍 1

Všechny odpovědi (6)

more options

If you enable the Browser Console command line, what does `getenv(LANG)` return there? It's not defined on mine (en-US build, not multilingual in any way).

https://developer.mozilla.org/en-US/docs/Tools/Browser_Console#Browser_Console_command_line

more options

Trying that I get not defined.

more options

I know from the bottom of the Help > Troubleshooting information page that Firefox does gather locale information from the system, but I don't know what function to run to collect that in your script. I think that's the rabbit hole you need to find and head down.

more options

From the functions of "AutoConfig" area in the page, it does say that the functions are available from within an AutoConfig file.

It's weird that the page https://support.mozilla.org/en-US/kb/customizing-firefox-using-autoconfig#firefox-enterprise:linux: even shows usage of `getenv` as well. As an aside, I don't know what kind of JS I was writing but at least I have ``` // extra var user = "fr.randomtext"; pref("intl.locale.requested", user.substring(0,2)); ``` working which for some reason I thought was not working.

Thanks for your help and please do post again if you think of anything else.

more options

Zvolené řešení

Thanks for the link. I guess it's something special for Autoconfig and not a general Firefox function. I wasn't aware of that.

In the example, the variable name is quoted, so for your script, it would be

const langvar = getenv("LANG");

Does that make any difference?

more options

I can't believe I missed that. Thanks so much I must have glazed over the quotation marks.