Files
aego/tools/i18n/main.go
T
sanspie f22242e5aa
ci / release (push) Successful in 5m5s
ci-platforms / build (amd64, windows, windows-2022) (push) Skipped
ci-platforms / build (arm64, darwin, macos-15) (push) Skipped
ci-platforms / build (amd64, darwin, macos-15-intel) (push) Skipped
ci / checks (push) Successful in 4m41s
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 7m14s
Stage 11g2–11g3: registry texts, CLI and the site in Russian (D348)
The remaining editor strings and undo step names; component, field, enum, setting, diagnostic and Script API texts under schema.*, enum.*, setting.*, diag.* and api.*; the launcher, the in-game Settings View with a Language setting, the CLI and aego schema show --lang. Every documentation page has a .ru.md translation; the site has a full Russian tree with hreflang, a language switch and ru/llms.txt; aego docs check --lang ru. New doc.tutorial and doc.recipe icons. Fix: an animator restored by a rewind prepares its controller before the replayed step.
2026-10-25 15:31:22 +03:00

58 lines
1.2 KiB
Go

// Command i18n writes the en catalogs from the code (extract) and checks the other languages against them (check, -strict) (D348).
package main
import (
"flag"
"fmt"
"os"
)
func main() {
root := flag.String("root", ".", "repository root")
strict := flag.Bool("strict", false, "fail on keys without a translation")
flag.Usage = func() { fmt.Fprintln(os.Stderr, "usage: i18n [-root dir] [-strict] extract|check") }
flag.Parse()
if flag.NArg() != 1 {
flag.Usage()
os.Exit(2)
}
keys, errs := Scan(*root)
data, err := Data()
if err != nil {
errs = append(errs, err)
}
for id, k := range data {
if _, dup := keys[id]; !dup {
keys[id] = k
}
}
for _, e := range errs {
fmt.Fprintln(os.Stderr, e)
}
if len(errs) > 0 {
os.Exit(1)
}
switch flag.Arg(0) {
case "extract":
n, err := Extract(*root, keys)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
fmt.Printf("i18n extract: %d keys in %d catalogs\n", len(keys), n)
case "check":
rep, err := Check(*root, keys)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
rep.Print(os.Stdout)
if rep.Failed(*strict) {
os.Exit(1)
}
default:
flag.Usage()
os.Exit(2)
}
}