Files
openchamber-android-native/third_party/mygo/internal/l10n/l10n.go
T
OpenChamber 6c0ee61750 feat: port the client to MyGo native UI (0.3.0)
Switch from Asuka to MyGo, keeping the API client and the feature set:

- servers: saved servers, passwordless and password login, proxy,
  self-signed certificates, per-server device tokens (Keystore), connect
  form, instance list sheet with switch/disconnect
- sessions: virtualized list, search, new session, rename/archive/delete,
  running indicator, event stream keeps it live
- chat: pushed window with system back bar, streaming Markdown via
  ui/markdown, reasoning and tool rows with image previews, footer menu
  (read aloud via a Kotlin TTS plugin, copy, fork), user message menu
  (copy, revert, fork), context usage ring and detail sheet, attachments
  (photos/files via the document picker), permissions
- release builds allow plain http:// LAN servers (Go's net/http dials
  directly, no cleartext manifest needed)
- a local fork of MyGo (third_party/mygo) lowers the Android host's
  minSdk to 24 (Android 7.0); Go 1.27.4 via mise

Version 0.3.0.
2026-11-18 13:22:59 +08:00

47 lines
1.8 KiB
Go

// Package l10n holds MyGo's own strings, those of the controls of package
// ui, of the code editor and the diff viewer, and of the roles of menus,
// in the languages MyGo is translated to: a library's catalog (see
// i18n.NewLibraryCatalog) of the namespace mygo, whose functions say them
// in the language the app shows. An app changes them, or translates them
// to its other languages, with keys "mygo.<key>" in its own catalogs, as
// "mygo.cancel" in its de.json.
//
// en.json, the source, is always linked, as messages/en.json: its
// messages without their descriptions, which only `mygo generate` reads. The translations to the other
// languages (Languages) are packages of their own, in locales/<tag> at the
// root of the module, which an app imports for the languages it ships, as
// the code `mygo generate` writes for its catalogs does: an app does not
// carry the translations to languages it does not show. catalog_gen.go,
// languages_gen.go and the packages of the translations are generated by
// `go generate`, with the code generator of apps' catalogs
// (internal/i18ngen).
package l10n
import (
"embed"
"io/fs"
)
//go:generate go run gen.go
// Namespace is the namespace of the keys with which apps change MyGo's
// strings: "mygo.<key>".
const Namespace = "mygo"
// Add adds the translations of fsys, "<tag>.json", to MyGo's strings: the
// package of each translation adds its own as it is imported.
func Add(fsys fs.FS) {
if err := Catalog.Add(fsys); err != nil {
panic(err)
}
}
// sources are the catalogs as they are written, with their descriptions.
//
//go:embed *.json
var sources embed.FS
// FS returns the catalogs as they are written, which `mygo generate`
// checks the keys "mygo.<key>" of apps against: only it links them.
func FS() fs.FS { return sources }