arkenfox / user.js

Firefox privacy, security and anti-tracking: a comprehensive user.js template for configuration and hardening
MIT License
9.97k stars 511 forks source link

Removing intl.locale.requested creates inconsistency in the Firefox interface [solved: linux vendor.js] #952

Closed Dupond closed 4 years ago

Dupond commented 4 years ago

Hello,

This is just a little remark to let you know what can be experimented with a non-english Firefox, in case you wouldn't already know (so this is not a complaint at all).

With the ghacks-user.js file, all the webpages, as well as my Firefox interface, are in english language, and this is fine (as I assume otherwise it could have some consequences regarding privacy, finger-printing, etc.).

However, this is not my system language (I use Arch Linux with a non-english locale). As a consequence, a few addons displayed in the "Add-ons Manager" have a non-english name and description ; this is bad at least for one reason: the name of the addon is not the same as in most tutorials. For example, for me, the "Skip Redirect" add-on is displayed as "Passe Redirection" (which I assume is a very bad automatic translation in french language) ; but I've hard a hard time to find out that my addon was the one referenced to by this guide. Furthermore, here's the worse: the name of the addon is not even the same as the name displayed on the addons.mozilla.org webpage, so that when I enter it in the "Search" field it simply finds nothing!

So I find it much more consistent to display everything in english. This is a personal choice, of course, but it eases my life also (well, a very little, but nonetheless ;)

With just a clean Firefox profile and the ghacks-user.js file, I have an empty entry in about:config called intl.locale.requested. This preference has been removed from the ghacks-user.js file a while ago (precisely in #811). I found out that setting it back to en-US allows me to solve the problem, having everything, including the addon names and descriptions, displayed in english.

Maybe a note could simply be added in the user.js file to let the user know about this?

However, I'm concerned about the consequences that setting back this pref could have about finger-printing: would it be trackable? Would it have any other negative downside?

I really hope I'm understandable (as you'll certainly have noticed,english is not my primary language, so it took me a looong time to write this issue ;)

Have a nice day!

Best regards, Dupond

Thorin-Oakenpants commented 4 years ago

With just a clean Firefox profile and the ghacks-user.js file

So your Firefox build is not en-US (?), but you changed the web content language to en-US (that's cool), but you also changed the "app language" to en-US (which governs everything in the UI: and I guess extensions, about pages etc). Is that right?

If so, that's a pretty edge case IMO: just install and use the en-US bundle.

That said, this is more likely a bug (in how extensions get their app language) but I'd have to dig deeper to know for sure: and it's not something I know a lot about. Long term I believe the goal is to have a single release and the language is added on the fly: e.g. Tor Browser wouldn't have to build 35 versions for each architecture and platform and related incremental updates.


What happens in a brand new profile for your non en-US build without the ghacks user.js. That is

I'll test this later on, if you don't get around to it

Dupond commented 4 years ago

No, sorry I should have been more precised: since we want to have everything, included the interface, in english language, for ease of use and privacy concerns, I haven't installed any language pack. I just have installed the Firefox package. I've double-checked that the "firefox-i18n-fr 77.0.1-1" package is NOT installed.

So I've made a few tests: with a fresh profile and no user.js, the Firefox interface defaults (obviously) to english language. I install the Skip Redirect addon from AMO (from this page exactly: https://addons.mozilla.org/en-US/firefox/search/?q=skip%20redirect&platform=Linux&appver=77.0.1 since this is the page that is displayed when searching for "Skip Redirect" in the "Search" bar of the Firefox Addon Manager): the addon is added to my Addon Manager with the french name "Passe Redirection", and its description is in french. Same thing for uMatrix and LocalCDN: I add them from AMO, and their name doesn't change, but their description is in french.

That's why I thought that Firefox had access to my system language; but as soon as I add the intl.locale.requested preference set to en-US, everything, including the addon description, is in english.

So the actual ghacks-user.js file has no impact on this. In other words: none of the existing preference used in this file is actually enough to have an entire Firefox in english language. That's my concern exactly: if Firefox does have access to the system locale, even if it's only used for the addon names and descriptions, can a website also know it? And could intl.locale.requested be a good solution?

Thorin-Oakenpants commented 4 years ago

There's three things going on here

I don't have a non en-US OS. But that's OK for now : I don't want to simulate en-US yet, I'm interested in what happens when you change the app language

77 on top, nightly 79 on bottom hmm

The option to change the app language is gone, but I'm not sure if this is just my a Nightly thing

PS: another thing you can do, is go to about:support and at the very bottom are seven results for internationalization & localization: the only ones for me that aren't en-US are the regional preferences (which match the option in the pictures above for how to format dates, times etc)

Dupond commented 4 years ago

Not sure to understand what you want : how would I change the app language, since I don't have any language pack installed ? Or do you want me to install one and see what happens ?

I'm using Firefox 77.0.1, so my "language" section is exactly the same as yours: clicking on "Set Alternatives..." only shows one line (which is "English (United States)"), and the "Choose button" for the "Choose your preferred language for displaying pages" option shows two lines: "English (United States) [en-us]" and "English [en]".

Here is what my about:support page displays in the "Internationalization & Localization" section:

1. intl.locale.requested is empty (default):

Application Settings Requested Locales ["fr-FR"] Available Locales ["en-US"] App Locales ["en-US"] Regional Preferences ["en-US"] Default Locale "en-US" Operating System System Locales ["fr-FR"] Regional Preferences ["fr-FR"]

2. intl.locale.requested set to en-US:

Application Settings Requested Locales ["en-US"] Available Locales ["en-US"] App Locales ["en-US"] Regional Preferences ["en-US"] Default Locale "en-US" Operating System System Locales ["fr-FR"] Regional Preferences ["fr-FR"]

I hope this helps a little bit...

Thorin-Oakenpants commented 4 years ago

Not sure to understand what you want : how would I change the app language, since I don't have any language pack installed ? Or do you want me to install one and see what happens ?

No. You're fine. I can test things from my end at this stage. You normally change the app language in that pic I posted in 77 where it says "choose the language used to display menus..." - but you don't need to

I hope this helps a little bit...

Probably :) I'm not an expert on how Firefox uses all this stuff. To me it seems like a bug: because in both you have app locale as en-US and I would have thought extensions would use that, but clearly they use requested locale (as far as I can tell) - maybe that's by design.

Thorin-Oakenpants commented 4 years ago

Sorry, just to clarify (but you don't need to do it)

Changing the app language is right under the sentence that says "choose the languages used to display menus..." where there is a combobox, which if you click it shows you a list of all your available languages

I only have en-US top

I click on Search for more languages lang2

I click on select a language to add... and choose French lang3

and click Add - this then downloads the app language for French from Mozilla: it actually says "downloading" in the dialog while it goes and fetches it. And you click OK.

I also added Arabic as well. Here's what it looks like now arabic

And when I select a different app language, it asks for a restart to apply it lang5


So basically, Firefox doesn't want to bundle all the translations etc (I think there's 220 odd of them) for every download of Firefox, so instead, you download them as you want them. That's what I mean by package vs app language

Thorin-Oakenpants commented 4 years ago

ooh, cool.. and this then adds them under about:addons as entries under languages and dictionaries where you can remove them cool

Thorin-Oakenpants commented 4 years ago

@kkapsner Just checking, but I assume you use i18n to determine the locale of CB, right? e.g.

browser.i18n.getUILanguage()
kkapsner commented 4 years ago

Yes I use this API - but only browser.i18n.getMessage().

The name and the description can be localised by using __MSG_something_something__ in the manifest.json (https://github.com/kkapsner/CanvasBlocker/blob/master/manifest.json#L4 - CB does not translate the name but the description) - so everything is controlled by Firefox.

Thorin-Oakenpants commented 4 years ago

The user.js is immaterial: that's just for changing your web-content language preferences etc, and does not affect app (menu) or the extension language API (li0n)

My system is not en-US, but it is English, but that's also immaterial (as far as I can tell) because at no stage did I ever see English in my test below


Control

Test


Conclusion

If Skip Redirect is using li8n then I would consider this a bug / inconsistent application (and I can contact the right Moz dev). Clearly Skip Redirect has several languages, it's not like it's not catering to locale at all.

@Dupond You mentioned several extensions: can you name them please

pinging @sblask

edit: It might be that Skip Redirect doesn't have an es translation and falls back to app language something else like the default package langauge - I haven't checked, sorry. I didn't want to test english as I wanted remove system locale from the equation.

Thorin-Oakenpants commented 4 years ago

great: https://github.com/sblask/webextension-skip-redirect/tree/master/_locales

I'll retest by adding and flipping to german german

OK - that works, so now we're back to square one about intl.locale.requested

Dupond commented 4 years ago

Here are the extensions that I use, and what happens without setting intl.locale.requested:

So the preferences of the add-ons are always in english, whereas the name and/or the description are sometimes in french. Not really consistent, indeed... though I'm not sure it has anything to do with the purpose of the ghacks-user.js file. In fact, for me (please correct me if I'm wrong) there's only one question left: is it possible for a website and for an extension to find out that the description language of some extensions is not consistent with all the rest, in which case this could be fingerprinted?

If the answer is "yes", I think intl.locale.requested should be welcomed back; if not, I think maybe it could be added as a personal choice in [SECTION 5000].

Thorin-Oakenpants commented 4 years ago

is it possible for a website and for an extension to find out that the description language of some extensions is not consistent with all the rest, in which case this could be fingerprinted

Websites should not be able to detect your app/extension languages: if they can, that's a bug (and there are some we already know about)

Extensions have more privileges and need to know your language/locale settings (via the web ext apis). If an extension is fingerprinting you, that's because it's evil and it should be nuked

Thorin-Oakenpants commented 4 years ago

TBH, I can't follow what's going on here. intl.locale.requested is a hidden pref, so it shouldn't even be a factor - i.e Firefox by default should be showing the right ext locale. Can anyone else unravel WTF is going on? Seems edge case or a bug to me

Thorin-Oakenpants commented 4 years ago

The user.js sets three prefs all to do with web-content: it doesn't set any app languages or extra languages, so this issue is out of scope


I think I understand now

@Dupond: can you confirm?

That seems about right

Dupond commented 4 years ago

Nope ! Like I said before, I installed plain Firefox, without any language pack. To re-use your words: I haven't installed a "French Firefox" ; just Firefox by itself, and nothing more.

So obviously I haven't had to "change the app language to English": it's the default language, already included inside of the Firefox binary (contrary to "en-us", which IS a language pack).

Thorin-Oakenpants commented 4 years ago

I'm not familiar with arch, so how did you install it: Firefox installs come in various languages: so there must be a language involved.

e.g. on windows, you can download the stub and it will get the package based on your OS, or you can download the actual language you want: e.g.

I don't know the exact differences, but part of it would be the installer. They're different files. The en-US will default to that language with no language packs (and the pref will be blank), and the French one will default to French with no language packs (and the pref will be blank). There's no such thing as a Firefox with no default language and no language pack(s)

Here's Linux

In your first comment you said "This is just a little remark to let you know what can be experimented with a non-english Firefox", so I am assuming you installed a French one (even it was automatically chosen for you based on your system locale)

Does that make more sense?

Thorin-Oakenpants commented 4 years ago

In other words, when you first installed it, with no user.js .. what was the app language (menus and stuff)?

edit: ahhh, last comment you said "So obviously I haven't had to "change the app language to English": it's the default language" .. so that indicates you installed the en-US package? Which doesn't match with the opening comment about non en-US, which is what I was testing.

If I'm going to add anything to the user.js (very doubtful), I need to be able to know what causes it and to replicate, so sorry for so many questions. It could even be a bug (in which case I can move that along)

Dupond commented 4 years ago

Now you made it very clear that my first sentence ("This is just a little remark to let you know what can be experimented with a non-english Firefox") was veeeery baaadly expressed; I'm really sorry for that! I should have said: "with default Firefox in a non-english (Arch) Linux environment".

Here is how it works with Arch: as for any Linux distribution, everything is installed from the official repositories of your distribution (to make it clear: not from the official Mozilla website; so, there's no ftp site and no installer involved at all). To install Firefox, you just have to install the "firefox" package with whatever package manager is provided by your Linux distribution (as stated in the official Firefox page on the very famous - at least in the Linux world - Arch wiki).

Please note that at this stage, no language pack has been installed, so Firefox defaults to english language. So this answers your question:

In other words, when you first installed it, with no user.js .. what was the app language (menus and stuff)?

Please let me quote the above wiki page again:

Installing Firefox can be installed with the firefox package. [...] A number of language packs are available for Firefox, other than the standard English. Language packs are usually named as firefox-i18n-*languagecode* (where languagecode can be any language code, such as de, ja, fr, etc.). For a list of available language packs see firefox-i18n for firefox

So if you follow the previous link (here) to see all the language packs available for an Arch user (and I'm pretty sure they're identical in every Linux distribution), you will see that there is an "en-us" package, but it's NOT installed with the default Firefox package... So it answers your last question ("so that indicates you installed the en-US package?" No, I didn't). English is just the default language used in the Firefox code. Indeed, here are all the files included in the firefox package in Arch Linux:

firefox /usr/ firefox /usr/bin/ firefox /usr/bin/firefox firefox /usr/lib/ firefox /usr/lib/firefox/ firefox /usr/lib/firefox/Throbber-small.gif firefox /usr/lib/firefox/application.ini firefox /usr/lib/firefox/browser/ firefox /usr/lib/firefox/browser/chrome/ firefox /usr/lib/firefox/browser/chrome/icons/ firefox /usr/lib/firefox/browser/chrome/icons/default/ firefox /usr/lib/firefox/browser/chrome/icons/default/default128.png firefox /usr/lib/firefox/browser/chrome/icons/default/default16.png firefox /usr/lib/firefox/browser/chrome/icons/default/default32.png firefox /usr/lib/firefox/browser/chrome/icons/default/default48.png firefox /usr/lib/firefox/browser/chrome/icons/default/default64.png firefox /usr/lib/firefox/browser/crashreporter-override.ini firefox /usr/lib/firefox/browser/defaults/ firefox /usr/lib/firefox/browser/defaults/preferences/ firefox /usr/lib/firefox/browser/defaults/preferences/vendor.js firefox /usr/lib/firefox/browser/features/ firefox /usr/lib/firefox/browser/features/doh-rollout@mozilla.org.xpi firefox /usr/lib/firefox/browser/features/formautofill@mozilla.org.xpi firefox /usr/lib/firefox/browser/features/screenshots@mozilla.org.xpi firefox /usr/lib/firefox/browser/features/webcompat-reporter@mozilla.org.xpi firefox /usr/lib/firefox/browser/features/webcompat@mozilla.org.xpi firefox /usr/lib/firefox/browser/omni.ja firefox /usr/lib/firefox/crashreporter firefox /usr/lib/firefox/crashreporter.ini firefox /usr/lib/firefox/defaults/ firefox /usr/lib/firefox/defaults/pref/ firefox /usr/lib/firefox/defaults/pref/channel-prefs.js firefox /usr/lib/firefox/dependentlibs.list firefox /usr/lib/firefox/distribution/ firefox /usr/lib/firefox/distribution/distribution.ini firefox /usr/lib/firefox/firefox firefox /usr/lib/firefox/firefox-bin firefox /usr/lib/firefox/fonts/ firefox /usr/lib/firefox/fonts/TwemojiMozilla.ttf firefox /usr/lib/firefox/gmp-clearkey/ firefox /usr/lib/firefox/gmp-clearkey/0.1/ firefox /usr/lib/firefox/gmp-clearkey/0.1/libclearkey.so firefox /usr/lib/firefox/gmp-clearkey/0.1/manifest.json firefox /usr/lib/firefox/gtk2/ firefox /usr/lib/firefox/gtk2/libmozgtk.so firefox /usr/lib/firefox/liblgpllibs.so firefox /usr/lib/firefox/libmozavcodec.so firefox /usr/lib/firefox/libmozavutil.so firefox /usr/lib/firefox/libmozgtk.so firefox /usr/lib/firefox/libmozsandbox.so firefox /usr/lib/firefox/libmozsqlite3.so firefox /usr/lib/firefox/libmozwayland.so firefox /usr/lib/firefox/libxul.so firefox /usr/lib/firefox/minidump-analyzer firefox /usr/lib/firefox/omni.ja firefox /usr/lib/firefox/pingsender firefox /usr/lib/firefox/platform.ini firefox /usr/lib/firefox/plugin-container firefox /usr/lib/firefox/removed-files firefox /usr/share/ firefox /usr/share/applications/ firefox /usr/share/applications/firefox.desktop firefox /usr/share/icons/ firefox /usr/share/icons/hicolor/ firefox /usr/share/icons/hicolor/128x128/ firefox /usr/share/icons/hicolor/128x128/apps/ firefox /usr/share/icons/hicolor/128x128/apps/firefox.png firefox /usr/share/icons/hicolor/16x16/ firefox /usr/share/icons/hicolor/16x16/apps/ firefox /usr/share/icons/hicolor/16x16/apps/firefox.png firefox /usr/share/icons/hicolor/192x192/ firefox /usr/share/icons/hicolor/192x192/apps/ firefox /usr/share/icons/hicolor/192x192/apps/firefox.png firefox /usr/share/icons/hicolor/22x22/ firefox /usr/share/icons/hicolor/22x22/apps/ firefox /usr/share/icons/hicolor/22x22/apps/firefox.png firefox /usr/share/icons/hicolor/24x24/ firefox /usr/share/icons/hicolor/24x24/apps/ firefox /usr/share/icons/hicolor/24x24/apps/firefox.png firefox /usr/share/icons/hicolor/256x256/ firefox /usr/share/icons/hicolor/256x256/apps/ firefox /usr/share/icons/hicolor/256x256/apps/firefox.png firefox /usr/share/icons/hicolor/32x32/ firefox /usr/share/icons/hicolor/32x32/apps/ firefox /usr/share/icons/hicolor/32x32/apps/firefox.png firefox /usr/share/icons/hicolor/384x384/ firefox /usr/share/icons/hicolor/384x384/apps/ firefox /usr/share/icons/hicolor/384x384/apps/firefox.png firefox /usr/share/icons/hicolor/48x48/ firefox /usr/share/icons/hicolor/48x48/apps/ firefox /usr/share/icons/hicolor/48x48/apps/firefox.png firefox /usr/share/icons/hicolor/64x64/ firefox /usr/share/icons/hicolor/64x64/apps/ firefox /usr/share/icons/hicolor/64x64/apps/firefox.png firefox /usr/share/icons/hicolor/symbolic/ firefox /usr/share/icons/hicolor/symbolic/apps/ firefox /usr/share/icons/hicolor/symbolic/apps/firefox-symbolic.svg

