forked from sonda2208/gpass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
localized_string.go
42 lines (32 loc) · 909 Bytes
/
localized_string.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
package gpass
import "github.com/sonda2208/gpass/walletobjects"
type LocalizedString struct {
DefaultValue *TranslatedString
TranslatedValues []*TranslatedString
}
func (ls *LocalizedString) toWO() *walletobjects.LocalizedString {
if ls == nil {
return nil
}
res := walletobjects.LocalizedString{
Kind: "walletobjects#localizedString",
TranslatedValues: listTranslatedStringToWO(ls.TranslatedValues),
}
if ls.DefaultValue != nil {
res.DefaultValue = ls.DefaultValue.toWO()
}
return &res
}
func woToLocalizedString(s *walletobjects.LocalizedString) *LocalizedString {
if s == nil {
return nil
}
res := &LocalizedString{
DefaultValue: woToTranslatedString(s.DefaultValue),
TranslatedValues: make([]*TranslatedString, len(s.TranslatedValues)),
}
for i, s := range s.TranslatedValues {
res.TranslatedValues[i] = woToTranslatedString(s)
}
return res
}