-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
๐ฏ Choose the target translation language ๐๏ธ Support more languages โ๏ธ Preparation of translation system
- Loading branch information
Showing
9 changed files
with
154 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const { Button } = require("sheweny"); | ||
const { deeplLanguages } = require("../../languages/deeplLanguages"); | ||
|
||
module.exports = class translateButtons extends Button { | ||
constructor(client) { | ||
super(client, [/translate_.*/]); | ||
} | ||
|
||
async execute(button) { | ||
if (!(await this.client.Defer(button))) return; | ||
const { channel, customId } = button; | ||
|
||
// Get the language, message from the button id | ||
const lang = customId.split("_")[1]; | ||
const message = await channel.messages.fetch(customId.split("_")[2]); | ||
|
||
// Translate the message | ||
const translated = await this.client.Translate(message.content, lang); | ||
|
||
return button.editReply({ | ||
embeds: [ | ||
this.client | ||
.Embed() | ||
.setAuthor({ | ||
name: message.author.tag, | ||
iconURL: message.author.displayAvatarURL({ dynamic: true }), | ||
}) | ||
.addFields( | ||
{ | ||
name: | ||
`${ | ||
deeplLanguages[ | ||
translated.translations[0].detected_source_language.toLowerCase() | ||
] | ||
} ` + | ||
`${await this.client.FastTranslate("Original", lang)}` + | ||
":", | ||
value: `${"```"}${message.content}${"```"}`, | ||
}, | ||
{ | ||
name: | ||
`${deeplLanguages[lang]} ` + | ||
`${await this.client.FastTranslate("Translation", lang)}` + | ||
":", | ||
value: `${"```"}${translated.translations[0].text}${"```"}`, | ||
} | ||
) | ||
.setFooter({ | ||
text: `Powered by DeepL.com`, | ||
}), | ||
], | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
module.exports = { | ||
deeplLanguages: { | ||
en: "๐บ๐ธ", | ||
//french | ||
fr: "๐ซ๐ท", | ||
//german | ||
de: "๐ฉ๐ช", | ||
//spanish | ||
es: "๐ช๐ธ", | ||
//italian | ||
it: "๐ฎ๐น", | ||
//portuguese | ||
pt: "๐ต๐น", | ||
//russian | ||
ru: "๐ท๐บ", | ||
//jap | ||
ja: "๐ฏ๐ต", | ||
//bulgarian | ||
bg: "๐ง๐ฌ", | ||
//chineese | ||
zh: "๐จ๐ณ", | ||
//czech | ||
cs: "๐จ๐ฟ", | ||
//danish | ||
da: "๐ฉ๐ฐ", | ||
//dutch | ||
nl: "๐ณ๐ฑ", | ||
//finnish | ||
fi: "๐ซ๐ฎ", | ||
//estonian | ||
et: "๐ช๐ช", | ||
//greek | ||
el: "๐ฌ๐ท", | ||
//hungarian | ||
hu: "๐ญ๐บ", | ||
//indonesian | ||
id: "๐ฎ๐ฉ", | ||
//lithuanian | ||
lt: "๐ฑ๐น", | ||
//polish | ||
pl: "๐ต๐ฑ", | ||
//romanian | ||
ro: "๐ท๐ด", | ||
//slovak | ||
sk: "๐ธ๐ฐ", | ||
//slovenian | ||
sl: "๐ธ๐ฎ", | ||
//swedish | ||
sv: "๐ธ๐ช", | ||
//turkish | ||
tr: "๐น๐ท", | ||
}, | ||
}; |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
supportedLanguages: { | ||
en: "๐บ๐ธ", | ||
fr: "๐ซ๐ท", | ||
}, | ||
}; |