8000 cmd/gotext: redo dir structure and file names · golang/text@f430560 · GitHub
[go: up one dir, main page]

Skip to content

Commit f430560

Browse files
committed
cmd/gotext: redo dir structure and file names
Naming is now more conventional (see e.g. Gobuffalo). - create example translation files for multiple languages - default/extraction language is included in supported list - example uses message.MatchLanguage - standardized generation header - File -> Locale; now used for all files Change-Id: Icfb682705e103a9382a70be8aaec849fc3d8b726 Reviewed-on: https://go-review.googlesource.com/82195 Run-TryBot: Marcel van Lohuizen <mpvl@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Nigel Tao <nigeltao@golang.org>
1 parent 2a91459 commit f430560

File tree

17 files changed

+1133
-289
lines changed

17 files changed

+1133
-289
lines changed

cmd/gotext/doc.go

Lines changed: 1 addition & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
{
2+
"language": "de",
3+
"messages": [
4+
{
5+
"key": [
6+
"Hello world!\n"
7+
],
8+
"message": {
9+
"msg": "Hello world!\n"
10+
},
11+
"position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:27:10"
12+
},
13+
{
14+
"key": [
15+
"Hello %s!\n"
16+
],
17+
"message": {
18+
"msg": "Hello {City}!\n"
19+
},
20+
"placeholders": [
21+
{
22+
"id": "City",
23+
"string": "%[1]s",
24+
"type": "string",
25+
"underlyingType": "string",
26+
"argNum": 1,
27+
"expr": "city"
28+
}
29+
],
30+
"position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:31:10"
31+
},
32+
{
33+
"key": [
34+
"Hello %s!\n"
35+
],
36+
"message": {
37+
"msg": "Hello {Town}!\n"
38+
},
39+
"placeholders": [
40+
{
41+
"id": "Town",
42+
"string": "%[1]s",
43+
"type": "string",
44+
"underlyingType": "string",
45+
"argNum": 1,
46+
"expr": "town",
47+
"comment": "Town"
48+
}
49+
],
50+
"position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:35:10"
51+
},
52+
{
53+
"key": [
54+
"%s is visiting %s!\n"
55+
],
56+
"message": {
57+
"msg": "{Person} is visiting {Place}!\n"
58+
},
59+
"placeholders": [
60+
{
61+
"id": "Person",
62+
"string": "%[1]s",
63+
"type": "string",
64+
"underlyingType": "string",
65+
"argNum": 1,
66+
"expr": "person",
67+
"comment": "The person of matter."
68+
},
69+
{
70+
"id": "Place",
71+
"string": "%[2]s",
72+
"type": "string",
73+
"underlyingType": "string",
74+
"argNum": 2,
75+
"expr": "place",
76+
"comment": "Place the person is visiting."
77+
}
78+
],
79+
"position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:40:10"
80+
},
81+
{
82+
"key": [
83+
"%[1]s is visiting %[3]s!\n"
84+
],
85+
"message": {
86+
"msg": "{Person} is visiting {Place}!\n"
87+
},
88+
"comment": "Person visiting a place.",
89+
"placeholders": [
90+
{
91+
"id": "Person",
92+
"string": "%[1]s",
93+
"type": "string",
94+
"underlyingType": "string",
95+
"argNum": 1,
96+
"expr": "pp.Person"
97+
},
98+
{
99+
"id": "Place",
100+
"string": "%[3]s",
101+
"type": "string",
102+
"underlyingType": "string",
103+
"argNum": 3,
104+
"expr": "pp.Place",
105+
"comment": "Place the person is visiting."
106+
},
107+
{
108+
"id": "Extra",
109+
"string": "%[2]v",
110+
"type": "int",
111+
"underlyingType": "int",
112+
"argNum": 2,
113+
"expr": "pp.extra"
114+
}
115+
],
116+
"position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:55:10"
117+
},
118+
{
119+
"key": [
120+
"%d files remaining!"
121+
],
122+
"message": {
123+
"msg": "{} files remaining!"
124+
},
125+
"placeholders": [
126+
{
127+
"id": "",
128+
"string": "%[1]d",
129+
"type": "int",
130+
"underlyingType": "int",
131+
"argNum": 1,
132+
"expr": "2"
133+
}
134+
],
135+
"position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:62:10"
136+
},
137+
{
138+
"key": [
139+
"%d more files remaining!"
140+
],
141+
"message": {
142+
"msg": "{N} more files remaining!"
143+
},
144+
"placeholders": [
145+
{
146+
"id": "N",
147+
"string": "%[1]d",
148+
"type": "int",
149+
"underlyingType": "int",
150+
"argNum": 1,
151+
"expr": "n"
152+
}
153+
],
154+
"position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:67:10"
155+
},
156+
{
157+
"key": [
158+
"Use the following code for your discount: %d\n"
159+
],
160+
"message": {
161+
"msg": "Use the following code for your discount: {ReferralCode}\n"
162+
},
163+
"placeholders": [
164+
{
165+
"id": "ReferralCode",
166+
"string": "%[1]d",
167+
"type": "golang.org/x/text/cmd/gotext/examples/extract.referralCode",
168+
"underlyingType": "int",
169+
"argNum": 1,
170+
"expr": "c"
171+
}
172+
],
173+
"position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:73:10"
174+
},
175+
{
176+
"key": [
177+
"msgOutOfOrder",
178+
"%s is out of order!"
179+
],
180+
"message": {
181+
"msg": "{Device} is out of order!"
182+
},
183+
"comment": "FOO\n",
184+
"placeholders": [
185+
{
186+
"id": "Device",
187+
"string": "%[1]s",
188+
"type": "string",
189+
"underlyingType": "string",
190+
"argNum": 1,
191+
"expr": "device"
192+
}
193+
],
194+
"position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:81:10"
195+
},
196+
{
197+
"key": [
198+
"%.2[1]f miles traveled (%[1]f)"
199+
],
200+
"message": {
201+
"msg": "{Miles} miles traveled ({Miles_1})"
202+
},
203+
"placeholders": [
204+
{
205+
"id": "Miles",
206+
"string": "%.2[1]f",
207+
"type": "float64",
208+
"underlyingType": "float64",
209+
"argNum": 1,
210+
"expr": "miles"
211+
},
212+
{
213+
"id": "Miles_1",
214+
"string": "%[1]f",
215+
"type": "float64",
216+
"underlyingType": "float64",
217+
"argNum": 1,
218+
"expr": "miles"
219+
}
220+
],
221+
"position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:85:10"
222+
}
223+
]
224+
}

0 commit comments

Comments
 (0)
0