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
+33
-35
@@ -1,11 +1,10 @@
|
||||
// counter.go: la contabilidad de muertes.
|
||||
// counter.go: death accounting.
|
||||
//
|
||||
// A proposito NO tiene nada especifico de Windows: toda la lectura de
|
||||
// memoria vive en main.go. Asi esta parte, que es la que concentra las
|
||||
// reglas (a que personaje va cada muerte, que pasa al cambiar de
|
||||
// partida, que se muestra con el juego cerrado), se puede compilar y
|
||||
// testear en cualquier plataforma. Las tres veces que algo conto mal, el
|
||||
// error estuvo aca.
|
||||
// Deliberately has NOTHING Windows-specific: all memory reading lives in
|
||||
// main.go. That keeps this part — which holds the actual rules (which
|
||||
// character a death belongs to, what happens on a character switch, what
|
||||
// to show with the game closed) — buildable and testable on any platform.
|
||||
// All three times something counted wrong, the bug was here.
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -14,9 +13,9 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
// El total que se muestra ES el que lleva el juego para el personaje
|
||||
// cargado. No hay ajustes ni acumuladores propios: al cambiar de
|
||||
// personaje el numero salta al suyo en la misma lectura.
|
||||
// The total shown IS the one the game keeps for the loaded character. No
|
||||
// adjustments or accumulators of our own: switching characters jumps the
|
||||
// number to theirs on the very same reading.
|
||||
type state struct {
|
||||
mu sync.Mutex
|
||||
connected bool
|
||||
@@ -45,8 +44,8 @@ type stateSnapshot struct {
|
||||
var st state
|
||||
var totals *totalsStore
|
||||
|
||||
// init arranca mostrando el ultimo personaje conocido, para que el
|
||||
// overlay tenga un numero con sentido antes de que abras el juego.
|
||||
// init starts by showing the last known character, so the overlay has a
|
||||
// sensible number before you even open the game.
|
||||
func (s *state) init(store *totalsStore) {
|
||||
key, name, total := store.lastKnownTotal()
|
||||
s.mu.Lock()
|
||||
@@ -56,7 +55,7 @@ func (s *state) init(store *totalsStore) {
|
||||
s.total = total
|
||||
s.mu.Unlock()
|
||||
if name != "" {
|
||||
log.Printf("ultimo personaje conocido: %s con %d muertes", name, total)
|
||||
log.Printf("last known character: %s with %d deaths", name, total)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,32 +83,32 @@ func (s *state) name() string {
|
||||
return s.charName
|
||||
}
|
||||
|
||||
// nombreMostrado: lo que diga el config manda; si esta vacio usamos el
|
||||
// nombre del personaje que leemos del juego.
|
||||
func nombreMostrado(cfg config) string {
|
||||
// displayName: whatever the config says wins; if it's empty, fall back to
|
||||
// the character name read from the game.
|
||||
func displayName(cfg config) string {
|
||||
if n := strings.TrimSpace(cfg.Name); n != "" {
|
||||
return n
|
||||
}
|
||||
if n := st.name(); n != "" {
|
||||
return n
|
||||
}
|
||||
// Vacio a proposito: que la etiqueta la elija la interfaz, que es la
|
||||
// que sabe si esta mostrando un jugador o dos.
|
||||
// Empty on purpose: let the UI pick the label, since it's the one that
|
||||
// knows whether it's showing one player or two.
|
||||
return ""
|
||||
}
|
||||
|
||||
// setCharacter se llama cuando cambia el personaje cargado: el total
|
||||
// pasa a ser el que el juego lleva para ese personaje.
|
||||
// setCharacter is called when the loaded character changes: the total
|
||||
// becomes whatever the game tracks for that character.
|
||||
func (s *state) setCharacter(slot int, name string, raw int32) {
|
||||
key := characterKey(slot, name)
|
||||
if key == "" {
|
||||
return // ni slot ni nombre: no sabemos a quien imputarle esto
|
||||
return // neither slot nor name: no one to attribute this to
|
||||
}
|
||||
|
||||
s.mu.Lock()
|
||||
if key == s.charKey && s.haveReading {
|
||||
// Mismo personaje: el nombre puede haber aparecido recien, porque
|
||||
// el slot se lee antes que el nombre.
|
||||
// Same character: the name may have just shown up, since the slot
|
||||
// is read before the name.
|
||||
if name != "" && name != s.charName {
|
||||
s.charName = name
|
||||
total := s.total
|
||||
@@ -126,16 +125,15 @@ func (s *state) setCharacter(slot int, name string, raw int32) {
|
||||
s.charName = name
|
||||
}
|
||||
name = s.charName
|
||||
// Adoptamos ya la lectura del personaje nuevo: si no, el snapshot
|
||||
// seguiria mostrando las muertes del personaje ANTERIOR hasta la
|
||||
// siguiente muerte.
|
||||
// Adopt the new character's reading right away: otherwise the snapshot
|
||||
// would keep showing the PREVIOUS character's deaths until the next one.
|
||||
s.rawDeaths = raw
|
||||
s.haveReading = true
|
||||
s.total = int64(raw)
|
||||
total := s.total
|
||||
s.mu.Unlock()
|
||||
|
||||
log.Printf("personaje: %s (slot %d) -> %d muertes", name, slot, total)
|
||||
log.Printf("character: %s (slot %d) -> %d deaths", name, slot, total)
|
||||
totals.save(key, charTotal{Name: name, Total: total})
|
||||
}
|
||||
|
||||
@@ -159,16 +157,16 @@ func (s *state) setReading(raw int32, boss bool) {
|
||||
return
|
||||
}
|
||||
if grew {
|
||||
log.Printf("nueva muerte de %s -> %d", name, total)
|
||||
log.Printf("new death for %s -> %d", name, total)
|
||||
}
|
||||
totals.save(key, charTotal{Name: name, Total: total})
|
||||
}
|
||||
|
||||
// setPlayerUnloaded: el juego sigue abierto pero no hay personaje en el
|
||||
// mundo (menu principal o pantalla de carga). A diferencia de una
|
||||
// desconexion, NO apagamos connected: el overlay tiene que seguir
|
||||
// mostrando el total y no un guion, porque si no parpadearia en cada
|
||||
// pantalla de carga (o sea, en cada muerte).
|
||||
// setPlayerUnloaded: the game is still open but there's no character in
|
||||
// the world (main menu or a loading screen). Unlike a disconnect, this
|
||||
// does NOT clear connected: the overlay has to keep showing the total
|
||||
// instead of a dash, or it would flicker on every loading screen (i.e.
|
||||
// every death).
|
||||
func (s *state) setPlayerUnloaded(reason string) {
|
||||
s.mu.Lock()
|
||||
was := s.playerLoaded
|
||||
@@ -180,7 +178,7 @@ func (s *state) setPlayerUnloaded(reason string) {
|
||||
s.lastErr = reason
|
||||
s.mu.Unlock()
|
||||
if was || first {
|
||||
log.Printf("sin personaje cargado (%s) - el total queda congelado hasta que vuelvas al mundo", reason)
|
||||
log.Printf("no character loaded (%s) - total stays frozen until you're back in the world", reason)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,6 +191,6 @@ func (s *state) setDisconnected(reason string) {
|
||||
s.lastErr = reason
|
||||
s.mu.Unlock()
|
||||
if wasConnected {
|
||||
log.Printf("se perdio la conexion con el juego: %s", reason)
|
||||
log.Printf("lost the connection to the game: %s", reason)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user