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,21 +1,21 @@
|
||||
// totals.go: los totales, uno por personaje.
|
||||
// totals.go: the totals, one per character.
|
||||
//
|
||||
// El juego ya lleva la cuenta de muertes de cada personaje por separado
|
||||
// (esta en la partida, no en la PC), asi que el programa hace lo mismo:
|
||||
// para cada personaje guarda un "base", y el numero que se muestra es
|
||||
// siempre total = muertes que lee del juego + base.
|
||||
// The game already tracks each character's death count separately (it's
|
||||
// in the save, not on the PC), so the program does the same: for each
|
||||
// character it saves a "base", and the number shown is always
|
||||
// total = deaths read from the game + base.
|
||||
//
|
||||
// El numero que se muestra es, sin intermediarios, el que lleva el juego
|
||||
// para ese personaje. Lo que se guarda en disco NO es un ajuste: es solo
|
||||
// lo ultimo que se vio, para poder mostrar algo cuando abris el contador
|
||||
// antes que el juego y todavia no hay nada que leer.
|
||||
// The number shown is, with nothing in between, whatever the game tracks
|
||||
// for that character. What's saved to disk is NOT an adjustment: it's
|
||||
// just the last thing seen, so there's something to show if you open the
|
||||
// counter before the game and there's nothing to read yet.
|
||||
//
|
||||
// Hubo dos modelos anteriores. Primero un unico total de por vida que
|
||||
// nunca bajaba, que con varios personajes dejaba el numero quieto hasta
|
||||
// la siguiente muerte. Despues un "base" por personaje que se sumaba a
|
||||
// la lectura, heredado de cuando no confiabamos en lo que leiamos: una
|
||||
// vez que el total sale del juego en cada lectura, corregir a mano dejo
|
||||
// de arreglar nada y solo servia para que el numero mintiera en silencio.
|
||||
// There were two earlier models. First a single lifetime total that
|
||||
// never went down, which with multiple characters left the number stuck
|
||||
// until the next death. Then a per-character "base" added to the
|
||||
// reading, inherited from when we didn't trust what we were reading:
|
||||
// once the total comes straight from the game on every read, correcting
|
||||
// it by hand stopped fixing anything and just made the number lie quietly.
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
|
||||
type charTotal struct {
|
||||
Name string `json:"name"`
|
||||
Total int64 `json:"total"` // ultimo total visto: para mostrar algo antes de leer el juego
|
||||
Total int64 `json:"total"` // last total seen: shows something before the game is read
|
||||
}
|
||||
|
||||
type totalsFile struct {
|
||||
@@ -44,7 +44,7 @@ type totalsStore struct {
|
||||
data totalsFile
|
||||
}
|
||||
|
||||
// testExeDir permite a los tests apuntar a un directorio temporal.
|
||||
// testExeDir lets tests point this at a temp directory.
|
||||
var testExeDir string
|
||||
|
||||
func exeDir() (string, bool) {
|
||||
@@ -71,7 +71,7 @@ func newTotalsStore() *totalsStore {
|
||||
data, err := os.ReadFile(s.path)
|
||||
if err == nil {
|
||||
if err := json.Unmarshal(data, &s.data); err != nil {
|
||||
log.Printf("totals.json ilegible (%v): arranco de cero, no lo piso hasta la proxima escritura", err)
|
||||
log.Printf("totals.json is unreadable (%v): starting fresh, won't overwrite it until the next write", err)
|
||||
s.data = totalsFile{Characters: map[string]*charTotal{}}
|
||||
}
|
||||
if s.data.Characters == nil {
|
||||
@@ -92,7 +92,7 @@ func (s *totalsStore) get(key string) (*charTotal, bool) {
|
||||
return &cp, true
|
||||
}
|
||||
|
||||
// lastKnownTotal: que mostrar mientras el juego no este abierto.
|
||||
// lastKnownTotal: what to show while the game isn't open.
|
||||
func (s *totalsStore) lastKnownTotal() (key, name string, total int64) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
@@ -109,28 +109,27 @@ func (s *totalsStore) save(key string, c charTotal) {
|
||||
blob, err := json.MarshalIndent(s.data, "", " ")
|
||||
s.mu.Unlock()
|
||||
if err != nil {
|
||||
log.Printf("no pude serializar totals.json: %v", err)
|
||||
log.Printf("couldn't serialize totals.json: %v", err)
|
||||
return
|
||||
}
|
||||
// Escritura atomica: si se corta la luz a mitad, el archivo viejo
|
||||
// queda entero en vez de quedar un JSON cortado por la mitad.
|
||||
// Atomic write: if the power cuts mid-write, the old file stays intact
|
||||
// instead of ending up as a JSON file cut in half.
|
||||
tmp := s.path + ".tmp"
|
||||
if err := os.WriteFile(tmp, blob, 0644); err != nil {
|
||||
log.Printf("no pude escribir totals.json: %v", err)
|
||||
log.Printf("couldn't write totals.json: %v", err)
|
||||
return
|
||||
}
|
||||
if err := os.Rename(tmp, s.path); err != nil {
|
||||
log.Printf("no pude reemplazar totals.json: %v", err)
|
||||
log.Printf("couldn't replace totals.json: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// characterKey: la identidad de un personaje.
|
||||
// characterKey: a character's identity.
|
||||
//
|
||||
// El slot de guardado (GameMan+0xAC0) es la identidad buena: no cambia
|
||||
// nunca y dos personajes que se llamen igual siguen siendo distintos. El
|
||||
// nombre queda solo como respaldo para cuando no podemos leer el slot,
|
||||
// con la limitacion conocida de que ahi si dos homonimos comparten
|
||||
// contador.
|
||||
// The save slot (GameMan+0xAC0) is the good identity: it never changes,
|
||||
// and two characters with the same name stay distinct. The name is only
|
||||
// a fallback for when we can't read the slot, with the known limitation
|
||||
// that there, two homonyms DO share a counter.
|
||||
func characterKey(slot int, name string) string {
|
||||
if slot >= 0 {
|
||||
return "slot" + strconv.Itoa(slot)
|
||||
|
||||
Reference in new issue
Block a user