Skip to content

Commit

Permalink
Update 0BDFDB.plugin.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mwittrien committed Nov 4, 2024
1 parent d52e770 commit a7b7046
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions Library/0BDFDB.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @name BDFDB
* @author DevilBro
* @authorId 278543574059057154
* @version 3.8.1
* @version 3.8.2
* @description Required Library for DevilBro's Plugins
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
Expand Down Expand Up @@ -2545,7 +2545,7 @@ module.exports = (_ => {
}
};

LibraryModules.LanguageStore = BDFDB.ModuleUtils.find(m => m.Messages && m.Messages.IMAGE && m);
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.React = BDFDB.ModuleUtils.findByProperties("createElement", "cloneElement");
LibraryModules.ReactDOM = BDFDB.ModuleUtils.findByProperties("render", "findDOMNode");
Internal.LibraryModules = new Proxy(LibraryModules, {
Expand Down Expand Up @@ -4367,7 +4367,7 @@ module.exports = (_ => {
}
};
BDFDB.DiscordUtils.getLanguage = function () {
return Internal.LibraryModules.LanguageStore && (Internal.LibraryModules.LanguageStore.chosenLocale || Internal.LibraryModules.LanguageStore._chosenLocale) || document.querySelector("html[lang]").getAttribute("lang");
return Internal.LibraryModules.LanguageUtils && (Internal.LibraryModules.LanguageUtils.chosenLocale || Internal.LibraryModules.LanguageUtils._chosenLocale) || document.querySelector("html[lang]").getAttribute("lang");
};
BDFDB.DiscordUtils.getBuild = function () {
if (BDFDB.DiscordUtils.getBuild.build) return BDFDB.DiscordUtils.getBuild.build;
Expand Down Expand Up @@ -4549,9 +4549,8 @@ module.exports = (_ => {
return `:not(.${Internal.getDiscordClass(item, true).split(".")[0]}),`;
}
});

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 LanguageStringsObj = Internal.LibraryModules.LanguageStore && Internal.LibraryModules.LanguageStore.Messages || Internal.LibraryModules.LanguageStore || {};
const LibraryStrings = Object.assign({}, InternalData.LibraryStrings);
BDFDB.LanguageUtils = {};
BDFDB.LanguageUtils.languages = Object.assign({}, InternalData.Languages);
Expand All @@ -4569,9 +4568,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(LanguageStrings, {
BDFDB.LanguageUtils.LanguageStrings = new Proxy(InternalData.LanguageStringHashes, {
get: function (list, item) {
let stringObj = LanguageStringsObj[item];
let stringObj = LanguageStringsObj[item] || LanguageStringsObj[InternalData.LanguageStringHashes[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);
Expand All @@ -4580,9 +4579,9 @@ module.exports = (_ => {
return "";
}
});
BDFDB.LanguageUtils.LanguageStringsCheck = new Proxy(LanguageStrings, {
BDFDB.LanguageUtils.LanguageStringsCheck = new Proxy(InternalData.LanguageStringHashes, {
get: function (list, item) {
return !!LanguageStringsObj[item];
return !!(LanguageStringsObj[item] || LanguageStringsObj[InternalData.LanguageStringHashes[item]]);
}
});
let parseLanguageStringObj = obj => {
Expand All @@ -4598,7 +4597,7 @@ module.exports = (_ => {
};
BDFDB.LanguageUtils.LanguageStringsFormat = function (item, ...values) {
if (item) {
let stringObj = LanguageStringsObj[item];
let stringObj = LanguageStringsObj[item] || LanguageStringsObj[InternalData.LanguageStringHashes[item]];
if (stringObj && typeof stringObj == "object" && typeof stringObj.format == "function") {
let i = 0, returnvalue, formatVars = {};
while (!returnvalue && i < 10) {
Expand Down Expand Up @@ -4638,7 +4637,7 @@ module.exports = (_ => {
return "";
}
});
BDFDB.LanguageUtils.LibraryStringsCheck = new Proxy(LanguageStrings, {
BDFDB.LanguageUtils.LibraryStringsCheck = new Proxy(LibraryStrings.default || {}, {
get: function (list, item) {
return !!LibraryStrings.default[item];
}
Expand Down Expand Up @@ -8578,7 +8577,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((Internal.LibraryModules.LanguageStore.languages || Internal.LibraryModules.LanguageStore._languages).filter(n => n.enabled).map(n => {
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 => {
if (BDFDB.LanguageUtils.languages[n.code]) return n.code;
else {
const code = n.code.split("-")[0];
Expand Down

0 comments on commit a7b7046

Please sign in to comment.