Skip to content

Commit b627189

Browse files
committed
Added translations strings to 'board details' command
1 parent 5369917 commit b627189

File tree

4 files changed

+146
-36
lines changed

4 files changed

+146
-36
lines changed

Diff for: cli/board/details.go

+31-29
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,35 @@ import (
2424
"github.com/arduino/arduino-cli/cli/feedback"
2525
"github.com/arduino/arduino-cli/cli/instance"
2626
"github.com/arduino/arduino-cli/commands/board"
27+
"github.com/arduino/arduino-cli/i18n"
2728
rpc "github.com/arduino/arduino-cli/rpc/commands"
2829
"github.com/arduino/arduino-cli/table"
2930
"github.com/fatih/color"
3031
"github.com/spf13/cobra"
3132
)
3233

34+
var tr = i18n.Tr
3335
var showFullDetails bool
3436

3537
func initDetailsCommand() *cobra.Command {
3638
var detailsCommand = &cobra.Command{
3739
Use: "details <FQBN>",
38-
Short: "Print details about a board.",
39-
Long: "Show information about a board, in particular if the board has options to be specified in the FQBN.",
40+
Short: tr("Print details about a board."),
41+
Long: tr("Show information about a board, in particular if the board has options to be specified in the FQBN."),
4042
Example: " " + os.Args[0] + " board details arduino:avr:nano",
4143
Args: cobra.ExactArgs(1),
4244
Run: runDetailsCommand,
4345
}
4446

45-
detailsCommand.Flags().BoolVarP(&showFullDetails, "full", "f", false, "Include full details in text output")
47+
detailsCommand.Flags().BoolVarP(&showFullDetails, "full", "f", false, tr("Show full board details"))
4648

4749
return detailsCommand
4850
}
4951

5052
func runDetailsCommand(cmd *cobra.Command, args []string) {
5153
inst, err := instance.CreateInstance()
5254
if err != nil {
53-
feedback.Errorf("Error getting board details: %v", err)
55+
feedback.Errorf(tr("Error getting board details: %v"), err)
5456
os.Exit(errorcodes.ErrGeneric)
5557
}
5658

@@ -60,7 +62,7 @@ func runDetailsCommand(cmd *cobra.Command, args []string) {
6062
})
6163

6264
if err != nil {
63-
feedback.Errorf("Error getting board details: %v", err)
65+
feedback.Errorf(tr("Error getting board details: %v"), err)
6466
os.Exit(errorcodes.ErrGeneric)
6567
}
6668

