mirror of https://github.com/gorhill/uBlock.git
Add more languages for list selection at install/reset time
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/501 Also, the handling of 3-letter language codes has been fixed.
This commit is contained in:
parent
7652808806
commit
c9c21f9cbf
|
@ -311,7 +311,7 @@
|
|||
"group": "regions",
|
||||
"off": true,
|
||||
"title": "BGR: Bulgarian Adblock list",
|
||||
"lang": "bg",
|
||||
"lang": "bg mk",
|
||||
"contentURL": "https://stanev.org/abp/adblock_bg.txt",
|
||||
"supportURL": "https://stanev.org/abp/"
|
||||
},
|
||||
|
@ -387,7 +387,7 @@
|
|||
"group": "regions",
|
||||
"off": true,
|
||||
"title": "FRA: EasyList Liste FR",
|
||||
"lang": "ar fr",
|
||||
"lang": "ar br fr oc",
|
||||
"contentURL": "https://easylist-downloads.adblockplus.org/liste_fr.txt",
|
||||
"supportURL": "https://forums.lanik.us/viewforum.php?f=91"
|
||||
},
|
||||
|
@ -514,7 +514,7 @@
|
|||
"group": "regions",
|
||||
"off": true,
|
||||
"title": "NLD: EasyList Dutch",
|
||||
"lang": "nl",
|
||||
"lang": "af fy nl",
|
||||
"contentURL": "https://easylist-downloads.adblockplus.org/easylistdutch.txt",
|
||||
"supportURL": "https://forums.lanik.us/viewforum.php?f=100"
|
||||
},
|
||||
|
@ -566,7 +566,7 @@
|
|||
"group": "regions",
|
||||
"off": true,
|
||||
"title": "RUS: RU AdList",
|
||||
"lang": "be ru uk",
|
||||
"lang": "be kk ru uk uz",
|
||||
"contentURL": "https://easylist-downloads.adblockplus.org/advblock+cssfixes.txt",
|
||||
"supportURL": "https://forums.lanik.us/viewforum.php?f=102",
|
||||
"instructionURL": "https://forums.lanik.us/viewtopic.php?f=102&t=22512"
|
||||
|
@ -576,7 +576,7 @@
|
|||
"group": "regions",
|
||||
"off": true,
|
||||
"title": "RUS: AdGuard Russian filter",
|
||||
"lang": "be ru uk",
|
||||
"lang": "be kk ru uk uz",
|
||||
"contentURL": "https://filters.adtidy.org/extension/ublock/filters/1.txt",
|
||||
"supportURL": "https://forum.adguard.com/forumdisplay.php?69-%D0%A4%D0%B8%D0%BB%D1%8C%D1%82%D1%80%D1%8B-Adguard",
|
||||
"instructionURL": "https://kb.adguard.com/ru/general/adguard-ad-filters#russian"
|
||||
|
@ -586,7 +586,7 @@
|
|||
"group": "regions",
|
||||
"off": true,
|
||||
"title": "spa: EasyList Spanish",
|
||||
"lang": "es",
|
||||
"lang": "an ast ca es eu gl",
|
||||
"contentURL": "https://easylist-downloads.adblockplus.org/easylistspanish.txt",
|
||||
"supportURL": "https://forums.lanik.us/viewforum.php?f=103"
|
||||
},
|
||||
|
@ -595,7 +595,7 @@
|
|||
"group": "regions",
|
||||
"off": true,
|
||||
"title": "spa, por: AdGuard Spanish/Portuguese filter",
|
||||
"lang": "es pt",
|
||||
"lang": "an ast ca es eu gl pt",
|
||||
"contentURL": "https://filters.adtidy.org/extension/ublock/filters/9.txt",
|
||||
"supportURL": "https://github.com/AdguardTeam/AdguardFilters#adguard-filters",
|
||||
"instructionURL": "https://kb.adguard.com/en/general/adguard-ad-filters"
|
||||
|
|
|
@ -1248,19 +1248,21 @@
|
|||
// Support ability to auto-enable a filter list based on user agent.
|
||||
|
||||
µBlock.listMatchesEnvironment = function(details) {
|
||||
var re;
|
||||
// Matches language?
|
||||
if ( typeof details.lang === 'string' ) {
|
||||
re = this.listMatchesEnvironment.reLang;
|
||||
let re = this.listMatchesEnvironment.reLang;
|
||||
if ( re === undefined ) {
|
||||
re = new RegExp('\\b' + self.navigator.language.slice(0, 2) + '\\b');
|
||||
this.listMatchesEnvironment.reLang = re;
|
||||
const match = /^[a-z]+/.exec(self.navigator.language);
|
||||
if ( match !== null ) {
|
||||
re = new RegExp('\\b' + match[0] + '\\b');
|
||||
this.listMatchesEnvironment.reLang = re;
|
||||
}
|
||||
}
|
||||
if ( re.test(details.lang) ) { return true; }
|
||||
if ( re !== undefined && re.test(details.lang) ) { return true; }
|
||||
}
|
||||
// Matches user agent?
|
||||
if ( typeof details.ua === 'string' ) {
|
||||
re = new RegExp('\\b' + this.escapeRegex(details.ua) + '\\b', 'i');
|
||||
let re = new RegExp('\\b' + this.escapeRegex(details.ua) + '\\b', 'i');
|
||||
if ( re.test(self.navigator.userAgent) ) { return true; }
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue