stuff
This commit is contained in:
parent
5c60465d59
commit
7fa4213608
|
@ -602,8 +602,7 @@ module.exports = (_ => {
|
||||||
BDFDB.PluginUtils.translate = function (plugin) {
|
BDFDB.PluginUtils.translate = function (plugin) {
|
||||||
if (typeof plugin.setLabelsByLanguage == "function" || typeof plugin.changeLanguageStrings == "function") {
|
if (typeof plugin.setLabelsByLanguage == "function" || typeof plugin.changeLanguageStrings == "function") {
|
||||||
const translate = _ => {
|
const translate = _ => {
|
||||||
const language = BDFDB.LanguageUtils.getLanguage();
|
if (typeof plugin.setLabelsByLanguage == "function") plugin.labels = plugin.setLabelsByLanguage();
|
||||||
if (typeof plugin.setLabelsByLanguage == "function") plugin.labels = plugin.setLabelsByLanguage(language.id);
|
|
||||||
if (typeof plugin.changeLanguageStrings == "function") plugin.changeLanguageStrings();
|
if (typeof plugin.changeLanguageStrings == "function") plugin.changeLanguageStrings();
|
||||||
};
|
};
|
||||||
if (LibraryModules.LanguageStore.chosenLocale) translate();
|
if (LibraryModules.LanguageStore.chosenLocale) translate();
|
||||||
|
@ -7898,6 +7897,17 @@ module.exports = (_ => {
|
||||||
if (!e.returnValue.props.children) LibraryModules.ContextMenuUtils.closeContextMenu();
|
if (!e.returnValue.props.children) LibraryModules.ContextMenuUtils.closeContextMenu();
|
||||||
}}, {priority: 10});
|
}}, {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 () {
|
InternalBDFDB.onSettingsClosed = function () {
|
||||||
if (InternalBDFDB.SettingsUpdated) {
|
if (InternalBDFDB.SettingsUpdated) {
|
||||||
delete InternalBDFDB.SettingsUpdated;
|
delete InternalBDFDB.SettingsUpdated;
|
||||||
|
|
Loading…
Reference in New Issue