i18n

package
v0.0.0-...-91b6c6a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2024 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	I18nRootDir = "./assets/i18n"

	LanguagesName = []LanguageName{EnglishLang, PortugueseLang}
)
View Source
var (
	ErrInvalidKeyType     = errors.New("invalid key type")
	ErrInvalidMapAccess   = errors.New("invalid map access")
	ErrInvalidArrayAccess = errors.New("invalid array access")
)

Functions

func GetCommand

func GetCommand(l *Language, name string) any

Types

type CommandCNPJ

type CommandCNPJ struct {
	*Common
	Definition *CommandDefinition

	Title       Entry
	WithMask    Entry
	WithoutMask Entry
}

type CommandCPF

type CommandCPF struct {
	*Common
	Definition *CommandDefinition

	Title       Entry
	WithMask    Entry
	WithoutMask Entry
}

type CommandCat

type CommandCat struct {
	Definition *CommandDefinition
}

type CommandDefinition

type CommandDefinition struct {
	Name        Entry
	Description Entry

	Parameters  []ParameterDefinition
	SubCommands []CommandDefinition
}

func MustGetCommandDefinition

func MustGetCommandDefinition(l *Language, name string) *CommandDefinition

type CommandDog

type CommandDog struct {
	Definition *CommandDefinition
}

type CommandDonate

type CommandDonate struct {
	*Common
	Definition *CommandDefinition

	Title Entry
}

type CommandEven

type CommandEven struct {
	*Common
	Definition *CommandDefinition

	Even Entry
	Odd  Entry
}

type CommandFollow

type CommandFollow struct {
	*Common
	Definition *CommandDefinition

	MatchNotFound      Entry
	MatchFinished      Entry
	AlreadyFollowing   Entry
	FollowLimitReached Entry
}

type CommandFox

type CommandFox struct {
	Definition *CommandDefinition
}

type CommandHelp

type CommandHelp struct {
	*Common
	RawMap     RawJSONMap
	Definition *CommandDefinition

	Title              Entry
	Parameters         Entry
	Validations        Entry
	SubCommands        Entry
	Aliases            Entry
	Permission         Entry
	Category           Entry
	AKA                Entry
	ForMoreInfo        Entry
	CommandNotFound    Entry
	SubCommandNotFound Entry
	RequiresPermission Entry
	Required           Entry
	NotRequired        Entry
}

type CommandJoke

type CommandJoke struct {
	Definition *CommandDefinition
}

type CommandLanguage

type CommandLanguage struct {
	*Common
	*Meta
	Definition *CommandDefinition

	Title                Entry
	LanguageNotFound     Entry
	LanguageChanged      Entry
	LanguageList         Entry
	CurrentLanguage      Entry
	UsingDefaultLanguage Entry
}

type CommandLive

type CommandLive struct {
	*Common
	Definition *CommandDefinition

	NoMatchesLive Entry
	Title         Entry
	Page          Entry
	PageNotFound  Entry
	Footer        Entry
}

type CommandLyric

type CommandLyric struct {
	*Common
	Definition *CommandDefinition

	NothingPlaying Entry
	NoResults      Entry
	NotConnected   Entry
}

type CommandNews

type CommandNews struct {
	*Common
	Definition *CommandDefinition

	Title   Entry
	Unknown Entry
	SeeMore Entry
}

type CommandPassword

type CommandPassword struct {
	*Common
	Definition *CommandDefinition

	Title       Entry
	Description Entry
}

type CommandPause

type CommandPause struct {
	*Common
	Definition *CommandDefinition

	CannotPause   Entry
	AlreadyPaused Entry
	Paused        Entry
}

type CommandPick

type CommandPick struct {
	*Common
	Definition *CommandDefinition

	Title       Entry
	Description Entry
}

type CommandPing

type CommandPing struct {
	*Common
	Definition *CommandDefinition

	Title            Entry
	Footer           Entry
	APILatency       Entry
	StillCalculating Entry
}

type CommandPlay

