Add debug functions menu

This commit is contained in:
Cohee
2023-08-27 23:20:43 +03:00
parent 96512c178e
commit 3b4e6f0b78
7 changed files with 80 additions and 11 deletions

View File

@@ -1,3 +1,4 @@
import { registerDebugFunction } from "./power-user.js";
import { waitUntilCondition } from "./utils.js";
const storageKey = "language";
@@ -48,9 +49,9 @@ function getMissingTranslations() {
console.table(uniqueMissingData);
console.log(missingDataMap);
}
window["getMissingTranslations"] = getMissingTranslations;
toastr.success(`Found ${uniqueMissingData.length} missing translations. See browser console for details.`);
}
export function applyLocale(root = document) {
const overrideLanguage = localStorage.getItem("language");
@@ -106,7 +107,6 @@ function addLanguagesToDropdown() {
jQuery(async () => {
waitUntilCondition(() => !!localeData);
window["applyLocale"] = applyLocale;
applyLocale();
addLanguagesToDropdown();
@@ -121,4 +121,7 @@ jQuery(async () => {
location.reload();
});
registerDebugFunction('getMissingTranslations', 'Get missing translations', 'Detects missing localization data and dumps the data into the browser console.', getMissingTranslations);
registerDebugFunction('applyLocale', 'Apply locale', 'Reapplies the currently selected locale to the page.', applyLocale);
});