Mozilla 도움말 검색

고객 지원 사기를 피하세요. 저희는 여러분께 절대로 전화를 걸거나 문자를 보내거나 개인 정보를 공유하도록 요청하지 않습니다. "악용 사례 신고"옵션을 사용하여 의심스러운 활동을 신고해 주세요.

Learn More

Trouble using firefox.cfg with JS in ubuntu18

  • 6 답장
  • 1 이 문제를 만남
  • 1 보기
  • 최종 답변자: 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!

선택된 해결법

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?

문맥에 따라 이 답변을 읽어주세요 👍 1

모든 댓글 (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

선택된 해결법

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.