mirror of
https://github.com/Equicord/Equicord.git
synced 2025-02-07 10:43:36 -05:00
Language Blacklist for MessageTranslate
This commit is contained in:
parent
b5cf8b84cd
commit
b10429e0ae
1 changed files with 7 additions and 0 deletions
|
@ -22,9 +22,16 @@ const settings = definePluginSettings(
|
||||||
default: "0.8",
|
default: "0.8",
|
||||||
restartNeeded: true
|
restartNeeded: true
|
||||||
},
|
},
|
||||||
|
languageBlacklist: {
|
||||||
|
type: OptionType.STRING,
|
||||||
|
description: "Language codes to disable functionality in (separate with comma)",
|
||||||
|
default: "",
|
||||||
|
restartNeeded: true
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
async function translateAPI(sourceLang: string, targetLang: string, text: string): Promise<any> {
|
async function translateAPI(sourceLang: string, targetLang: string, text: string): Promise<any> {
|
||||||
|
if (settings.store.languageBlacklist.includes(sourceLang)) return;
|
||||||
|
|
||||||
const url = `https://translate.googleapis.com/translate_a/single?client=gtx&sl=${sourceLang}&tl=${targetLang}&dt=t&dj=1&q=${encodeURIComponent(text)}`;
|
const url = `https://translate.googleapis.com/translate_a/single?client=gtx&sl=${sourceLang}&tl=${targetLang}&dt=t&dj=1&q=${encodeURIComponent(text)}`;
|
||||||
const response = await fetch(url);
|
const response = await fetch(url);
|
||||||
|
|
Loading…
Reference in a new issue