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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
package i18n
import "testing"
func TestGetTheme(t *testing.T) {
if got := Get("pl").Theme; got != "motyw" {
t.Errorf(`Get("pl").Theme = %q, want "motyw"`, got)
}
if got := Get("en").Theme; got != "theme" {
t.Errorf(`Get("en").Theme = %q, want "theme"`, got)
}
}
func TestGetUnknownFallsBackToEnglish(t *testing.T) {
en := Get("en")
if got := Get("xx"); got.Theme != en.Theme || got.BannerGospel != en.BannerGospel {
t.Errorf(`Get("xx") = %+v, want the English set %+v`, got, en)
}
if got := Get(""); got.Theme != en.Theme || got.BannerGospel != en.BannerGospel {
t.Errorf(`Get("") = %+v, want the English set %+v`, got, en)
}
}
func TestVersionLabels(t *testing.T) {
cases := []struct {
lang, code, want string
}{
{"en", "pl", "Polish (niedziela.pl)"},
{"pl", "pl", "Polski (niedziela.pl)"},
{"en", "wuj", "Wujek (Polish)"},
{"pl", "wuj", "Wujek (pol.)"},
{"en", "vul", "Vulgate (Latin)"},
{"pl", "vul", "Wulgata (lac.)"},
{"en", "grb", "Greek"},
{"pl", "grb", "Grecki"},
{"en", "drb", "Douay-Rheims (English)"},
{"pl", "drb", "Douay-Rheims (ang.)"},
}
for _, c := range cases {
if got := Get(c.lang).Version[c.code]; got != c.want {
t.Errorf("Get(%q).Version[%q] = %q, want %q", c.lang, c.code, got, c.want)
}
}
}
func TestTUIStrings(t *testing.T) {
en := Get("en")
pl := Get("pl")
if en.FooterKeys != "tab/⇧tab version ←/→ day j/k scroll space/b page g/G top/bottom r refresh q quit" {
t.Errorf("en.FooterKeys = %q", en.FooterKeys)
}
if pl.FooterKeys != "tab/⇧tab wersja ←/→ dzień j/k przewiń spacja/b strona g/G góra/dół r odśwież q wyjście" {
t.Errorf("pl.FooterKeys = %q", pl.FooterKeys)
}
if en.Loading != "loading…" || pl.Loading != "ładowanie…" {
t.Errorf("Loading en=%q pl=%q", en.Loading, pl.Loading)
}
if en.NoReadingsFor != "no readings for " || pl.NoReadingsFor != "brak czytań na " {
t.Errorf("NoReadingsFor en=%q pl=%q", en.NoReadingsFor, pl.NoReadingsFor)
}
if en.ErrorPrefix != "error: " || pl.ErrorPrefix != "błąd: " {
t.Errorf("ErrorPrefix en=%q pl=%q", en.ErrorPrefix, pl.ErrorPrefix)
}
if en.ErrorHint != "change date (←/→) or refresh (r)" || pl.ErrorHint != "zmień datę (←/→) lub odśwież (r)" {
t.Errorf("ErrorHint en=%q pl=%q", en.ErrorHint, pl.ErrorHint)
}
}
func TestBannerWords(t *testing.T) {
en := Get("en")
pl := Get("pl")
if en.BannerGospel != "Gospel" || pl.BannerGospel != "Ewangelia" {
t.Errorf("BannerGospel en=%q pl=%q", en.BannerGospel, pl.BannerGospel)
}
if en.BannerReadings != "Readings" || pl.BannerReadings != "Czytania" {
t.Errorf("BannerReadings en=%q pl=%q", en.BannerReadings, pl.BannerReadings)
}
}
func TestWebControlLabels(t *testing.T) {
en := Get("en")
pl := Get("pl")
cases := []struct {
name, en, pl string
}{
{"Lectionary", en.Lectionary, pl.Lectionary},
{"OptModern", en.OptModern, pl.OptModern},
{"OptTraditional", en.OptTraditional, pl.OptTraditional},
{"Parts", en.Parts, pl.Parts},
{"OptGospel", en.OptGospel, pl.OptGospel},
{"OptAll", en.OptAll, pl.OptAll},
{"Layout", en.Layout, pl.Layout},
{"OptHorizontal", en.OptHorizontal, pl.OptHorizontal},
{"OptColumns", en.OptColumns, pl.OptColumns},
{"OptInterlinear", en.OptInterlinear, pl.OptInterlinear},
{"Theme", en.Theme, pl.Theme},
{"Mono", en.Mono, pl.Mono},
}
want := map[string][2]string{
"Lectionary": {"lectionary", "lekcjonarz"},
"OptModern": {"modern", "nowy"},
"OptTraditional": {"traditional", "tradycyjny"},
"Parts": {"parts", "zakres"},
"OptGospel": {"Gospel", "Ewangelia"},
"OptAll": {"all parts", "wszystkie części"},
"Layout": {"layout", "układ"},
"OptHorizontal": {"horizontal", "poziomo"},
"OptColumns": {"columns", "kolumny"},
"OptInterlinear": {"interlinear", "interlinearnie"},
"Theme": {"theme", "motyw"},
"Mono": {"mono", "mono"},
}
for _, c := range cases {
w := want[c.name]
if c.en != w[0] {
t.Errorf("en.%s = %q, want %q", c.name, c.en, w[0])
}
if c.pl != w[1] {
t.Errorf("pl.%s = %q, want %q", c.name, c.pl, w[1])
}
}
}
func TestModernPartLabels(t *testing.T) {
en := Get("en")
pl := Get("pl")
want := map[string][2]string{
"pierwsze_czytanie": {"1. czytanie", "1st reading"},
"psalm": {"Psalm", "Psalm"},
"drugie_czytanie": {"2. czytanie", "2nd reading"},
"aklamacja": {"Aklamacja", "Acclamation"},
"ewangelia": {"Ewangelia", "Gospel"},
}
for partID, w := range want {
if got := pl.PartLabel[partID]; got != w[0] {
t.Errorf("pl.PartLabel[%q] = %q, want %q", partID, got, w[0])
}
if got := en.PartLabel[partID]; got != w[1] {
t.Errorf("en.PartLabel[%q] = %q, want %q", partID, got, w[1])
}
}
}
|