Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The extension settings are in german even the chrome is in english #2484

Open
davfive opened this issue Jul 18, 2024 · 3 comments
Open

The extension settings are in german even the chrome is in english #2484

davfive opened this issue Jul 18, 2024 · 3 comments
Assignees
Labels
Bug Bug or required update after YouTube changes good first issue A GitHub standard for inviting (new) contributors *Congratulations in advance!* help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥

Comments

@davfive
Copy link

davfive commented Jul 18, 2024

Bug Report:

  • Description: (Clear/concise. Screenshot/Video welcome)
    Go to
  • Steps to reproduce this: (Might only happen with a certain feature of our's enabled?)
  1. Install, in chrome click the extension jigsaw > Improve YouTube ... > Options
  2. The settings dialog is in german (see my Chrome languages list (German is second, English (US) is first). Settings should show in english
  • Since when?: When YouTube changed something? Through our update?
    I just installed the plugin, first time user
  • Browser:
    Chrome
  • Are any errors shown in the Browser-Console?: (F12-key, then console-tab)
    "requestStorageAccessFor: Permission denied ... www.youtube.com/:1
  • Does the bug not happen when you log out of YouTube? Then please copy your experiment flags list twice (with & without the error to compare). Enter: yt.config_.EXPERIMENT_FLAGS into the Browser console on youtube (F12-Key - Or find it in the html source(ctrl+U)
    I don't use experimental flags
please check, if the issue has already been reported ever. (If so, that might inspires you to add different/better words to that report.)

GitHub's issue search (use the link or remove "is:issue is:open" from the search)

  • Expected preferred behavior:
  • ImprovedTube Version (Written in the Extension header & your Browser's store)
  • Tested as only active extension or in incognito mode?:
  • Your Settings (From the Extension's -Hamburger menu > Settings > Backup & reset > Export settings (You can remove any Blocklist, History Analyzer data - or paste the following in the Browser-Console and hit enter: (function({analyzer, blocklist, ...a}){return JSON.stringify(a)})(ImprovedTube.storage) )
  • YouTube-Document: (F12 copy the whole root element: <html> (alternative: CTRL+U) (https://github.com/code-charity/youtube/wiki/Contributing#Test )
  • OS / Device: Mac

image

@davfive davfive added Bug Bug or required update after YouTube changes good first issue A GitHub standard for inviting (new) contributors *Congratulations in advance!* help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥ labels Jul 18, 2024
@ImprovedTube
Copy link
Member

hi & thanks! @davfive

#2449

youtube/menu/satus.js

Lines 1027 to 1088 in 9b61bbd

# IMPORT // old: satus.locale.import(url, onload, onsuccess);
--------------------------------------------------------------*/
satus.locale.import = function (code, callback, path) {
// if (!path) { path = '_locales/'; }
function importLocale (locale, successCallback) {
var url = chrome.runtime.getURL(path + locale + '/messages.json');
fetch(url)
.then(response => response.ok ? response.json() : {})
.then(data => {
for (var key in data) {
if (!satus.locale.data[key]) {
satus.locale.data[key] = data[key].message;
}
}
})
.catch(() => {})
.finally(() => successCallback && successCallback());
}
if (code) {
let language = code.replace('-', '_');
if (language.indexOf('_') !== -1) {
importLocale(language, () => importLocale(language.split('_')[0], () => importLocale('en', callback)));
} else {
importLocale(language, () => importLocale('en', callback));
}
} else { // try chrome://settings/languages:
try {
chrome.i18n.getAcceptLanguages(function (languages) {
languages = languages.map(language => language.replace('-', '_'));
for (let i = languages.length - 1; i >= 0; i--) {
if (languages[i].includes('_')) {
let languageWithoutCountryCode = languages[i].substring(0, 2);
if (!languages.includes(languageWithoutCountryCode)) {
languages.splice(i + 1, 0, languageWithoutCountryCode);
}
}
}
languages.includes("en") || languages.push("en");
languages.forEach((language, index) => index === languages.length - 1 ? importLocale(language, callback) : importLocale(language, () => {}));
/* equals:
languages.length === 1 && importLocale(languages[0], callback);
languages.length === 2 && importLocale(languages[0], () => importLocale(languages[1], callback));
languages.length === 3 && importLocale(languages[0], () => importLocale(languages[1], () => importLocale(languages[2], callback)));
... */
// console.log(languages);
});
} catch (error) {
// Finally, if code nor chrome://settings/languages are available, use window.navigator.language:
let language = window.navigator.language.replace('-', '_');
if (language.indexOf('_') !== -1) {
importLocale(language, () => importLocale(language.split('_')[0], () => importLocale('en', callback)));
} else {
importLocale(language, () => importLocale('en', callback));
}
console.log(error);
};
}
};
/*--------------------------------------------------------------

@ImprovedTube
Copy link
Member

(*just being hopeful 🤣 since your tagline is code-optimistic)

@ImprovedTube
Copy link
Member

Greetings! @davfive @ARed99
(we can do it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug or required update after YouTube changes good first issue A GitHub standard for inviting (new) contributors *Congratulations in advance!* help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥
Projects
Status: No status
Development

No branches or pull requests

3 participants