@@ -93,51 +95,51 @@ func (dr detailsResult) String() string {
9395
// ATmega168 cpu=atmega168
9496
t := table.New()
9597
t.SetColumnWidthMode(1, table.Average)
96-
t.AddRow("Board name:", details.Name)
97-
t.AddRow("Board fqbn:", details.Fqbn)
98-
t.AddRow("Board propertiesId:", details.PropertiesId)
99-
t.AddRow("Board version:", details.Version)
98+
t.AddRow(tr("Board name:"), details.Name)
99+
t.AddRow("FQBN:", details.Fqbn)
100+
t.AddRow(tr("Identification properties:"), details.PropertiesId)
101+
t.AddRow(tr("Board version:"), details.Version)
100102

101103
if details.Official {
102104
t.AddRow() // get some space from above
103-
t.AddRow("Official Arduino board:",
105+
t.AddRow(tr("Official Arduino board:"),
104106
table.NewCell("✔", color.New(color.FgGreen)))
105107
}
106108

107109
for i, idp := range details.IdentificationPref {
108110
if i == 0 {
109111
t.AddRow() // get some space from above
110-
t.AddRow("Identification Preferences:", "VID:"+idp.UsbID.VID+" PID:"+idp.UsbID.PID)
112+
t.AddRow(tr("Identification properties:"), "VID:"+idp.UsbID.VID+" PID:"+idp.UsbID.PID)
111113
continue
112114
}
113115
t.AddRow("", "VID:"+idp.UsbID.VID+" PID:"+idp.UsbID.PID)
114116
}
115117

116118
t.AddRow() // get some space from above
117-
t.AddRow("Package name:", details.Package.Name)
118-
t.AddRow("Package maintainer:", details.Package.Maintainer)
119-
t.AddRow("Package URL:", details.Package.Url)
120-
t.AddRow("Package websiteURL:", details.Package.WebsiteURL)
121-
t.AddRow("Package online help:", details.Package.Help.Online)
119+
t.AddRow(tr("Package name:"), details.Package.Name)
120+
t.AddRow(tr("Package maintainer:"), details.Package.Maintainer)
121+
t.AddRow(tr("Package URL:"), details.Package.Url)
122+
t.AddRow(tr("Package website:"), details.Package.WebsiteURL)
123+
t.AddRow(tr("Package online help:"), details.Package.Help.Online)
122124

123125
t.AddRow() // get some space from above
124-
t.AddRow("Platform name:", details.Platform.Name)
125-
t.AddRow("Platform category:", details.Platform.Category)
126-
t.AddRow("Platform architecture:", details.Platform.Architecture)
127-
t.AddRow("Platform URL:", details.Platform.Url)
128-
t.AddRow("Platform file name:", details.Platform.ArchiveFileName)
129-
t.AddRow("Platform size (bytes):", fmt.Sprint(details.Platform.Size))
130-
t.AddRow("Platform checksum:", details.Platform.Checksum)
126+
t.AddRow(tr("Platform name:"), details.Platform.Name)
127+
t.AddRow(tr("Platform category:"), details.Platform.Category)
128+
t.AddRow(tr("Platform architecture:"), details.Platform.Architecture)
129+
t.AddRow(tr("Platform URL:"), details.Platform.Url)
130+
t.AddRow(tr("Platform file name:"), details.Platform.ArchiveFileName)
131+
t.AddRow(tr("Platform size (bytes):"), fmt.Sprint(details.Platform.Size))
132+
t.AddRow(tr("Platform checksum:"), details.Platform.Checksum)
131133

132134
t.AddRow() // get some space from above
133135
for _, tool := range details.ToolsDependencies {
134-
t.AddRow("Required tools:", tool.Packager+":"+tool.Name, "", tool.Version)
136+
t.AddRow(tr("Required tools:"), tool.Packager+":"+tool.Name, "", tool.Version)
135137
if showFullDetails {
136138
for _, sys := range tool.Systems {
137-
t.AddRow("", "OS:", "", sys.Host)
138-
t.AddRow("", "File:", "", sys.ArchiveFileName)
139-
t.AddRow("", "Size (bytes):", "", fmt.Sprint(sys.Size))
140-
t.AddRow("", "Checksum:", "", sys.Checksum)
139+
t.AddRow("", tr("OS:"), "", sys.Host)
140+
t.AddRow("", tr("File:"), "", sys.ArchiveFileName)
141+
t.AddRow("", tr("Size (bytes):"), "", fmt.Sprint(sys.Size))
142+
t.AddRow("", tr("Checksum:"), "", sys.Checksum)
141143
t.AddRow("", "URL:", "", sys.Url)
142144
t.AddRow() // get some space from above
143145
}
@@ -146,7 +148,7 @@ func (dr detailsResult) String() string {
146148
}
147149

148150
for _, option := range details.ConfigOptions {
149-
t.AddRow("Option:", option.OptionLabel, "", option.Option)
151+
t.AddRow(tr("Option:"), option.OptionLabel, "", option.Option)
150152
for _, value := range option.Values {
151153
green := color.New(color.FgGreen)
152154
if value.Selected {

Diff for: go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
245245
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
246246
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
247247
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
248+
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0=
248249
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
249250
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
250251
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -283,6 +284,7 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm
283284
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
284285
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
285286
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
287+
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A=
286288
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
287289
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
288290
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=

Diff for: i18n/data/en.po

+106
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,31 @@ msgstr "Aliases:"
1313
msgid "Available Commands:"
1414
msgstr "Available Commands:"
1515

16+
#: cli/board/details.go:98
17+
msgid "Board name:"
18+
msgstr "Board name:"
19+
20+
#: cli/board/details.go:101
21+
msgid "Board version:"
22+
msgstr "Board version:"
23+
24+
#: cli/board/details.go:142
25+
msgid "Checksum:"
26+
msgstr "Checksum:"
27+
28+
#: cli/board/details.go:55
29+
#: cli/board/details.go:65
30+
msgid "Error getting board details: %v"
31+
msgstr "Error getting board details: %v"
32+
1633
#: cli/usage.go:27
1734
msgid "Examples:"
1835
msgstr "Examples:"
1936

37+
#: cli/board/details.go:140
38+
msgid "File:"
39+
msgstr "File:"
40+
2041
#: cli/usage.go:29
2142
msgid "Flags:"
2243
msgstr "Flags:"
@@ -25,6 +46,91 @@ msgstr "Flags:"
2546
msgid "Global Flags:"
2647
msgstr "Global Flags:"
2748

49+
#: cli/board/details.go:100
50+
#: cli/board/details.go:112
51+
msgid "Identification properties:"
52+
msgstr "Identification properties:"
53+
54+
#: cli/board/details.go:139
55+
msgid "OS:"
56+
msgstr "OS:"
57+
58+
#: cli/board/details.go:105
59+
msgid "Official Arduino board:"
60+
msgstr "Official Arduino board:"
61+
62+
#: cli/board/details.go:151
63+
msgid "Option:"
64+
msgstr "Option:"
65+
66+
#: cli/board/details.go:121
67+
msgid "Package URL:"
68+
msgstr "Package URL:"
69+
70+
#: cli/board/details.go:120
71+
msgid "Package maintainer:"
72+
msgstr "Package maintainer:"
73+
74+
#: cli/board/details.go:119
75+
msgid "Package name:"
76+
msgstr "Package name:"
77+
78+
#: cli/board/details.go:123
79+
msgid "Package online help:"
80+
msgstr "Package online help:"
81+
82+
#: cli/board/details.go:122
83+
msgid "Package website:"
84+
msgstr "Package website:"
85+
86+
#: cli/board/details.go:129
87+
msgid "Platform URL:"
88+
msgstr "Platform URL:"
89+
90+
#: cli/board/details.go:128
91+
msgid "Platform architecture:"
92+
msgstr "Platform architecture:"
93+
94+
#: cli/board/details.go:127
95+
msgid "Platform category:"
96+
msgstr "Platform category:"
97+
98+
#: cli/board/details.go:132
99+
msgid "Platform checksum:"
100+
msgstr "Platform checksum:"
101+
102+
#: cli/board/details.go:130
103+
msgid "Platform file name:"
104+
msgstr "Platform file name:"
105+
106+
#: cli/board/details.go:126
107+
msgid "Platform name:"
108+
msgstr "Platform name:"
109+
110+
#: cli/board/details.go:131
111+
msgid "Platform size (bytes):"
112+
msgstr "Platform size (bytes):"
113+
114+
#: cli/board/details.go:40
115+
msgid "Print details about a board."
116+
msgstr "Print details about a board."
117+
118+
#: cli/board/details.go:136
119+
msgid "Required tools:"
120+
msgstr "Required tools:"
121+
122+
#: cli/board/details.go:47
123+
msgid "Show full board details"
124+
msgstr "Show full board details"
125+
126+
#: cli/board/details.go:41
127+
msgid "Show information about a board, in particular if the board has options to be specified in the FQBN."
128+
msgstr "Show information about a board, in particular if the board has options to be specified in the FQBN."
129+
130+
#: cli/board/details.go:141
131+
msgid "Size (bytes):"
132+
msgstr "Size (bytes):"
133+
28134
#: cli/usage.go:25
29135
msgid "Usage:"
30136
msgstr "Usage:"

Diff for: i18n/rice-box.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,33 @@ func init() {
1111
// define files
1212
file2 := &embedded.EmbeddedFile{
1313
Filename: ".gitkeep",
14-
FileModTime: time.Unix(1591581706, 0),
14+
FileModTime: time.Unix(1591978108, 0),
1515

1616
Content: string(""),
1717
}
1818
file3 := &embedded.EmbeddedFile{
1919
Filename: "en.po",
20-
FileModTime: time.Unix(1591581706, 0),
20+
FileModTime: time.Unix(1592475372, 0),
2121

22-
Content: string("msgid \"\"\nmsgstr \"\"\n\n#: cli/usage.go:31\nmsgid \"Additional help topics:\"\nmsgstr \"Additional help topics:\"\n\n#: cli/usage.go:26\nmsgid \"Aliases:\"\nmsgstr \"Aliases:\"\n\n#: cli/usage.go:28\nmsgid \"Available Commands:\"\nmsgstr \"Available Commands:\"\n\n#: cli/usage.go:27\nmsgid \"Examples:\"\nmsgstr \"Examples:\"\n\n#: cli/usage.go:29\nmsgid \"Flags:\"\nmsgstr \"Flags:\"\n\n#: cli/usage.go:30\nmsgid \"Global Flags:\"\nmsgstr \"Global Flags:\"\n\n#: cli/usage.go:25\nmsgid \"Usage:\"\nmsgstr \"Usage:\"\n\n#: cli/usage.go:32\nmsgid \"Use %s for more information about a command.\"\nmsgstr \"Use %s for more information about a command.\"\n\n"),
22+
Content: string("msgid \"\"\nmsgstr \"\"\n\n#: cli/usage.go:31\nmsgid \"Additional help topics:\"\nmsgstr \"Additional help topics:\"\n\n#: cli/usage.go:26\nmsgid \"Aliases:\"\nmsgstr \"Aliases:\"\n\n#: cli/usage.go:28\nmsgid \"Available Commands:\"\nmsgstr \"Available Commands:\"\n\n#: cli/board/details.go:98\nmsgid \"Board name:\"\nmsgstr \"Board name:\"\n\n#: cli/board/details.go:101\nmsgid \"Board version:\"\nmsgstr \"Board version:\"\n\n#: cli/board/details.go:142\nmsgid \"Checksum:\"\nmsgstr \"Checksum:\"\n\n#: cli/board/details.go:55\n#: cli/board/details.go:65\nmsgid \"Error getting board details: %v\"\nmsgstr \"Error getting board details: %v\"\n\n#: cli/usage.go:27\nmsgid \"Examples:\"\nmsgstr \"Examples:\"\n\n#: cli/board/details.go:140\nmsgid \"File:\"\nmsgstr \"File:\"\n\n#: cli/usage.go:29\nmsgid \"Flags:\"\nmsgstr \"Flags:\"\n\n#: cli/usage.go:30\nmsgid \"Global Flags:\"\nmsgstr \"Global Flags:\"\n\n#: cli/board/details.go:100\n#: cli/board/details.go:112\nmsgid \"Identification properties:\"\nmsgstr \"Identification properties:\"\n\n#: cli/board/details.go:139\nmsgid \"OS:\"\nmsgstr \"OS:\"\n\n#: cli/board/details.go:105\nmsgid \"Official Arduino board:\"\nmsgstr \"Official Arduino board:\"\n\n#: cli/board/details.go:151\nmsgid \"Option:\"\nmsgstr \"Option:\"\n\n#: cli/board/details.go:121\nmsgid \"Package URL:\"\nmsgstr \"Package URL:\"\n\n#: cli/board/details.go:120\nmsgid \"Package maintainer:\"\nmsgstr \"Package maintainer:\"\n\n#: cli/board/details.go:119\nmsgid \"Package name:\"\nmsgstr \"Package name:\"\n\n#: cli/board/details.go:123\nmsgid \"Package online help:\"\nmsgstr \"Package online help:\"\n\n#: cli/board/details.go:122\nmsgid \"Package website:\"\nmsgstr \"Package website:\"\n\n#: cli/board/details.go:129\nmsgid \"Platform URL:\"\nmsgstr \"Platform URL:\"\n\n#: cli/board/details.go:128\nmsgid \"Platform architecture:\"\nmsgstr \"Platform architecture:\"\n\n#: cli/board/details.go:127\nmsgid \"Platform category:\"\nmsgstr \"Platform category:\"\n\n#: cli/board/details.go:132\nmsgid \"Platform checksum:\"\nmsgstr \"Platform checksum:\"\n\n#: cli/board/details.go:130\nmsgid \"Platform file name:\"\nmsgstr \"Platform file name:\"\n\n#: cli/board/details.go:126\nmsgid \"Platform name:\"\nmsgstr \"Platform name:\"\n\n#: cli/board/details.go:131\nmsgid \"Platform size (bytes):\"\nmsgstr \"Platform size (bytes):\"\n\n#: cli/board/details.go:40\nmsgid \"Print details about a board.\"\nmsgstr \"Print details about a board.\"\n\n#: cli/board/details.go:136\nmsgid \"Required tools:\"\nmsgstr \"Required tools:\"\n\n#: cli/board/details.go:47\nmsgid \"Show full board details\"\nmsgstr \"Show full board details\"\n\n#: cli/board/details.go:41\nmsgid \"Show information about a board, in particular if the board has options to be specified in the FQBN.\"\nmsgstr \"Show information about a board, in particular if the board has options to be specified in the FQBN.\"\n\n#: cli/board/details.go:141\nmsgid \"Size (bytes):\"\nmsgstr \"Size (bytes):\"\n\n#: cli/usage.go:25\nmsgid \"Usage:\"\nmsgstr \"Usage:\"\n\n#: cli/usage.go:32\nmsgid \"Use %s for more information about a command.\"\nmsgstr \"Use %s for more information about a command.\"\n\n"),
2323
}
2424
file4 := &embedded.EmbeddedFile{
2525
Filename: "it_IT.po",
26-
FileModTime: time.Unix(1591581735, 0),
26+
FileModTime: time.Unix(1591978150, 0),
2727

2828
Content: string("# \n# Translators:\n# Cristian Maglie <[email protected]>, 2020\n# \nmsgid \"\"\nmsgstr \"\"\n\"Last-Translator: Cristian Maglie <[email protected]>, 2020\\n\"\n\"Language-Team: Italian (Italy) (https://www.transifex.com/arduino-1/teams/108174/it_IT/)\\n\"\n\"Language: it_IT\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: cli/usage.go:31\nmsgid \"Additional help topics:\"\nmsgstr \"Informazioni aggiuntive:\"\n\n#: cli/usage.go:26\nmsgid \"Aliases:\"\nmsgstr \"Alias:\"\n\n#: cli/usage.go:28\nmsgid \"Available Commands:\"\nmsgstr \"Comandi disponibili:\"\n\n#: cli/usage.go:27\nmsgid \"Examples:\"\nmsgstr \"Esempi:\"\n\n#: cli/usage.go:29\nmsgid \"Flags:\"\nmsgstr \"\"\n\n#: cli/usage.go:30\nmsgid \"Global Flags:\"\nmsgstr \"\"\n\n#: cli/usage.go:25\nmsgid \"Usage:\"\nmsgstr \"\"\n\n#: cli/usage.go:32\nmsgid \"Use %s for more information about a command.\"\nmsgstr \"\"\n"),
2929
}
3030
file5 := &embedded.EmbeddedFile{
3131
Filename: "pt_BR.po",
32-
FileModTime: time.Unix(1591581735, 0),
32+
FileModTime: time.Unix(1591978150, 0),
3333

3434
Content: string("# \n# Translators:\n# Henrique Diniz <[email protected]>, 2020\n# \nmsgid \"\"\nmsgstr \"\"\n\"Last-Translator: Henrique Diniz <[email protected]>, 2020\\n\"\n\"Language-Team: Portuguese (Brazil) (https://www.transifex.com/arduino-1/teams/108174/pt_BR/)\\n\"\n\"Language: pt_BR\\n\"\n\"Plural-Forms: nplurals=2; plural=(n > 1);\\n\"\n\n#: cli/usage.go:31\nmsgid \"Additional help topics:\"\nmsgstr \"\"\n\n#: cli/usage.go:26\nmsgid \"Aliases:\"\nmsgstr \"\"\n\n#: cli/usage.go:28\nmsgid \"Available Commands:\"\nmsgstr \"\"\n\n#: cli/usage.go:27\nmsgid \"Examples:\"\nmsgstr \"\"\n\n#: cli/usage.go:29\nmsgid \"Flags:\"\nmsgstr \"\"\n\n#: cli/usage.go:30\nmsgid \"Global Flags:\"\nmsgstr \"\"\n\n#: cli/usage.go:25\nmsgid \"Usage:\"\nmsgstr \"\"\n\n#: cli/usage.go:32\nmsgid \"Use %s for more information about a command.\"\nmsgstr \"Use %s para mais informações sobre um comando.\"\n"),
3535
}
3636

3737
// define dirs
3838
dir1 := &embedded.EmbeddedDir{
3939
Filename: "",
40-
DirModTime: time.Unix(1591581735, 0),
40+
DirModTime: time.Unix(1592475354, 0),
4141
ChildFiles: []*embedded.EmbeddedFile{
4242
file2, // ".gitkeep"
4343
file3, // "en.po"
@@ -53,7 +53,7 @@ func init() {
5353
// register embeddedBox
5454
embedded.RegisterEmbeddedBox(`./data`, &embedded.EmbeddedBox{
5555
Name: `./data`,
56-
Time: time.Unix(1591581735, 0),
56+
Time: time.Unix(1592475354, 0),
5757
Dirs: map[string]*embedded.EmbeddedDir{
5858
"": dir1,
5959
},

0 commit comments

Comments
 (0)