/
types.go
31 lines (25 loc) · 974 Bytes
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package discordgoi18n
import (
"github.com/bwmarrin/discordgo"
)
// Vars is the collection used to inject variables during translation.
// This type only exists to be less verbose.
type Vars map[string]interface{}
type translator interface {
SetDefault(locale discordgo.Locale)
LoadBundle(locale discordgo.Locale, file string) error
Get(locale discordgo.Locale, key string, values Vars) string
GetLocalizations(key string, variables Vars) *map[discordgo.Locale]string
}
type translatorImpl struct {
defaultLocale discordgo.Locale
translations map[discordgo.Locale]bundle
loadedBundles map[string]bundle
}
type translatorMock struct {
SetDefaultFunc func(locale discordgo.Locale)
LoadBundleFunc func(locale discordgo.Locale, file string) error
GetFunc func(locale discordgo.Locale, key string, values Vars) string
GetLocalizationsFunc func(key string, variables Vars) *map[discordgo.Locale]string
}
type bundle map[string][]string