Translate remaining Go source and overlay.html comments to English
Identifiers, comments, and log/console messages in auth.go, i18n.go, counter.go, totals.go, and overlay.html's script/CSS comments — the files the TLS commit didn't already touch. No functional changes. locales/*.json and overlay.html's own FALLBACK/data-i18n strings stay bilingual on purpose: that's end-user text for the overlay/panel, a different audience than the source code, served by the existing i18n system rather than this convention.
This commit is contained in:
1 parent
e9fe10f0f7
commit
5a2c3272e9
7 files changed
+213
-211
No files matched your search
@@ -1,15 +1,15 @@
|
||||
//go:build windows
|
||||
|
||||
// i18n.go: idiomas de la interfaz.
|
||||
// i18n.go: interface languages.
|
||||
//
|
||||
// Las traducciones viven en locales/*.json y se embeben en el ejecutable.
|
||||
// La razon de elegir archivos sueltos en vez de un mapa en el codigo es
|
||||
// que agregar un idioma sea "copiar en.json, traducirlo, y listo": quien
|
||||
// traduce no necesita saber Go ni tocar una linea de codigo.
|
||||
// Translations live in locales/*.json and get embedded into the binary.
|
||||
// The reason for separate files instead of a map in the code is so
|
||||
// adding a language is "copy en.json, translate it, done": whoever
|
||||
// translates doesn't need to know Go or touch a line of code.
|
||||
//
|
||||
// Los mensajes de la consola NO pasan por aca a proposito: son
|
||||
// diagnostico, y conviene que esten siempre en el mismo idioma para que
|
||||
// un log pegado en un issue se pueda leer sin importar de donde venga.
|
||||
// Console messages deliberately do NOT go through here: they're
|
||||
// diagnostics, and it helps if they're always in the same language so a
|
||||
// log pasted into an issue reads the same no matter where it came from.
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -33,7 +33,7 @@ var locales = map[string]map[string]string{}
|
||||
func loadLocales() {
|
||||
entries, err := localeFS.ReadDir("locales")
|
||||
if err != nil {
|
||||
log.Printf("no pude leer los idiomas embebidos: %v", err)
|
||||
log.Printf("couldn't read the embedded languages: %v", err)
|
||||
return
|
||||
}
|
||||
for _, e := range entries {
|
||||
@@ -43,12 +43,12 @@ func loadLocales() {
|
||||
}
|
||||
data, err := localeFS.ReadFile(path.Join("locales", name))
|
||||
if err != nil {
|
||||
log.Printf("no pude leer locales/%s: %v", name, err)
|
||||
log.Printf("couldn't read locales/%s: %v", name, err)
|
||||
continue
|
||||
}
|
||||
var m map[string]string
|
||||
if err := json.Unmarshal(data, &m); err != nil {
|
||||
log.Printf("locales/%s tiene JSON invalido: %v", name, err)
|
||||
log.Printf("locales/%s has invalid JSON: %v", name, err)
|
||||
continue
|
||||
}
|
||||
locales[strings.TrimSuffix(name, ".json")] = m
|
||||
@@ -66,7 +66,7 @@ func availableLangs() []string {
|
||||
|
||||
var procGetUserDefaultLocaleName = kernel32.NewProc("GetUserDefaultLocaleName")
|
||||
|
||||
// systemLang devuelve el idioma de Windows ("es-AR" -> "es").
|
||||
// systemLang returns Windows's language ("es-AR" -> "es").
|
||||
func systemLang() string {
|
||||
buf := make([]uint16, 85) // LOCALE_NAME_MAX_LENGTH
|
||||
r, _, _ := procGetUserDefaultLocaleName.Call(uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
||||
@@ -80,8 +80,8 @@ func systemLang() string {
|
||||
return strings.ToLower(name)
|
||||
}
|
||||
|
||||
// resolveLang decide el idioma final. "auto" (o vacio) usa el de
|
||||
// Windows; si ese idioma no esta traducido, cae a ingles.
|
||||
// resolveLang decides the final language. "auto" (or empty) uses
|
||||
// Windows's; if that language isn't translated, it falls back to English.
|
||||
func resolveLang(want string) string {
|
||||
want = strings.ToLower(strings.TrimSpace(want))
|
||||
if want == "" || want == "auto" {
|
||||
@@ -93,7 +93,7 @@ func resolveLang(want string) string {
|
||||
if _, ok := locales[want]; ok {
|
||||
return want
|
||||
}
|
||||
// "es-AR" o "es_AR" igual tienen que encontrar "es".
|
||||
// "es-AR" or "es_AR" should still resolve to "es".
|
||||
if base, _, ok := strings.Cut(strings.NewReplacer("_", "-").Replace(want), "-"); ok {
|
||||
if _, ok := locales[base]; ok {
|
||||
return base
|
||||
@@ -102,9 +102,9 @@ func resolveLang(want string) string {
|
||||
return fallbackLang
|
||||
}
|
||||
|
||||
// stringsFor devuelve el diccionario del idioma pedido, completado con
|
||||
// el ingles: si una traduccion quedo a medias, se ve la clave que falta
|
||||
// en ingles y no la clave cruda.
|
||||
// stringsFor returns the requested language's dictionary, filled in with
|
||||
// English: if a translation is incomplete, the missing key shows up in
|
||||
// English instead of as a raw key.
|
||||
func stringsFor(lang string) map[string]string {
|
||||
out := map[string]string{}
|
||||
for k, v := range locales[fallbackLang] {
|
||||
|
||||
Reference in new issue
Block a user