-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.go
55 lines (40 loc) · 1.44 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package i18n
import (
"golang.org/x/text/language"
"github.com/wfusion/gofusion/common/utils"
)
type Localizable[T comparable] interface {
AddMessages(code T, trans map[language.Tag]*Message, opts ...utils.OptionExtender) Localizable[T]
Localize(code T, opts ...utils.OptionExtender) (message string)
}
// Conf i18n configure
type Conf struct {
DefaultLang string `yaml:"default_lang" json:"default_lang" toml:"default_lang" default:"zh"`
}
// Message is a string that can be localized.
type Message struct {
// ID uniquely identifies the message.
ID string
// Hash uniquely identifies the content of the message
// that this message was translated from.
Hash string
// Description describes the message to give additional
// context to translators that may be relevant for translation.
Description string
// LeftDelim is the left Go template delimiter.
LeftDelim string
// RightDelim is the right Go template delimiter.``
RightDelim string
// Zero is the content of the message for the CLDR plural form "zero".
Zero string
// One is the content of the message for the CLDR plural form "one".
One string
// Two is the content of the message for the CLDR plural form "two".
Two string
// Few is the content of the message for the CLDR plural form "few".
Few string
// Many is the content of the message for the CLDR plural form "many".
Many string
// Other is the content of the message for the CLDR plural form "other".
Other string
}