There is a real mess here, since WITHOUT the en-us package (and without any extension or user.js file, in a clean profile just after having installed Firefox), the about:support page does contain several references to "en-US":

Application Settings Requested Locales ["fr-FR"] Available Locales ["en-US"] App Locales ["en-US"] Regional Preferences ["en-US"] Default Locale "en-US" Operating System System Locales ["fr-FR"] Regional Preferences ["fr-FR"]

This is just the proof that the "en-US" package is absolutely useless (unless French becomes the universal language at one point, and Mozilla decides to include it by default in Firefox? That would be awesome ;)

I hope it's more understandable for you, now. Once more, I should have provided more details from the beginning...

Thorin-Oakenpants commented 4 years ago

Diving down the Firefox language rabbit hole always does my head in :) They've been restructuring it for the last 10+ versions. It's quite different on GeckoView (Android) in Fenix Preview/Nightly too.


Cool. The ftp was just an example, but the base firefox package your distro downloads will be en-US build then. You have to have at least one language: it just won't be a downloaded additional one - it's the one that you can't remove or see, so to speak - that's what I mean by package language - my bad for using mixed up terms. I should use build language


So as luck would have it, gk at Tor Project just updated a couple of tickets, which handily gives me some leads

So as I already surmised, (TB ticket) "it's actually a list of locales if more than one language pack is installed (which we are allowing for now)" - despite the pref being single instead of locales with an s as suggested in the bugzilla. That's not quite right, it's if any language pack is installed.

