-
Notifications
You must be signed in to change notification settings - Fork 0
/
text_h.go
43 lines (38 loc) · 1.08 KB
/
text_h.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
package language
import "github.com/nicksnyder/go-i18n/v2/i18n"
// TextHelloWorld returns a translated phrase.
func (l *Localizer) TextHelloWorld() *LocalizedString {
lg := logger.WithField("func", "TextHelloWorld")
text, tag, err := l.localizer.LocalizeWithTag(&i18n.LocalizeConfig{
DefaultMessage: &i18n.Message{
ID: "HelloWorld",
Description: "the phrase: Hello World!",
Other: "Hello World!",
},
})
if err != nil {
lg.Warningf("missing translation: %s", err.Error())
}
return &LocalizedString{
language: tag,
string: text,
}
}
// TextHomeShort returns a translated phrase.
func (l *Localizer) TextHomeShort() *LocalizedString {
lg := logger.WithField("func", "TextHomeShort")
text, tag, err := l.localizer.LocalizeWithTag(&i18n.LocalizeConfig{
DefaultMessage: &i18n.Message{
ID: "HomeShort",
Description: "a single word representation of home, as in home page.",
Other: "Home",
},
})
if err != nil {
lg.Warningf("missing translation: %s", err.Error())
}
return &LocalizedString{
language: tag,
string: text,
}
}