Skip to content

Commit eff6626

Browse files
committed
more i18n messages add
1 parent 3746c58 commit eff6626

File tree

7 files changed

+33
-33
lines changed

7 files changed

+33
-33
lines changed

arduino/builder/detector/detector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ type includeCacheEntry struct {
669669

670670
// String fixdoc
671671
func (entry *includeCacheEntry) String() string {
672-
return fmt.Sprintf("SourceFile: %s; Include: %s; IncludePath: %s",
672+
return fmt.Sprintf(tr("SourceFile: %s; Include: %s; IncludePath: %s"),
673673
entry.Sourcefile, entry.Include, entry.Includepath)
674674
}
675675

arduino/discovery/discovery.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ type discoveryMessage struct {
6969
}
7070

7171
func (msg discoveryMessage) String() string {
72-
s := fmt.Sprintf("type: %s", msg.EventType)
72+
s := fmt.Sprintf(tr("type: %s"), msg.EventType)
7373
if msg.Message != "" {
7474
s = tr("%[1]s, message: %[2]s", s, msg.Message)
7575
}
@@ -189,7 +189,7 @@ func (disc *PluggableDiscovery) jsonDecodeLoop(in io.Reader, outChan chan<- *dis
189189
disc.incomingMessagesError = err
190190
disc.statusMutex.Unlock()
191191
close(outChan)
192-
logrus.Errorf("stopped discovery %s decode loop: %v", disc.id, err)
192+
logrus.Errorf(tr("stopped discovery %s decode loop: %v"), disc.id, err)
193193
}
194194

195195
for {
@@ -206,7 +206,7 @@ func (disc *PluggableDiscovery) jsonDecodeLoop(in io.Reader, outChan chan<- *dis
206206
closeAndReportError(err)
207207
return
208208
}
209-
logrus.Infof("from discovery %s received message %s", disc.id, msg)
209+
logrus.Infof(tr("from discovery %s received message %s"), disc.id, msg)
210210
if msg.EventType == "add" {
211211
if msg.Port == nil {
212212
closeAndReportError(errors.New(tr("invalid 'add' message: missing port")))
@@ -253,7 +253,7 @@ func (disc *PluggableDiscovery) waitMessage(timeout time.Duration) (*discoveryMe
253253
}
254254

255255
func (disc *PluggableDiscovery) sendCommand(command string) error {
256-
logrus.Infof("sending command %s to discovery %s", strings.TrimSpace(command), disc)
256+
logrus.Infof(tr("sending command %s to discovery %s"), strings.TrimSpace(command), disc)
257257
data := []byte(command)
258258
for {
259259
n, err := disc.outgoingCommandsPipe.Write(data)
@@ -268,7 +268,7 @@ func (disc *PluggableDiscovery) sendCommand(command string) error {
268268
}
269269

270270
func (disc *PluggableDiscovery) runProcess() error {
271-
logrus.Infof("starting discovery %s process", disc.id)
271+
logrus.Infof(tr("starting discovery %s process"), disc.id)
272272
proc, err := executils.NewProcess(nil, disc.processArgs...)
273273
if err != nil {
274274
return err
@@ -295,12 +295,12 @@ func (disc *PluggableDiscovery) runProcess() error {
295295
defer disc.statusMutex.Unlock()
296296
disc.process = proc
297297
disc.state = Alive
298-
logrus.Infof("started discovery %s process", disc.id)
298+
logrus.Infof(tr("started discovery %s process"), disc.id)
299299
return nil
300300
}
301301

302302
func (disc *PluggableDiscovery) killProcess() error {
303-
logrus.Infof("killing discovery %s process", disc.id)
303+
logrus.Infof(tr("killing discovery %s process"), disc.id)
304304
if disc.process != nil {
305305
if err := disc.process.Kill(); err != nil {
306306
return err
@@ -313,7 +313,7 @@ func (disc *PluggableDiscovery) killProcess() error {
313313
defer disc.statusMutex.Unlock()
314314
disc.stopSync()
315315
disc.state = Dead
316-
logrus.Infof("killed discovery %s process", disc.id)
316+
logrus.Infof(tr("killed discovery %s process"), disc.id)
317317
return nil
318318
}
319319

@@ -335,7 +335,7 @@ func (disc *PluggableDiscovery) Run() (err error) {
335335
if err := disc.killProcess(); err != nil {
336336
// Log failure to kill the process, ideally that should never happen
337337
// but it's best to know it if it does
338-
logrus.Errorf("Killing discovery %s after unsuccessful start: %s", disc.id, err)
338+
logrus.Errorf(tr("Killing discovery %s after unsuccessful start: %s"), disc.id, err)
339339
}
340340
}()
341341

@@ -415,7 +415,7 @@ func (disc *PluggableDiscovery) stopSync() {
415415
func (disc *PluggableDiscovery) Quit() {
416416
_ = disc.sendCommand("QUIT\n")
417417
if _, err := disc.waitMessage(time.Second * 5); err != nil {
418-
logrus.Errorf("Quitting discovery %s: %s", disc.id, err)
418+
logrus.Errorf(tr("Quitting discovery %s: %s"), disc.id, err)
419419
}
420420
disc.stopSync()
421421
disc.killProcess()

arduino/libraries/librariesresolver/cpp.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,20 @@ func (resolver *Cpp) AlternativesFor(header string) libraries.List {
119119
// ResolveFor finds the most suitable library for the specified combination of
120120
// header and architecture. If no libraries provides the requested header, nil is returned
121121
func (resolver *Cpp) ResolveFor(header, architecture string) *libraries.Library {
122-
logrus.Infof("Resolving include %s for arch %s", header, architecture)
122+
logrus.Infof(tr("Resolving include %s for arch %s"), header, architecture)
123123
var found libraries.List
124124
var foundPriority int
125125
for _, lib := range resolver.headers[header] {
126126
libPriority := ComputePriority(lib, header, architecture)
127-
msg := " discarded"
127+
msg := tr(" discarded")
128128
if found == nil || foundPriority < libPriority {
129129
found = libraries.List{}
130130
found.Add(lib)
131131
foundPriority = libPriority
132-
msg = " found better lib"
132+
msg = tr(" found better lib")
133133
} else if foundPriority == libPriority {
134134
found.Add(lib)
135-
msg = " found another lib with same priority"
135+
msg = tr(" found another lib with same priority")
136136
}
137137
logrus.
138138
WithField("lib", lib.Name).
@@ -149,12 +149,12 @@ func (resolver *Cpp) ResolveFor(header, architecture string) *libraries.Library
149149
// If more than one library qualifies use the "closestmatch" algorithm to
150150
// find the best matching one (instead of choosing it randomly)
151151
if best := findLibraryWithNameBestDistance(header, found); best != nil {
152-
logrus.WithField("lib", best.Name).Info(" library with the best matching name")
152+
logrus.WithField("lib", best.Name).Info(tr(" library with the best matching name"))
153153
return best
154154
}
155155

156156
found.SortByName()
157-
logrus.WithField("lib", found[0].Name).Info(" first library in alphabetic order")
157+
logrus.WithField("lib", found[0].Name).Info(tr(" first library in alphabetic order"))
158158
return found[0]
159159
}
160160

@@ -217,7 +217,7 @@ func ComputePriority(lib *libraries.Library, header, arch string) int {
217217
// Bonus for libraries specified via --libraries flags, those libraries gets the highest priority
218218
priority += 10000
219219
default:
220-
panic(fmt.Sprintf("Invalid library location: %d", lib.Location))
220+
panic(fmt.Sprintf(tr("Invalid library location: %d"), lib.Location))
221221
}
222222
return priority
223223
}

arduino/monitor/monitor.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ type PortParameterDescriptor struct {
6969
}
7070

7171
func (msg monitorMessage) String() string {
72-
s := fmt.Sprintf("type: %s", msg.EventType)
72+
s := fmt.Sprintf(tr("type: %s"), msg.EventType)
7373
if msg.Message != "" {
74-
s = fmt.Sprintf("%[1]s, message: %[2]s", s, msg.Message)
74+
s = fmt.Sprintf(tr("%[1]s, message: %[2]s"), s, msg.Message)
7575
}
7676
if msg.ProtocolVersion != 0 {
77-
s = fmt.Sprintf("%[1]s, protocol version: %[2]d", s, msg.ProtocolVersion)
77+
s = fmt.Sprintf(tr("%[1]s, protocol version: %[2]d"), s, msg.ProtocolVersion)
7878
}
7979
if msg.PortDescription != nil {
80-
s = fmt.Sprintf("%s, port descriptor: protocol %s, %d parameters",
80+
s = fmt.Sprintf(tr("%s, port descriptor: protocol %s, %d parameters"),
8181
s, msg.PortDescription.Protocol, len(msg.PortDescription.ConfigurationParameters))
8282
}
8383
return s
@@ -253,7 +253,7 @@ func (mon *PluggableMonitor) Describe() (*PortDescriptor, error) {
253253

254254
// Configure sets a port configuration parameter.
255255
func (mon *PluggableMonitor) Configure(param, value string) error {
256-
if err := mon.sendCommand(fmt.Sprintf("CONFIGURE %s %s\n", param, value)); err != nil {
256+
if err := mon.sendCommand(fmt.Sprintf(tr("CONFIGURE %s %s\n"), param, value)); err != nil {
257257
return err
258258
}
259259
_, err := mon.waitMessage(time.Second*10, "configure")
@@ -273,7 +273,7 @@ func (mon *PluggableMonitor) Open(portAddress, portProtocol string) (io.ReadWrit
273273
defer tcpListener.Close()
274274
tcpListenerPort := tcpListener.Addr().(*net.TCPAddr).Port
275275

276-
if err := mon.sendCommand(fmt.Sprintf("OPEN 127.0.0.1:%d %s\n", tcpListenerPort, portAddress)); err != nil {
276+
if err := mon.sendCommand(fmt.Sprintf(tr("OPEN 127.0.0.1:%d %s\n"), tcpListenerPort, portAddress)); err != nil {
277277
return nil, err
278278
}
279279
if _, err := mon.waitMessage(time.Second*10, "open"); err != nil {

i18n/cmd/commands/transifex/pull_transifex.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func getDownloadURL(languageCode, downloadID string) string {
223223
case "pending":
224224
fallthrough
225225
case "processing":
226-
fmt.Printf("Current status for language %s: %s\n", languageCode, status)
226+
fmt.Printf(tr("Current status for language %s: %s\n"), languageCode, status)
227227
time.Sleep(backoff)
228228
backoff = backoff * 2
229229
// Request the status again
@@ -234,14 +234,14 @@ func getDownloadURL(languageCode, downloadID string) string {
234234
}
235235
os.Exit(1)
236236
}
237-
fmt.Printf("Status request for language %s failed in an unforeseen way\n", languageCode)
237+
fmt.Printf(tr("Status request for language %s failed in an unforeseen way\n"), languageCode)
238238
os.Exit(1)
239239
}
240240
}
241241

242242
// download file from url and saves it in folder with the specified fileName
243243
func download(folder, fileName, url string) {
244-
fmt.Printf("Starting download of %s\n", fileName)
244+
fmt.Printf(tr("Starting download of %s\n"), fileName)
245245
filePath := paths.New(folder, fileName)
246246

247247
res, err := http.DefaultClient.Get(url)
@@ -257,12 +257,12 @@ func download(folder, fileName, url string) {
257257
}
258258

259259
filePath.WriteFile(data)
260-
fmt.Printf("Finished download of %s\n", fileName)
260+
fmt.Printf(tr("Finished download of %s\n"), fileName)
261261
}
262262

263263
func pullCatalog(cmd *cobra.Command, args []string) {
264264
languages := getLanguages()
265-
fmt.Println("translations found:", languages)
265+
fmt.Println(tr("translations found:"), languages)
266266

267267
folder := args[0]
268268

@@ -277,5 +277,5 @@ func pullCatalog(cmd *cobra.Command, args []string) {
277277
}(lang)
278278
}
279279
wg.Wait()
280-
fmt.Println("Translation files downloaded")
280+
fmt.Println(tr("Translation files downloaded"))
281281
}

internal/cli/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func createCliCommandTree(cmd *cobra.Command) {
124124
})
125125
cmd.PersistentFlags().StringVar(&configFile, "config-file", "", tr("The custom config file (if not specified the default will be used)."))
126126
cmd.PersistentFlags().StringSlice("additional-urls", []string{}, tr("Comma-separated list of additional URLs for the Boards Manager."))
127-
cmd.PersistentFlags().Bool("no-color", false, "Disable colored output.")
127+
cmd.PersistentFlags().Bool("no-color", false, tr("Disable colored output."))
128128
configuration.BindFlags(cmd, configuration.Settings)
129129
}
130130

legacy/builder/recipe_runner.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func RecipeByPrefixSuffixRunner(
3333
buildProps *properties.Map,
3434
builderLogger *logger.BuilderLogger,
3535
) error {
36-
logrus.Debugf(fmt.Sprintf("Looking for recipes like %s", prefix+"*"+suffix))
36+
logrus.Debugf(fmt.Sprintf(tr("Looking for recipes like %s"), prefix+"*"+suffix))
3737

3838
// TODO is it necessary to use Clone?
3939
buildProperties := buildProps.Clone()
@@ -42,7 +42,7 @@ func RecipeByPrefixSuffixRunner(
4242
// TODO is it necessary to use Clone?
4343
properties := buildProperties.Clone()
4444
for _, recipe := range recipes {
45-
logrus.Debugf(fmt.Sprintf("Running recipe: %s", recipe))
45+
logrus.Debugf(fmt.Sprintf(tr("Running recipe: %s"), recipe))
4646

4747
command, err := utils.PrepareCommandForRecipe(properties, recipe, false)
4848
if err != nil {

0 commit comments

Comments
 (0)