Docs: add zh-CN entrypoint translations (#6300)

* Docs: add zh-CN entrypoint translations

* Docs: harden docs-i18n parsing
This commit is contained in:
Josh Palmer
2026-02-01 15:22:05 +01:00
committed by GitHub
parent 7a8a39a141
commit 0e0e395b9e
20 changed files with 3334 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
package main
import (
"encoding/json"
"errors"
"fmt"
"os"
)
type GlossaryEntry struct {
Source string `json:"source"`
Target string `json:"target"`
}
func LoadGlossary(path string) ([]GlossaryEntry, error) {
data, err := os.ReadFile(path)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
return nil, nil
}
return nil, err
}
var entries []GlossaryEntry
if err := json.Unmarshal(data, &entries); err != nil {
return nil, fmt.Errorf("glossary parse failed: %w", err)
}
return entries, nil
}