Entonces, estoy creando un bot de discordia y agregaré la función de configuración de idioma, así que tengo que traducirlo a algunos idiomas y, por ejemplo:
return message.reply({ content: `${message.author.username}, hello!` });tal vez se convierta en algo como:
import langs from "some-path" import getLang from "some-path" const lang = await getLang("ID"); const text = langs[lang].<CommandName>.<TextIdentifier>; // eg "AUTHOR_USERNAME$, hello!" const replyTxt = text.replace(/$AUTHOR_USERNAME$/g, message.author.username) return message.reply({ content: replyTxt )O debería hacer algo como:
export default function ( message_author_username?: string // ... ) { this.<LangCode> = { <CommandName>: { <TextIdentifier>: `${message_author_username}, hello!` // Other texts... } // Other commands... } // Other languages... } import langs from "some-path" import getLang from "some-path" const lang = await getLang("ID"); const replyTxt = langs( message_author_username: message.author.username, // Other used parameters... )[lang].<CommandName>.<TextIdentifier>; return message.reply({ content: replyTxt )