stuff
This commit is contained in:
parent
5c60465d59
commit
7fa4213608
|
@ -602,8 +602,7 @@ module.exports = (_ => {
|
|||
BDFDB.PluginUtils.translate = function (plugin) {
|
||||
if (typeof plugin.setLabelsByLanguage == "function" || typeof plugin.changeLanguageStrings == "function") {
|
||||
const translate = _ => {
|
||||
const language = BDFDB.LanguageUtils.getLanguage();
|
||||
if (typeof plugin.setLabelsByLanguage == "function") plugin.labels = plugin.setLabelsByLanguage(language.id);
|
||||
if (typeof plugin.setLabelsByLanguage == "function") plugin.labels = plugin.setLabelsByLanguage();
|
||||
if (typeof plugin.changeLanguageStrings == "function") plugin.changeLanguageStrings();
|
||||
};
|
||||
if (LibraryModules.LanguageStore.chosenLocale) translate();
|
||||
|
@ -7898,6 +7897,17 @@ module.exports = (_ => {
|
|||
if (!e.returnValue.props.children) LibraryModules.ContextMenuUtils.closeContextMenu();
|
||||
}}, {priority: 10});
|
||||
|
||||
let languageChangeTimeout, translateAllNew = e => {
|
||||
if (e.methodArguments[0] && e.methodArguments[0].locale) {
|
||||
BDFDB.TimeUtils.clear(languageChangeTimeout);
|
||||
languageChangeTimeout = BDFDB.TimeUtils.timeout(_ => {
|
||||
for (let pluginName in PluginStores.loaded) if (PluginStores.loaded[pluginName].started) BDFDB.PluginUtils.translate(PluginStores.loaded[pluginName]);
|
||||
BDFDB.PatchUtils.patch(this, LibraryModules.SettingsUtils, "updateLocalSettings", {after: translateAllNew});
|
||||
}, 10000);
|
||||
}
|
||||
};
|
||||
if (LibraryModules.SettingsUtils) BDFDB.PatchUtils.patch(this, LibraryModules.SettingsUtils, "updateLocalSettings", {after: translateAllNew});
|
||||
|
||||
InternalBDFDB.onSettingsClosed = function () {
|
||||
if (InternalBDFDB.SettingsUpdated) {
|
||||
delete InternalBDFDB.SettingsUpdated;
|
||||
|
|
|
@ -82,7 +82,7 @@ module.exports = (_ => {
|
|||
};
|
||||
}
|
||||
|
||||
onStart () {
|
||||
onStart () {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SettingsUtils, "updateLocalSettings", {after: e => {
|
||||
if (BDFDB.ObjectUtils.is(e.methodArguments[0]) && e.methodArguments[0].theme && settings.running) {
|
||||
BDFDB.TimeUtils.clear(changeTimeout);
|
||||
|
|
Loading…
Reference in New Issue