I haven't had a chance to dig much further, but the removal of other prefs has been covered before - but those may have changed how some Linux distros package it. There's mention in those links about Linux distros setting that pref

And what makes it hard for me, is that I don't have a non English OS, not even in my Linux VMs, so I'm struggling to replicate. That's why I went for a French build on my English OS (but I couldn't make it use my system OS) - that's on Windows.

I don't think I need to replicate this, because I now have your full STR (sorry for the confusion, my fault) and that should be enough for me to poke someone at Mozilla: I consider it a bug TBH - probably already brought up at Mozilla, and decided that it is a Linux distro issue.


setting the pref in user.js would have to be commented out, otherwise it can mess with people's multiple language setups. But yeah, we could add it to the user js with the other language ones for troubleshooting, depending on what my contacts at Moz say

sblask commented 4 years ago

I have no idea what ghacks is all about, but I got pinged in here, so... All I do in Skip Redirect is following https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Internationalization No magic going on. If there are inconsistencies between different parts of Skip Redirect, that might be due to missing translations (I didn't do them myself and there are no automatic translations). I haven't seen any inconsistencies within the extension yet though. Then there are languages that are simply not supported because I don't have translations. Regarding Skip Redirect vs Passe Redirection in different places, people contributed translations and that's cool, because it's no additional effort for me. Maintaining descriptions on the webstore in different languages would be though because those can't be bundled with the extension (as annoying as that is). This is something I won't do anything about. People reading tutorials in a different language to what their browser/system is set to is something I can't do anything about. I also have no influence over the quality of translations, so there might be inconsistencies in naming and I didn't choose translating the name.

kkapsner commented 4 years ago

I didn't choose translating the name.

You choose that it's possible to translate it: https://github.com/sblask/webextension-skip-redirect/blob/master/manifest.json#L35 vs. https://github.com/kkapsner/CanvasBlocker/blob/master/manifest.json#L3 Maybe you should change that...

sblask commented 4 years ago

Maybe I should have, but I think it's too late for that now. Apparently it made sense for the translator to translate it and I so far have not had any complaints. But changing the name is disruptive.

Dupond commented 4 years ago

Oh. My. God.

I just discovered something: I was looking for the origin of this empty intl.locale.requested pref in my browser, since this pref shouldn't exist at all with a default Firefox installation.

It turns out that (as shown in my previous comment) Arch Linux Firefox package contains a vendor.js file (located in /usr/lib/firefox/browser/defaults/preferences/) with the following content:

// Use LANG environment variable to choose locale
pref("intl.locale.requested", "");

// Use system-provided dictionaries
pref("spellchecker.dictionary_path", "/usr/share/hunspell");

// Disable default browser checking.
pref("browser.shell.checkDefaultBrowser", false);

// Don't disable extensions in the application directory
pref("extensions.autoDisableScopes", 11);

So the first 2 lines suggest that even an empty pref would be enough to switch locale. And indeed, it is! As I checked in my about:support page, commenting this line is enough to keep Requested Locales set to default, which is ["en-US"].

So it turns out that this is an Arch-Linux-only problem; but this issue isn't "Removing intl.locale.requested creates inconsistency" anymore; it should rather be "Adding intl.locale.requested (even if empty) creates inconsistency in the Firefox interface"...

As a consequence, I really feel like an idiot: all this was a big waste of time... mostly for you... I'm really sorry about that (again).

Thorin-Oakenpants commented 4 years ago

Nah, it's all good - I learned a few things :)

I wonder how many other Linux distro repos do the same thing (and I hope you contact the arch people). That said, maybe Mozilla should fall back to something when it's an empty string

Can I close this?

Dupond commented 4 years ago

Of course, this should be closed.

And forget.

Forever.

Thorin-Oakenpants commented 3 years ago

OMG ... 1537704#c20 ... und as a locale ... and I've read this bug before

edit: also