type CommandPlay struct {
	*Common
	Definition *CommandDefinition

	CannotConnect            Entry
	YouTubePlaylist          Entry
	BestResult               Entry
	MultipleResults          Entry
	MultipleResultsSelectOne Entry
	FirstResultWillPlay      Entry
	IfYouFailToSelect        Entry
	Entry                    Entry
	SelectedResult           Entry
	ConfirmBtn               Entry
	PlayOtherBtn             Entry
	CancelBtn                Entry
}

type CommandPlaying

type CommandPlaying struct {
	*Common
	Definition *CommandDefinition

	Title      Entry
	Entry      Entry
	ComingNext Entry
	Song       Entry
	Songs      Entry
	AndMore    Entry
}

type CommandRadio

type CommandRadio struct {
	*Common
	Definition *CommandDefinition

	ListTitle     Entry
	CannotConnect Entry
	AddedToQueue  Entry
	ListFooter    Entry
}

type CommandResume

type CommandResume struct {
	*Common
	Definition *CommandDefinition

	NotPaused Entry
	Resumed   Entry
}

type CommandRoll

type CommandRoll struct {
	*Common
	Definition *CommandDefinition

	Dice        Entry
	Dices       Entry
	Face        Entry
	Faces       Entry
	Title       Entry
	Description Entry
}

type CommandScore

type CommandScore struct {
	*Common
	Definition *CommandDefinition

	MatchNotFound Entry
	LiveUpdates   Entry
}

type CommandServer

type CommandServer struct {
	*Common
	Definition *CommandDefinition

	Title                Entry
	ServerOptionsChanged Entry
}

type CommandShuffle

type CommandShuffle struct {
	*Common
	Definition *CommandDefinition

	Shuffled Entry
}

type CommandSkip

type CommandSkip struct {
	*Common
	Definition *CommandDefinition

	Skipped Entry
}

type CommandSource

type CommandSource struct {
	*Common
	Definition *CommandDefinition

	Description Entry
}

type CommandStop

type CommandStop struct {
	*Common
	Definition *CommandDefinition

	Stopped Entry
}

type CommandUUID

type CommandUUID struct {
	Definition *CommandDefinition
}

type CommandUnFollow

type CommandUnFollow struct {
	*Common
	Definition *CommandDefinition

	NotFollowingAny   Entry
	UnFollowedAll     Entry
	MatchNotFound     Entry
	NotFollowingMatch Entry
	UnfollowedMatch   Entry
}

type CommandUptime

type CommandUptime struct {
	*Locale
	*Common
	*Meta
	Definition *CommandDefinition

	Language       Entry
	Title          Entry
	Uptime         Entry
	Implementation Entry
	HostInfoKey    Entry
	HostInfoValue  Entry
	StartedAt      Entry
	LastCommit     Entry
}

type CommandVolume

type CommandVolume struct {
	*Common
	Definition *CommandDefinition
}

type CommandXkcd

type CommandXkcd struct {
	Definition *CommandDefinition
}

type Commands

type Commands struct {
	Even     *CommandEven
	Pick     *CommandPick
	News     *CommandNews
	Roll     *CommandRoll
	Follow   *CommandFollow
	UnFollow *CommandUnFollow
	Live     *CommandLive
	Score    *CommandScore
	CNPJ     *CommandCNPJ
	CPF      *CommandCPF
	Password *CommandPassword
	Source   *CommandSource
	Ping     *CommandPing
	Donate   *CommandDonate
	Uptime   *CommandUptime
	Resume   *CommandResume
	Shuffle  *CommandShuffle
	Skip     *CommandSkip
	Stop     *CommandStop
	Lyric    *CommandLyric
	Pause    *CommandPause
	Volume   *CommandVolume
	Playing  *CommandPlaying
	Radio    *CommandRadio
	Help     *CommandHelp
	Play     *CommandPlay
	Dog      *CommandDog
	Cat      *CommandCat
	Fox      *CommandFox
	UUID     *CommandUUID
	Joke     *CommandJoke
	Xkcd     *CommandXkcd
	Language *CommandLanguage
	Server   *CommandServer
}

type Common

