COVIDPause
COVIDPause copied to clipboard
Added Arabic equivalents to the denylist
In the Arabic list, I made sure to add multiple spellings of the same word (since most of them are borrowed).
Thank you! I also had someone else interested in supplying French translations. I'm concerned that as the number of translations increases, the runtime will also increase (linearly).
I have an idea for how we could make this work for you and other users without incurring a penalty for people like me who are limited to English. What do you think about adding something like this?
let siteLang = document.documentElement.lang; // current site language
let browserLang = navigator.language; // browser language preference
let translations = {
'ar': [
'كوفيد',
'كورونا'
],
'fr': [
'épidémie'
]
};
// iterate through each language/translation pair
for (let [key, value] of Object.entries(translations)) {
// if the site uses this language or the browser uses this language
if (siteLang.startsWith(key) || browserLang.startsWith(key)) {
// add all the translations to the denylist
denylist.push(...value);
}
}
If you have a chance to test that this works for you, I'd hugely appreciate it. I didn't test this code, so there might be a bug :)
That sounds like a good idea. I added the code snippet and tested the extension, it seems to be working fine. By why should we still keep the denylist and fill it? Why not load the list fro, translations corresponding to the language and English can always be the default. 🤔