Exclude folders starting with a symbol when loading the locales
Categories
(WebExtensions :: General, defect)
Tracking
(Not tracked)
People
(Reporter: sdk, Assigned: sdk)
Details
STR
- Open Firefox
- Go to about:debugging > This Firefox > Load Temporary Add-on
- Select a manifest.json
Description
If the _locales
folder contains a folder starting with a dot, the addon will fail to load. This is because the current code wrongly assume that every folder use a name matching a locales code. However, this may not be the case.
Possible solution
- Match locales against a list of predetermined locales.
- We could detect with a regular expression if the folder name is a valid locale code before loading its content. For example:
async _promiseLocaleMap() {
let locales = new Map();
let entries = await this._readDirectory("_locales", true);
for (let name of entries) {
let pattern = new RegExp(/* Match locales code pattern */);
let locale = this.normalizeLocaleCode(name);
if (locale.match(pattern)) {
locales.set(locale, name);
}
}
return locales;
}
Assignee | ||
Updated•3 years ago
|
Comment 1•3 years ago
|
||
(In reply to Danny Colin [:sdk] from comment #0)
If the
_locales
folder contains a folder starting with a dot, the addon will fail to load. This is because the current code wrongly assume that every folder use a name matching a locales code. However, this may not be the case.
It doesn't assume this, it requires it. The _locales
folder is special, and is only meant to contain locale data. Why do you need it to contain something else?
Assignee | ||
Comment 2•3 years ago
|
||
Why do you need it to contain something else?
For Multi-Account Containers, we have a separated git repository for the locales that we load in the main one as a submodule (See https://github.com/mozilla-l10n/multi-account-containers-l10n/). Since it's a git repository as any other on GItHub, it contains folders like .github/
. This makes the loading of the addon fail.
Comment 3•3 years ago
|
||
We will not be doing this in Firefox for all extensions, developers can include removing this in their build step.
Description
•