type Common struct {
	HelloWorld         Entry
	SomethingWentWrong Entry
	Took               Entry

	TranslationInProgress Entry

	MatchInfo   *MatchInfo
	PlayingInfo *PlayingInfo

	DurationNow             Entry
	DurationLessThanAMinute Entry
	DurationDay             Entry
	DurationDays            Entry
	DurationHour            Entry
	DurationHours           Entry
	DurationMinute          Entry
	DurationMinutes         Entry

	DurationSecond  Entry
	DurationSeconds Entry

	Validations *Validations
	Categories  map[string]Entry
}

type Entry

type Entry string

func (Entry) Str

func (e Entry) Str(params ...any) string

type Language

type Language struct {
	*Meta    `json:"meta"`
	*Common  `json:"common"`
	*Locale  `json:"locale"`
	Commands *Commands

	RawMap RawJSONMap `json:"-"`
	// contains filtered or unexported fields
}

func GetLanguage

func GetLanguage(name LanguageName) (*Language, error)

func MustGetLanguage

func MustGetLanguage(name LanguageName) *Language

type LanguageName

type LanguageName string
const (
	EnglishLang    LanguageName = "en_US"
	PortugueseLang LanguageName = "pt_BR"

	DefaultLanguageName = EnglishLang
)

func FindLanguageName

func FindLanguageName(name string) LanguageName

func (LanguageName) DiscordName

func (l LanguageName) DiscordName() string

type Locale

type Locale struct {
	SimpleDateTimeFormat string
	// contains filtered or unexported fields
}

func (*Locale) FormatSimpleDateTime

func (l *Locale) FormatSimpleDateTime(time time.Time) string

type MatchInfo

type MatchInfo struct {
	Match       Entry
	Time        Entry
	TimePenalty Entry
}

type Meta

type Meta struct {
	Name LanguageName

	DisplayName Entry
	Authors     Entry
}

type ParameterDefinition

type ParameterDefinition struct {
	Name        Entry
	Description Entry
}

type ParametersValidations

type ParametersValidations struct {
	RequiredParam Entry
	InvalidValue  Entry
	InvalidInt    Entry
	InvalidBool   Entry
}

type PlayingInfo

type PlayingInfo struct {
	SongTitle         Entry
	Artist            Entry
	Source            Entry
	ETAKey            Entry
	ETANever          Entry
	ETAValue          Entry
	DurationKey       Entry
	DurationLive      Entry
	Position          Entry
	RequestedBy       Entry
	Warning           Entry
	SongPausedWarning Entry
}

type PreCommandValidation

type PreCommandValidation struct {
	MustBeExecutedAsSlashCommand Entry
	PermissionRequired           Entry
	MissingSubCommand            Entry
	InvalidSubCommand            Entry
}

type RawJSONMap

type RawJSONMap map[string]any

func (RawJSONMap) Get

func (r RawJSONMap) Get(keys ...any) (any, error)

type ValidationMustBeOnAValidVoiceChannel

type ValidationMustBeOnAValidVoiceChannel struct {
	Description            Entry
	CannotConnectToChannel Entry
}

type ValidationMustBeOnSameVoiceChannel

type ValidationMustBeOnSameVoiceChannel struct {
	Description       Entry
	NotInRightChannel Entry
}

type ValidationMustBeOnVoiceChannel

type ValidationMustBeOnVoiceChannel struct {
	Description             Entry
	YouAreNotInVoiceChannel Entry
}

type ValidationMustBePlaying

type ValidationMustBePlaying struct {
	Description    Entry
	NothingPlaying Entry
}

type ValidationMustHaveVoicerOnGuild

type ValidationMustHaveVoicerOnGuild struct {
	Description     Entry
	BotNotConnected Entry
}

type Validations

type Validations struct {
	MustHaveVoicerOnGuild      *ValidationMustHaveVoicerOnGuild
	MustBePlaying              *ValidationMustBePlaying
	MustBeOnVoiceChannel       *ValidationMustBeOnVoiceChannel
	MustBeOnAValidVoiceChannel *ValidationMustBeOnAValidVoiceChannel
	MustBeOnSameVoiceChannel   *ValidationMustBeOnSameVoiceChannel
	PreCommandValidation       *PreCommandValidation
	ParametersValidations      *ParametersValidations
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL