-
-
Notifications
You must be signed in to change notification settings - Fork 385
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
add new language po file for zh_TW kk_KZ lb_LU #2301
Changes from all commits
0cacb1a
2c19d22
92800d5
0a4319f
3746c58
eff6626
1027e5e
50e25a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -69,7 +69,7 @@ type discoveryMessage struct { | |||||
} | ||||||
|
||||||
func (msg discoveryMessage) String() string { | ||||||
s := fmt.Sprintf("type: %s", msg.EventType) | ||||||
s := fmt.Sprintf(tr("type: %s"), msg.EventType) | ||||||
if msg.Message != "" { | ||||||
s = tr("%[1]s, message: %[2]s", s, msg.Message) | ||||||
} | ||||||
|
@@ -189,7 +189,7 @@ func (disc *PluggableDiscovery) jsonDecodeLoop(in io.Reader, outChan chan<- *dis | |||||
disc.incomingMessagesError = err | ||||||
disc.statusMutex.Unlock() | ||||||
close(outChan) | ||||||
logrus.Errorf("stopped discovery %s decode loop: %v", disc.id, err) | ||||||
logrus.Errorf(tr("stopped discovery %s decode loop: %v"), disc.id, err) | ||||||
} | ||||||
|
||||||
for { | ||||||
|
@@ -206,7 +206,7 @@ func (disc *PluggableDiscovery) jsonDecodeLoop(in io.Reader, outChan chan<- *dis | |||||
closeAndReportError(err) | ||||||
return | ||||||
} | ||||||
logrus.Infof("from discovery %s received message %s", disc.id, msg) | ||||||
logrus.Infof(tr("from discovery %s received message %s"), disc.id, msg) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
As mentioned above, I am opposed to the arbitrary internationalization of log messages. However, since you are interested in assisting in the internationalization effort I will add a note about how we handle this type of string: Indices should be added to This allows the translator to easily insert them at the appropriate location in the sentence structure without being required to understand the Go printf syntax and without being restricted to their relative order in the English language source string. |
||||||
if msg.EventType == "add" { | ||||||
if msg.Port == nil { | ||||||
closeAndReportError(errors.New(tr("invalid 'add' message: missing port"))) | ||||||
|
@@ -253,7 +253,7 @@ func (disc *PluggableDiscovery) waitMessage(timeout time.Duration) (*discoveryMe | |||||
} | ||||||
|
||||||
func (disc *PluggableDiscovery) sendCommand(command string) error { | ||||||
logrus.Infof("sending command %s to discovery %s", strings.TrimSpace(command), disc) | ||||||
logrus.Infof(tr("sending command %s to discovery %s"), strings.TrimSpace(command), disc) | ||||||
data := []byte(command) | ||||||
for { | ||||||
n, err := disc.outgoingCommandsPipe.Write(data) | ||||||
|
@@ -268,7 +268,7 @@ func (disc *PluggableDiscovery) sendCommand(command string) error { | |||||
} | ||||||
|
||||||
func (disc *PluggableDiscovery) runProcess() error { | ||||||
logrus.Infof("starting discovery %s process", disc.id) | ||||||
logrus.Infof(tr("starting discovery %s process"), disc.id) | ||||||
proc, err := executils.NewProcess(nil, disc.processArgs...) | ||||||
if err != nil { | ||||||
return err | ||||||
|
@@ -295,12 +295,12 @@ func (disc *PluggableDiscovery) runProcess() error { | |||||
defer disc.statusMutex.Unlock() | ||||||
disc.process = proc | ||||||
disc.state = Alive | ||||||
logrus.Infof("started discovery %s process", disc.id) | ||||||
logrus.Infof(tr("started discovery %s process"), disc.id) | ||||||
return nil | ||||||
} | ||||||
|
||||||
func (disc *PluggableDiscovery) killProcess() error { | ||||||
logrus.Infof("killing discovery %s process", disc.id) | ||||||
logrus.Infof(tr("killing discovery %s process"), disc.id) | ||||||
if disc.process != nil { | ||||||
if err := disc.process.Kill(); err != nil { | ||||||
return err | ||||||
|
@@ -313,7 +313,7 @@ func (disc *PluggableDiscovery) killProcess() error { | |||||
defer disc.statusMutex.Unlock() | ||||||
disc.stopSync() | ||||||
disc.state = Dead | ||||||
logrus.Infof("killed discovery %s process", disc.id) | ||||||
logrus.Infof(tr("killed discovery %s process"), disc.id) | ||||||
return nil | ||||||
} | ||||||
|
||||||
|
@@ -335,7 +335,7 @@ func (disc *PluggableDiscovery) Run() (err error) { | |||||
if err := disc.killProcess(); err != nil { | ||||||
// Log failure to kill the process, ideally that should never happen | ||||||
// but it's best to know it if it does | ||||||
logrus.Errorf("Killing discovery %s after unsuccessful start: %s", disc.id, err) | ||||||
logrus.Errorf(tr("Killing discovery %s after unsuccessful start: %s"), disc.id, err) | ||||||
} | ||||||
}() | ||||||
|
||||||
|
@@ -415,7 +415,7 @@ func (disc *PluggableDiscovery) stopSync() { | |||||
func (disc *PluggableDiscovery) Quit() { | ||||||
_ = disc.sendCommand("QUIT\n") | ||||||
if _, err := disc.waitMessage(time.Second * 5); err != nil { | ||||||
logrus.Errorf("Quitting discovery %s: %s", disc.id, err) | ||||||
logrus.Errorf(tr("Quitting discovery %s: %s"), disc.id, err) | ||||||
} | ||||||
disc.stopSync() | ||||||
disc.killProcess() | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -69,15 +69,15 @@ type PortParameterDescriptor struct { | |||||
} | ||||||
|
||||||
func (msg monitorMessage) String() string { | ||||||
s := fmt.Sprintf("type: %s", msg.EventType) | ||||||
s := fmt.Sprintf(tr("type: %s"), msg.EventType) | ||||||
if msg.Message != "" { | ||||||
s = fmt.Sprintf("%[1]s, message: %[2]s", s, msg.Message) | ||||||
s = fmt.Sprintf(tr("%[1]s, message: %[2]s"), s, msg.Message) | ||||||
} | ||||||
if msg.ProtocolVersion != 0 { | ||||||
s = fmt.Sprintf("%[1]s, protocol version: %[2]d", s, msg.ProtocolVersion) | ||||||
s = fmt.Sprintf(tr("%[1]s, protocol version: %[2]d"), s, msg.ProtocolVersion) | ||||||
} | ||||||
if msg.PortDescription != nil { | ||||||
s = fmt.Sprintf("%s, port descriptor: protocol %s, %d parameters", | ||||||
s = fmt.Sprintf(tr("%s, port descriptor: protocol %s, %d parameters"), | ||||||
s, msg.PortDescription.Protocol, len(msg.PortDescription.ConfigurationParameters)) | ||||||
} | ||||||
return s | ||||||
|
@@ -253,7 +253,7 @@ func (mon *PluggableMonitor) Describe() (*PortDescriptor, error) { | |||||
|
||||||
// Configure sets a port configuration parameter. | ||||||
func (mon *PluggableMonitor) Configure(param, value string) error { | ||||||
if err := mon.sendCommand(fmt.Sprintf("CONFIGURE %s %s\n", param, value)); err != nil { | ||||||
if err := mon.sendCommand(fmt.Sprintf(tr("CONFIGURE %s %s\n"), param, value)); err != nil { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This is code, not prose, so it must not be localized: https://arduino.github.io/arduino-cli/dev/pluggable-monitor-specification/#configure-command The |
||||||
return err | ||||||
} | ||||||
_, err := mon.waitMessage(time.Second*10, "configure") | ||||||
|
@@ -273,7 +273,7 @@ func (mon *PluggableMonitor) Open(portAddress, portProtocol string) (io.ReadWrit | |||||
defer tcpListener.Close() | ||||||
tcpListenerPort := tcpListener.Addr().(*net.TCPAddr).Port | ||||||
|
||||||
if err := mon.sendCommand(fmt.Sprintf("OPEN 127.0.0.1:%d %s\n", tcpListenerPort, portAddress)); err != nil { | ||||||
if err := mon.sendCommand(fmt.Sprintf(tr("OPEN 127.0.0.1:%d %s\n"), tcpListenerPort, portAddress)); err != nil { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
return nil, err | ||||||
} | ||||||
if _, err := mon.waitMessage(time.Second*10, "open"); err != nil { | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,11 @@ import ( | |
|
||
"github.com/arduino/go-paths-helper" | ||
"github.com/spf13/cobra" | ||
"github.com/arduino/arduino-cli/i18n" | ||
) | ||
|
||
var tr = i18n.Tr | ||
|
||
var pullTransifexCommand = &cobra.Command{ | ||
Use: "pull [catalog folder]", | ||
Short: "pulls the translation files from transifex", | ||
|
@@ -223,7 +226,7 @@ func getDownloadURL(languageCode, downloadID string) string { | |
case "pending": | ||
fallthrough | ||
case "processing": | ||
fmt.Printf("Current status for language %s: %s\n", languageCode, status) | ||
fmt.Printf(tr("Current status for language %s: %s\n"), languageCode, status) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it makes sense to internationalize this internal utility package. Doing so would increase the workload for the community translators without any significant benefit for the project users in return. Credentials in the Transifex project are required to run this, which only a few select administrators would have. This is intended to be ran automatically by the continuous distribution system, so the logs are only ever viewed in the case of the need to troubleshoot a failure. In that rare eventuality, if the person doing the troubleshooting didn't have English language fluency, they could use an automatic translation service (e.g., Google Translate) on the messages. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree, these messages will never reach any |
||
time.Sleep(backoff) | ||
backoff = backoff * 2 | ||
// Request the status again | ||
|
@@ -234,14 +237,14 @@ func getDownloadURL(languageCode, downloadID string) string { | |
} | ||
os.Exit(1) | ||
} | ||
fmt.Printf("Status request for language %s failed in an unforeseen way\n", languageCode) | ||
fmt.Printf(tr("Status request for language %s failed in an unforeseen way\n"), languageCode) | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
// download file from url and saves it in folder with the specified fileName | ||
func download(folder, fileName, url string) { | ||
fmt.Printf("Starting download of %s\n", fileName) | ||
fmt.Printf(tr("Starting download of %s\n"), fileName) | ||
filePath := paths.New(folder, fileName) | ||
|
||
res, err := http.DefaultClient.Get(url) | ||
|
@@ -257,12 +260,12 @@ func download(folder, fileName, url string) { | |
} | ||
|
||
filePath.WriteFile(data) | ||
fmt.Printf("Finished download of %s\n", fileName) | ||
fmt.Printf(tr("Finished download of %s\n"), fileName) | ||
} | ||
|
||
func pullCatalog(cmd *cobra.Command, args []string) { | ||
languages := getLanguages() | ||
fmt.Println("translations found:", languages) | ||
fmt.Println(tr("translations found:"), languages) | ||
|
||
folder := args[0] | ||
|
||
|
@@ -277,5 +280,5 @@ func pullCatalog(cmd *cobra.Command, args []string) { | |
}(lang) | ||
} | ||
wg.Wait() | ||
fmt.Println("Translation files downloaded") | ||
fmt.Println(tr("Translation files downloaded")) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During the initial internationalization effort, we decided that the log messages would be excluded from the internationalization scope for now. The reason is that the addition of these strings would significantly increase the workload on the community translators, while generally being of less visibility and/or importance to the users.
Even though on an individual basis there are surely specific log messages of higher importance than specific non-log strings that were internationalized, the log/non-log dichotomy provided an objective criterion for determining which strings were in scope for the initial effort.
We considered eventually expanding the i18n coverage at some time in the future after there has been good progress on the initial translation effort. However, from looking at the translation coverage on the Transifex project home page:
https://explore.transifex.com/arduino-1/arduino-cli/
it seems to me that the translation coverage is not very good overall so I don't think it is a good idea to increase the translator workload by internationalization of log messages unless there are specific cases where a message is highly visible to a significant number of users for some reason.