Locales Usage
In Seyfert the possibility to take your bot to multiple locales is quite simple.
How to use the locales
Seyfert provides a way to use the locales in your bot. The way to do it is quite simple.
There are some decorators that can be used to use the locales in your code.
Using @LocalesT
decorator
You can automatically translate all command content using the @LocalesT
decorator.
This decorator will get all the locales that you have defined as DefaultLocale
.
Using @GroupsT
decorator
This decorator has a special structure and can be a bit confusing.
The decorator has the following structure:
@GroupsT({ // This is the name of the group... Created in the parent command groupName: { // This is obligatory! Is the default name of the group. defaultDescription, // This is optional! Is the localized name of the group. name, }})
Once you understand how it works, you can use it as follows:
import { Command, LocalesT } from 'seyfert';
@GroupsT({ supremacy: { defaultDescription: "Ganyu Supremacy.", name: "foo.bar", }})export default class SupremacyCommand extends Command { }
Using locales
object property
Seyfert provides a special property to add localizations in command options.
import { createStringOption } from 'seyfert';
const options = { supremacy: createStringOption({ description: "Enter a supremacy name.", required: true, // If you don't want to add a command localized name or description! // Just remove the property from the object locales: { name: "hello", description: "foo.bar", } })}