Skip to content

Added translations strings to 'board details' command #752

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 30 additions & 29 deletions cli/board/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,35 @@ import (
"github.com/arduino/arduino-cli/cli/feedback"
"github.com/arduino/arduino-cli/cli/instance"
"github.com/arduino/arduino-cli/commands/board"
"github.com/arduino/arduino-cli/i18n"
rpc "github.com/arduino/arduino-cli/rpc/commands"
"github.com/arduino/arduino-cli/table"
"github.com/fatih/color"
"github.com/spf13/cobra"
)

var tr = i18n.Tr
var showFullDetails bool

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

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

return detailsCommand
}

func runDetailsCommand(cmd *cobra.Command, args []string) {
inst, err := instance.CreateInstance()
if err != nil {
feedback.Errorf("Error getting board details: %v", err)
feedback.Errorf(tr("Error getting board details: %v"), err)
os.Exit(errorcodes.ErrGeneric)
}

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

if err != nil {
feedback.Errorf("Error getting board details: %v", err)
feedback.Errorf(tr("Error getting board details: %v"), err)
os.Exit(errorcodes.ErrGeneric)
}

Expand Down Expand Up @@ -93,51 +95,50 @@ func (dr detailsResult) String() string {
// ATmega168 cpu=atmega168
t := table.New()
t.SetColumnWidthMode(1, table.Average)
t.AddRow("Board name:", details.Name)
t.AddRow("Board fqbn:", details.Fqbn)
t.AddRow("Board propertiesId:", details.PropertiesId)
t.AddRow("Board version:", details.Version)
t.AddRow(tr("Board name:"), details.Name)
t.AddRow("FQBN:", details.Fqbn)
t.AddRow(tr("Board version:"), details.Version)

if details.Official {
t.AddRow() // get some space from above
t.AddRow("Official Arduino board:",
t.AddRow(tr("Official Arduino board:"),
table.NewCell("✔", color.New(color.FgGreen)))
}

for i, idp := range details.IdentificationPref {
if i == 0 {
t.AddRow() // get some space from above
t.AddRow("Identification Preferences:", "VID:"+idp.UsbID.VID+" PID:"+idp.UsbID.PID)
t.AddRow(tr("Identification properties:"), "VID:"+idp.UsbID.VID+" PID:"+idp.UsbID.PID)
continue
}
t.AddRow("", "VID:"+idp.UsbID.VID+" PID:"+idp.UsbID.PID)
}

t.AddRow() // get some space from above
t.AddRow("Package name:", details.Package.Name)
t.AddRow("Package maintainer:", details.Package.Maintainer)
t.AddRow("Package URL:", details.Package.Url)
t.AddRow("Package websiteURL:", details.Package.WebsiteURL)
t.AddRow("Package online help:", details.Package.Help.Online)
t.AddRow(tr("Package name:"), details.Package.Name)
t.AddRow(tr("Package maintainer:"), details.Package.Maintainer)
t.AddRow(tr("Package URL:"), details.Package.Url)
t.AddRow(tr("Package website:"), details.Package.WebsiteURL)
t.AddRow(tr("Package online help:"), details.Package.Help.Online)

t.AddRow() // get some space from above
t.AddRow("Platform name:", details.Platform.Name)
t.AddRow("Platform category:", details.Platform.Category)
t.AddRow("Platform architecture:", details.Platform.Architecture)
t.AddRow("Platform URL:", details.Platform.Url)
t.AddRow("Platform file name:", details.Platform.ArchiveFileName)
t.AddRow("Platform size (bytes):", fmt.Sprint(details.Platform.Size))
t.AddRow("Platform checksum:", details.Platform.Checksum)
t.AddRow(tr("Platform name:"), details.Platform.Name)
t.AddRow(tr("Platform category:"), details.Platform.Category)
t.AddRow(tr("Platform architecture:"), details.Platform.Architecture)
t.AddRow(tr("Platform URL:"), details.Platform.Url)
t.AddRow(tr("Platform file name:"), details.Platform.ArchiveFileName)
t.AddRow(tr("Platform size (bytes):"), fmt.Sprint(details.Platform.Size))
t.AddRow(tr("Platform checksum:"), details.Platform.Checksum)

t.AddRow() // get some space from above
for _, tool := range details.ToolsDependencies {
t.AddRow("Required tools:", tool.Packager+":"+tool.Name, "", tool.Version)
t.AddRow(tr("Required tool:"), tool.Packager+":"+tool.Name, "", tool.Version)
if showFullDetails {
for _, sys := range tool.Systems {
t.AddRow("", "OS:", "", sys.Host)
t.AddRow("", "File:", "", sys.ArchiveFileName)
t.AddRow("", "Size (bytes):", "", fmt.Sprint(sys.Size))
t.AddRow("", "Checksum:", "", sys.Checksum)
t.AddRow("", tr("OS:"), "", sys.Host)
t.AddRow("", tr("File:"), "", sys.ArchiveFileName)
t.AddRow("", tr("Size (bytes):"), "", fmt.Sprint(sys.Size))
t.AddRow("", tr("Checksum:"), "", sys.Checksum)
t.AddRow("", "URL:", "", sys.Url)
t.AddRow() // get some space from above
}
Expand All @@ -146,7 +147,7 @@ func (dr detailsResult) String() string {
}

for _, option := range details.ConfigOptions {
t.AddRow("Option:", option.OptionLabel, "", option.Option)
t.AddRow(tr("Option:"), option.OptionLabel, "", option.Option)
for _, value := range option.Values {
green := color.New(color.FgGreen)
if value.Selected {
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -283,6 +284,7 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
Expand Down
105 changes: 105 additions & 0 deletions i18n/data/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,31 @@ msgstr "Aliases:"
msgid "Available Commands:"
msgstr "Available Commands:"

#: cli/board/details.go:98
msgid "Board name:"
msgstr "Board name:"

#: cli/board/details.go:100
msgid "Board version:"
msgstr "Board version:"

#: cli/board/details.go:141
msgid "Checksum:"
msgstr "Checksum:"

#: cli/board/details.go:55
#: cli/board/details.go:65
msgid "Error getting board details: %v"
msgstr "Error getting board details: %v"

#: cli/usage.go:27
msgid "Examples:"
msgstr "Examples:"

#: cli/board/details.go:139
msgid "File:"
msgstr "File:"

#: cli/usage.go:29
msgid "Flags:"
msgstr "Flags:"
Expand All @@ -25,6 +46,90 @@ msgstr "Flags:"
msgid "Global Flags:"
msgstr "Global Flags:"

#: cli/board/details.go:111
msgid "Identification properties:"
msgstr "Identification properties:"

#: cli/board/details.go:138
msgid "OS:"
msgstr "OS:"

#: cli/board/details.go:104
msgid "Official Arduino board:"
msgstr "Official Arduino board:"

#: cli/board/details.go:150
msgid "Option:"
msgstr "Option:"

#: cli/board/details.go:120
msgid "Package URL:"
msgstr "Package URL:"

#: cli/board/details.go:119
msgid "Package maintainer:"
msgstr "Package maintainer:"

#: cli/board/details.go:118
msgid "Package name:"
msgstr "Package name:"

#: cli/board/details.go:122
msgid "Package online help:"
msgstr "Package online help:"

#: cli/board/details.go:121
msgid "Package website:"
msgstr "Package website:"

#: cli/board/details.go:128
msgid "Platform URL:"
msgstr "Platform URL:"

#: cli/board/details.go:127
msgid "Platform architecture:"
msgstr "Platform architecture:"

#: cli/board/details.go:126
msgid "Platform category:"
msgstr "Platform category:"

#: cli/board/details.go:131
msgid "Platform checksum:"
msgstr "Platform checksum:"

#: cli/board/details.go:129
msgid "Platform file name:"
msgstr "Platform file name:"

#: cli/board/details.go:125
msgid "Platform name:"
msgstr "Platform name:"

#: cli/board/details.go:130
msgid "Platform size (bytes):"
msgstr "Platform size (bytes):"

#: cli/board/details.go:40
msgid "Print details about a board."
msgstr "Print details about a board."

#: cli/board/details.go:135
msgid "Required tool:"
msgstr "Required tool:"

#: cli/board/details.go:47
msgid "Show full board details"
msgstr "Show full board details"

#: cli/board/details.go:41
msgid "Show information about a board, in particular if the board has options to be specified in the FQBN."
msgstr "Show information about a board, in particular if the board has options to be specified in the FQBN."

#: cli/board/details.go:140
msgid "Size (bytes):"
msgstr "Size (bytes):"

#: cli/usage.go:25
msgid "Usage:"
msgstr "Usage:"
Expand Down
14 changes: 7 additions & 7 deletions i18n/rice-box.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,33 @@ func init() {
// define files
file2 := &embedded.EmbeddedFile{
Filename: ".gitkeep",
FileModTime: time.Unix(1591581706, 0),
FileModTime: time.Unix(1591978108, 0),

Content: string(""),
}
file3 := &embedded.EmbeddedFile{
Filename: "en.po",
FileModTime: time.Unix(1591581706, 0),
FileModTime: time.Unix(1592476091, 0),

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"),
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:100\nmsgid \"Board version:\"\nmsgstr \"Board version:\"\n\n#: cli/board/details.go:141\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:139\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:111\nmsgid \"Identification properties:\"\nmsgstr \"Identification properties:\"\n\n#: cli/board/details.go:138\nmsgid \"OS:\"\nmsgstr \"OS:\"\n\n#: cli/board/details.go:104\nmsgid \"Official Arduino board:\"\nmsgstr \"Official Arduino board:\"\n\n#: cli/board/details.go:150\nmsgid \"Option:\"\nmsgstr \"Option:\"\n\n#: cli/board/details.go:120\nmsgid \"Package URL:\"\nmsgstr \"Package URL:\"\n\n#: cli/board/details.go:119\nmsgid \"Package maintainer:\"\nmsgstr \"Package maintainer:\"\n\n#: cli/board/details.go:118\nmsgid \"Package name:\"\nmsgstr \"Package name:\"\n\n#: cli/board/details.go:122\nmsgid \"Package online help:\"\nmsgstr \"Package online help:\"\n\n#: cli/board/details.go:121\nmsgid \"Package website:\"\nmsgstr \"Package website:\"\n\n#: cli/board/details.go:128\nmsgid \"Platform URL:\"\nmsgstr \"Platform URL:\"\n\n#: cli/board/details.go:127\nmsgid \"Platform architecture:\"\nmsgstr \"Platform architecture:\"\n\n#: cli/board/details.go:126\nmsgid \"Platform category:\"\nmsgstr \"Platform category:\"\n\n#: cli/board/details.go:131\nmsgid \"Platform checksum:\"\nmsgstr \"Platform checksum:\"\n\n#: cli/board/details.go:129\nmsgid \"Platform file name:\"\nmsgstr \"Platform file name:\"\n\n#: cli/board/details.go:125\nmsgid \"Platform name:\"\nmsgstr \"Platform name:\"\n\n#: cli/board/details.go:130\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:135\nmsgid \"Required tool:\"\nmsgstr \"Required tool:\"\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:140\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"),
}
file4 := &embedded.EmbeddedFile{
Filename: "it_IT.po",
FileModTime: time.Unix(1591581735, 0),
FileModTime: time.Unix(1591978150, 0),

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"),
}
file5 := &embedded.EmbeddedFile{
Filename: "pt_BR.po",
FileModTime: time.Unix(1591581735, 0),
FileModTime: time.Unix(1591978150, 0),

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"),
}

// define dirs
dir1 := &embedded.EmbeddedDir{
Filename: "",
DirModTime: time.Unix(1591581735, 0),
DirModTime: time.Unix(1592476041, 0),
ChildFiles: []*embedded.EmbeddedFile{
file2, // ".gitkeep"
file3, // "en.po"
Expand All @@ -53,7 +53,7 @@ func init() {
// register embeddedBox
embedded.RegisterEmbeddedBox(`./data`, &embedded.EmbeddedBox{
Name: `./data`,
Time: time.Unix(1591581735, 0),
Time: time.Unix(1592476041, 0),
Dirs: map[string]*embedded.EmbeddedDir{
"": dir1,
},
Expand Down