8000 cmd/gotext: require translation field · golang/text@a15b1bf · GitHub
[go: up one dir, main page]

Skip to content

Commit a15b1bf

Browse files
committed
cmd/gotext: require translation field
This makes it easier to start typing. Change-Id: I890c7533e021ab99cec2a0b51de4f743007e33e3 Reviewed-on: https://go-review.googlesource.com/82201 Run-TryBot: Marcel van Lohuizen <mpvl@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Nigel Tao <nigeltao@golang.org>
1 parent be25de4 commit a15b1bf

File tree

9 files changed

+49
-1
lines changed

9 files changed

+49
-1
lines changed

cmd/gotext/examples/extract/locales/de/out.gotext.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
"Hello world!\n"
77
],
88
"message": "Hello world!\n",
9+
"translation": "",
910
"position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:27:10"
1011
},
1112
{
1213
"key": [
1314
"Hello %s!\n"
1415
],
1516
"message": "Hello {City}!\n",
17+
"translation": "",
1618
"placeholders": [
1719
{
1820
"id": "City",
@@ -30,6 +32,7 @@
3032
"Hello %s!\n"
3133
],
3234
"message": "Hello {Town}!\n",
35+
"translation": "",
3336
"placeholders": [
3437
{
3538
"id": "Town",
@@ -48,6 +51,7 @@
4851
"%s is visiting %s!\n"
4952
],
5053
"message": "{Person} is visiting {Place}!\n",
54+
"translation": "",
5155
"placeholders": [
5256
{
5357
"id": "Person",
@@ -75,6 +79,7 @@
7579
"%[1]s is visiting %[3]s!\n"
7680
],
7781
"message": "{Person} is visiting {Place}!\n",
82+
"translation": "",
7883
"comment": "Person visiting a place.",
7984
"placeholders": [
8085
{
@@ -110,6 +115,7 @@
110115
"%d files remaining!"
111116
],
112117
"message": "{} files remaining!",
118+
"translation": "",
113119
"placeholders": [
114120
{
115121
"id": "",
@@ -127,6 +133,7 @@
127133
"%d more files remaining!"
128134
],
129135
"message": "{N} more files remaining!",
136+
"translation": "",
130137
"placeholders": [
131138
{
132139
"id": "N",
@@ -144,6 +151,7 @@
144151
"Use the following code for your discount: %d\n"
145152
],
146153
"message": "Use the following code for your discount: {ReferralCode}\n",
154+
"translation": "",
147155
"placeholders": [
148156
{
149157
"id": "ReferralCode",
@@ -162,6 +170,7 @@
162170
"%s is out of order!"
163171
],
164172
"message": "{Device} is out of order!",
173+
"translation": "",
165174
"comment": "FOO\n",
166175
"placeholders": [
167176
{
@@ -180,6 +189,7 @@
180189
"%.2[1]f miles traveled (%[1]f)"
181190
],
182191
"message": "{Miles} miles traveled ({Miles_1})",
192+
"translation": "",
183193
"placeholders": [
184194
{
185195
"id": "Miles",

cmd/gotext/examples/extract/locales/en-US/out.gotext.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
"Hello world!\n"
77
],
88
"message": "Hello world!\n",
9+
"translation": "",
910
"position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:27:10"
1011
},
1112
{
1213
"key": [
1314
"Hello %s!\n"
1415
],
1516
"message": "Hello {City}!\n",
17+
"translation": "",
1618
"placeholders": [
1719
{
1820
"id": "City",
@@ -30,6 +32,7 @@
3032
"Hello %s!\n"
3133
],
3234
"message": "Hello {Town}!\n",
35+
"translation": "",
3336
"placeholders": [
3437
{
3538
"id": "Town",
@@ -48,6 +51,7 @@
4851
"%s is visiting %s!\n"
4952
],
5053
"message": "{Person} is visiting {Place}!\n",
54+
"translation": "",
5155
"placeholders": [
5256
{
5357
"id": "Person",
@@ -75,6 +79,7 @@
7579
"%[1]s is visiting %[3]s!\n"
7680
],
7781
"message": "{Person} is visiting {Place}!\n",
82+
"translation": "",
7883
"comment": "Person visiting a place.",
7984
"placeholders": [
8085
{
@@ -110,6 +115,7 @@
110115
"%d files remaining!"
111116
],
112117
"message": "{} files remaining!",
118+
"translation": "",
113119
"placeholders": [
114120
{
115121
"id": "",
@@ -127,6 +133,7 @@
127133
"%d more files remaining!"
128134
],
129135
"message": "{N} more files remaining!",
136+
"translation": "",
130137
"placeholders": [
131138
{
132139
"id": "N",
@@ -144,6 +151,7 @@
144151
"Use the following code for your discount: %d\n"
145152
],
146153
"message": "Use the following code for your discount: {ReferralCode}\n",
154+
"translation": "",
147155
"placeholders": [
148156
{
149157
"id": "ReferralCode",
@@ -162,6 +170,7 @@
162170
"%s is out of order!"
163171
],
164172
"message": "{Device} is out of order!",
173+
"translation": "",
165174
"comment": "FOO\n",
166175
"placeholders": [
167176
{
@@ -180,6 +189,7 @@
180189
"%.2[1]f miles traveled (%[1]f)"
181190
],
182191
"message": "{Miles} miles traveled ({Miles_1})",
192+
"translation": "",
183193
"placeholders": [
184194
{
185195
"id": "Miles",

cmd/gotext/examples/extract/locales/extracted.gotext.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
"Hello world!\n"
77
],
88
"message": "Hello world!\n",
9+
"translation": "",
910
"position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:27:10"
1011
},
1112
{
1213
"key": [
1314
"Hello %s!\n"
1415
],
1516
"message": "Hello {City}!\n",
17+
"translation": "",
1618
"placeholders": [
1719
{
1820
"id": "City",
@@ -30,6 +32,7 @@
3032
"Hello %s!\n"
3133
],
3234
"message": "Hello {Town}!\n",
35+
"translation": "",
3336
"placeholders": [
3437
{
3538
"id": "Town",
@@ -48,6 +51,7 @@
4851
"%s is visiting %s!\n"
4952
],
5053
"message": "{Person} is visiting {Place}!\n",
54+
"translation": "",
5155
"placeholders": [
5256
{
5357
"id": "Person",
@@ -75,6 +79,7 @@
7579
"%[1]s is visiting %[3]s!\n"
7680
],
7781
"message": "{Person} is visiting {Place}!\n",
82+
"translation": "",
7883
"comment": "Person visiting a place.",
7984
"placeholders": [
8085
{
@@ -110,6 +115,7 @@
110115
"%d files remaining!"
111116
],
112117
"message": "{} files remaining!",
118+
"translation": "",
113119
"placeholders": [
114120
{
115121
"id": "",
@@ -127,6 +133,7 @@
127133
"%d more files remaining!"
128134
],
129135
"message": "{N} more files remaining!",
136+
"translation": "",
130137
"placeholders": [
131138
{
132139
"id": "N",
@@ -144,6 +151,7 @@
144151
"Use the following code for your discount: %d\n"
145152
],
146153
"message": "Use the following code for your discount: {ReferralCode}\n",
154+
"translation": "",
147155
"placeholders": [
148156
{
149157
"id": "ReferralCode",
@@ -162,6 +170,7 @@
162170
"%s is out of order!"
163171
],
164172
"message": "{Device} is out of order!",
173+
"translation": "",
165174
"comment": "FOO\n",
166175
"placeholders": [
167176
{
@@ -180,6 +189,7 @@
180189
"%.2[1]f miles traveled (%[1]f)"
181190
],
182191
"message": "{Miles} miles traveled ({Miles_1})",
192+
"translation": "",
183193
"placeholders": [
184194
{
185195
"id": "Miles",

cmd/gotext/examples/extract/locales/zh/out.gotext.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
"Hello world!\n"
77
],
88
"message": "Hello world!\n",
9+
"translation": "",
910
"position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:27:10"
1011
},
1112
{
1213
"key": [
1314
"Hello %s!\n"
1415
],
1516
"message": "Hello {City}!\n",
17+
"translation": "",
1618
"placeholders": [
1719
{
1820
"id": "City",
@@ -30,6 +32,7 @@
3032
"Hello %s!\n"
3133
],
3234
"message": "Hello {Town}!\n",
35+
"translation": "",
3336
"placeholders": [
3437
{
3538
"id": "Town",
@@ -48,6 +51,7 @@
4851
"%s is visiting %s!\n"
4952
],
5053
"message": "{Person} is visiting {Place}!\n",
54+
"translation": "",
5155
"placeholders": [
5256
{
5357
"id": "Person",
@@ -75,6 +79,7 @@
7579
"%[1]s is visiting %[3]s!\n"
7680
],
7781
"message": "{Person} is visiting {Place}!\n",
82+
"translation": "",
7883
"comment": "Person visiting a place.",
7984
"placeholders": [
8085
{
@@ -110,6 +115,7 @@
110115
"%d files remaining!"
111116
],
112117
"message": "{} files remaining!",
118+
"translation": "",
113119
"placeholders": [
114120
{
115121
"id": "",
@@ -127,6 +133,7 @@
127133
"%d more files remaining!"
128134
],
129135
"message": "{N} more files remaining!",
136+
"translation": "",
130137
"placeholders": [
131138
{
132139
"id": "N",
@@ -144,6 +151,7 @@
144151
"Use the following code for your discount: %d\n"
145152
],
146153
"message": "Use the following code for your discount: {ReferralCode}\n",
154+
"translation": "",
147155
"placeholders": [
148156
{
149157
"id": "ReferralCode",
@@ -162,6 +170,7 @@
162170
"%s is out of order!"
163171
],
164172
"message": "{Device} is out of order!",
173+
"translation": "",
165174
"comment": "FOO\n",
166175
"placeholders": [
167176
{
@@ -180,6 +189,7 @@
180189
"%.2[1]f miles traveled (%[1]f)"
181190
],
182191
"message": "{Miles} miles traveled ({Miles_1})",
192+
"translation": "",
183193
"placeholders": [
184194
{
185195
"id": "Miles",

cmd/gotext/examples/extract_http/locales/de/out.gotext.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"Hello %s!\n"
77
],
88
"message": "Hello {From}!\n",
9+
"translation": "",
910
"placeholders": [
1011
{
1112
"id": "From",
@@ -23,6 +24,7 @@
2324
"Do you like your browser (%s)?\n"
2425
],
2526
"message": "Do you like your browser ({User_Agent})?\n",
27+
"translation": "",
2628
"placeholders": [
2729
{
2830
"id": "User_Agent",

cmd/gotext/examples/extract_http/locales/en-US/out.gotext.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"Hello %s!\n"
77
],
88
"message": "Hello {From}!\n",
9+
"translation": "",
910
"placeholders": [
1011
{
1112
"id": "From",
@@ -23,6 +24,7 @@
2324
"Do you like your browser (%s)?\n"
2425
],
2526
"message": "Do you like your browser ({User_Agent})?\n",
27+
"translation": "",
2628
"placeholders": [
2729
{
2830
"id": "User_Agent",

cmd/gotext/examples/extract_http/locales/extracted.gotext.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"Hello %s!\n"
77
],
88
"message": "Hello {From}!\n",
9+
"translation": "",
910
"placeholders": [
1011
{
1112
"id": "From",
@@ -23,6 +24,7 @@
2324
"Do you like your browser (%s)?\n"
2425
],
2526
"message": "Do you like your browser ({User_Agent})?\n",
27+
"translation": "",
2628
"placeholders": [
2729
{
2830
"id": "User_Agent",

cmd/gotext/examples/extract_http/locales/zh/out.gotext.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"Hello %s!\n"
77
],
88
"message": "Hello {From}!\n",
9+
"translation": "",
910
"placeholders": [
1011
{
1112
"id": "From",
@@ -23,6 +24,7 @@
2324
"Do you like your browser (%s)?\n"
2425
],
2526
"message": "Do you like your browser ({User_Agent})?\n",
27+
"translation": "",
2628
"placeholders": [
2729
{
2830
"id": "User_Agent",

cmd/gotext/message.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type Message struct {
3737
Key []string `json:"key,omitempty"`
3838
Meaning string `json:"meaning,omitempty"`
3939
Message Text `json:"message"`
40-
Translation *Text `json:"translation,omitempty"` // TODO: not pointer?
40+
Translation Text `json:"translation"`
4141

4242
Comment string `json:"comment,omitempty"`
4343
TranslatorComment string `json:"translatorComment,omitempty"`

0 commit comments

Comments
 (0)
0