diff --git a/Library/0BDFDB.plugin.js b/Library/0BDFDB.plugin.js index 6fccef6e61..fd64e4b247 100644 --- a/Library/0BDFDB.plugin.js +++ b/Library/0BDFDB.plugin.js @@ -2,7 +2,7 @@ * @name BDFDB * @author DevilBro * @authorId 278543574059057154 - * @version 3.8.2 + * @version 3.8.1 * @description Required Library for DevilBro's Plugins * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -2545,7 +2545,7 @@ module.exports = (_ => { } }; - LibraryModules.LanguageStore = BDFDB.ModuleUtils.find(m => (m.Messages || m[InternalData.LanguageStringHashes.DISCORD]) && m, {all: true, defaultExport: false}).find(n => n && n.exports && (n.exports.Messages || n.exports[InternalData.LanguageStringHashes.DISCORD])).exports; + LibraryModules.LanguageStore = BDFDB.ModuleUtils.find(m => m.Messages && m.Messages.IMAGE && m); LibraryModules.React = BDFDB.ModuleUtils.findByProperties("createElement", "cloneElement"); LibraryModules.ReactDOM = BDFDB.ModuleUtils.findByProperties("render", "findDOMNode"); Internal.LibraryModules = new Proxy(LibraryModules, { @@ -4367,7 +4367,7 @@ module.exports = (_ => { } }; BDFDB.DiscordUtils.getLanguage = function () { - return Internal.LibraryModules.LanguageUtils && (Internal.LibraryModules.LanguageUtils.chosenLocale || Internal.LibraryModules.LanguageUtils._chosenLocale) || document.querySelector("html[lang]").getAttribute("lang"); + return Internal.LibraryModules.LanguageStore && (Internal.LibraryModules.LanguageStore.chosenLocale || Internal.LibraryModules.LanguageStore._chosenLocale) || document.querySelector("html[lang]").getAttribute("lang"); }; BDFDB.DiscordUtils.getBuild = function () { if (BDFDB.DiscordUtils.getBuild.build) return BDFDB.DiscordUtils.getBuild.build; @@ -4549,8 +4549,9 @@ module.exports = (_ => { return `:not(.${Internal.getDiscordClass(item, true).split(".")[0]}),`; } }); - - const LanguageStringsObj = Internal.LibraryModules.LanguageStore && Internal.LibraryModules.LanguageStore.Messages || Internal.LibraryModules.LanguageStore || {}; + + const LanguageStrings = Internal.LibraryModules.LanguageStore && Internal.LibraryModules.LanguageStore._proxyContext ? Object.assign({}, Internal.LibraryModules.LanguageStore._proxyContext.defaultMessages) : Internal.LibraryModules.LanguageStore; + const LanguageStringsObj = Internal.LibraryModules.LanguageStore.Messages || Internal.LibraryModules.LanguageStore; const LibraryStrings = Object.assign({}, InternalData.LibraryStrings); BDFDB.LanguageUtils = {}; BDFDB.LanguageUtils.languages = Object.assign({}, InternalData.Languages); @@ -4568,9 +4569,9 @@ module.exports = (_ => { if (language.name.startsWith("Discord")) return language.name.slice(0, -1) + (language.ownlang && (BDFDB.LanguageUtils.languages[language.id] || {}).name != language.ownlang ? ` / ${language.ownlang}` : "") + ")"; else return language.name + (language.ownlang && language.name != language.ownlang ? ` / ${language.ownlang}` : ""); }; - BDFDB.LanguageUtils.LanguageStrings = new Proxy(InternalData.LanguageStringHashes, { + BDFDB.LanguageUtils.LanguageStrings = new Proxy(LanguageStrings, { get: function (list, item) { - let stringObj = LanguageStringsObj[item] || LanguageStringsObj[InternalData.LanguageStringHashes[item]]; + let stringObj = LanguageStringsObj[item]; if (!stringObj) BDFDB.LogUtils.warn([item, "not found in BDFDB.LanguageUtils.LanguageStrings"]); else { if (stringObj && typeof stringObj == "object" && typeof stringObj.format == "function") return BDFDB.LanguageUtils.LanguageStringsFormat(item); @@ -4579,9 +4580,9 @@ module.exports = (_ => { return ""; } }); - BDFDB.LanguageUtils.LanguageStringsCheck = new Proxy(InternalData.LanguageStringHashes, { + BDFDB.LanguageUtils.LanguageStringsCheck = new Proxy(LanguageStrings, { get: function (list, item) { - return !!(LanguageStringsObj[item] || LanguageStringsObj[InternalData.LanguageStringHashes[item]]); + return !!LanguageStringsObj[item]; } }); let parseLanguageStringObj = obj => { @@ -4597,7 +4598,7 @@ module.exports = (_ => { }; BDFDB.LanguageUtils.LanguageStringsFormat = function (item, ...values) { if (item) { - let stringObj = LanguageStringsObj[item] || LanguageStringsObj[InternalData.LanguageStringHashes[item]]; + let stringObj = LanguageStringsObj[item]; if (stringObj && typeof stringObj == "object" && typeof stringObj.format == "function") { let i = 0, returnvalue, formatVars = {}; while (!returnvalue && i < 10) { @@ -4637,7 +4638,7 @@ module.exports = (_ => { return ""; } }); - BDFDB.LanguageUtils.LibraryStringsCheck = new Proxy(LibraryStrings.default || {}, { + BDFDB.LanguageUtils.LibraryStringsCheck = new Proxy(LanguageStrings, { get: function (list, item) { return !!LibraryStrings.default[item]; } @@ -8577,7 +8578,7 @@ module.exports = (_ => { }; BDFDB.DevUtils.generateLanguageStrings = function (strings, config = {}) { const language = config.language || "en"; - const languages = BDFDB.ArrayUtils.removeCopies(BDFDB.ArrayUtils.is(config.languages) ? config.languages : ["en"].concat((BDFDB.ModuleUtils.findByProperties("getLanguages").getLanguages()).filter(n => n.enabled).map(n => { + const languages = BDFDB.ArrayUtils.removeCopies(BDFDB.ArrayUtils.is(config.languages) ? config.languages : ["en"].concat((Internal.LibraryModules.LanguageStore.languages || Internal.LibraryModules.LanguageStore._languages).filter(n => n.enabled).map(n => { if (BDFDB.LanguageUtils.languages[n.code]) return n.code; else { const code = n.code.split("-")[0];