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.
This commit is contained in:
1 parent
2fb4a8ea79
commit
6c0ee61750
2538 files changed
+675779
-4792
No files matched your search
@@ -0,0 +1,167 @@
|
||||
// Code generated by mygo generate from the catalogs in this directory. DO NOT EDIT.
|
||||
|
||||
package locales
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"time"
|
||||
|
||||
"github.com/egoist/mygo/i18n"
|
||||
|
||||
// MyGo's own strings in the app's languages.
|
||||
_ "github.com/egoist/mygo/locales/zh-Hant"
|
||||
)
|
||||
|
||||
//go:embed *.json
|
||||
var files embed.FS
|
||||
|
||||
// Catalog holds the messages in en, the source language, and de, en-GB and
|
||||
// zh-Hant. It is registered with package i18n, which makes its languages
|
||||
// the app's.
|
||||
var Catalog *i18n.Catalog
|
||||
|
||||
func init() {
|
||||
var err error
|
||||
if Catalog, err = i18n.NewCatalog(files, "en"); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
i18n.Register(Catalog)
|
||||
}
|
||||
|
||||
// Messages say the messages in one language.
|
||||
type Messages struct{ locale string }
|
||||
|
||||
// In returns the messages in the language of locale, as "de" or
|
||||
// "zh-Hant", or of the catalog's language that suits it best, "" for the
|
||||
// source language.
|
||||
func In(locale string) Messages { return Messages{locale} }
|
||||
|
||||
// Title says "Notes"
|
||||
// in the language the app shows.
|
||||
//
|
||||
// The name of the app, in its windows' titles.
|
||||
func Title() string { return In(i18n.Locale()).Title() }
|
||||
|
||||
// Title says "Notes"
|
||||
// in the language of msgs.
|
||||
//
|
||||
// The name of the app, in its windows' titles.
|
||||
func (msgs Messages) Title() string {
|
||||
return Catalog.Format(msgs.locale, "title", nil)
|
||||
}
|
||||
|
||||
// FilesSelected says "{count, plural, =0 {No files selected} one {# file selected} other {# files selected}}"
|
||||
// in the language the app shows.
|
||||
//
|
||||
// The status bar, while files are selected.
|
||||
func FilesSelected(count int) string { return In(i18n.Locale()).FilesSelected(count) }
|
||||
|
||||
// FilesSelected says "{count, plural, =0 {No files selected} one {# file selected} other {# files selected}}"
|
||||
// in the language of msgs.
|
||||
//
|
||||
// The status bar, while files are selected.
|
||||
func (msgs Messages) FilesSelected(count int) string {
|
||||
return Catalog.Format(msgs.locale, "filesSelected", map[string]any{"count": count})
|
||||
}
|
||||
|
||||
// Greeting says "Hello, {name}!"
|
||||
// in the language the app shows.
|
||||
func Greeting(name string) string { return In(i18n.Locale()).Greeting(name) }
|
||||
|
||||
// Greeting says "Hello, {name}!"
|
||||
// in the language of msgs.
|
||||
func (msgs Messages) Greeting(name string) string {
|
||||
return Catalog.Format(msgs.locale, "greeting", map[string]any{"name": name})
|
||||
}
|
||||
|
||||
// Replied says "{gender, select, female {She} male {He} other {They}} replied {when, date, short}."
|
||||
// in the language the app shows.
|
||||
func Replied(gender string, when time.Time) string { return In(i18n.Locale()).Replied(gender, when) }
|
||||
|
||||
// Replied says "{gender, select, female {She} male {He} other {They}} replied {when, date, short}."
|
||||
// in the language of msgs.
|
||||
func (msgs Messages) Replied(gender string, when time.Time) string {
|
||||
return Catalog.Format(msgs.locale, "replied", map[string]any{"gender": gender, "when": when})
|
||||
}
|
||||
|
||||
// Progress says "{done, number, percent} done"
|
||||
// in the language the app shows.
|
||||
func Progress(done float64) string { return In(i18n.Locale()).Progress(done) }
|
||||
|
||||
// Progress says "{done, number, percent} done"
|
||||
// in the language of msgs.
|
||||
func (msgs Messages) Progress(done float64) string {
|
||||
return Catalog.Format(msgs.locale, "progress", map[string]any{"done": done})
|
||||
}
|
||||
|
||||
// Place says "You came {n, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}"
|
||||
// in the language the app shows.
|
||||
func Place(n int) string { return In(i18n.Locale()).Place(n) }
|
||||
|
||||
// Place says "You came {n, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}"
|
||||
// in the language of msgs.
|
||||
func (msgs Messages) Place(n int) string {
|
||||
return Catalog.Format(msgs.locale, "place", map[string]any{"n": n})
|
||||
}
|
||||
|
||||
// Guests says "{n, plural, offset:1 =0 {Nobody} =1 {{host}} one {{host} and # other} other {{host} and # others}}"
|
||||
// in the language the app shows.
|
||||
func Guests(host string, n float64) string { return In(i18n.Locale()).Guests(host, n) }
|
||||
|
||||
// Guests says "{n, plural, offset:1 =0 {Nobody} =1 {{host}} one {{host} and # other} other {{host} and # others}}"
|
||||
// in the language of msgs.
|
||||
func (msgs Messages) Guests(host string, n float64) string {
|
||||
return Catalog.Format(msgs.locale, "guests", map[string]any{"host": host, "n": n})
|
||||
}
|
||||
|
||||
// Positional says "{0} of {1}"
|
||||
// in the language the app shows.
|
||||
func Positional(arg0 string, arg1 string) string { return In(i18n.Locale()).Positional(arg0, arg1) }
|
||||
|
||||
// Positional says "{0} of {1}"
|
||||
// in the language of msgs.
|
||||
func (msgs Messages) Positional(arg0 string, arg1 string) string {
|
||||
return Catalog.Format(msgs.locale, "positional", map[string]any{"0": arg0, "1": arg1})
|
||||
}
|
||||
|
||||
// Keyword says "{type} {default} {string} {any} {__proto__}"
|
||||
// in the language the app shows.
|
||||
func Keyword(type_ string, default_ string, string_ string, any_ string, __proto__ string) string {
|
||||
return In(i18n.Locale()).Keyword(type_, default_, string_, any_, __proto__)
|
||||
}
|
||||
|
||||
// Keyword says "{type} {default} {string} {any} {__proto__}"
|
||||
// in the language of msgs.
|
||||
func (msgs Messages) Keyword(type_ string, default_ string, string_ string, any_ string, __proto__ string) string {
|
||||
return Catalog.Format(msgs.locale, "keyword", map[string]any{"type": type_, "default": default_, "string": string_, "any": any_, "__proto__": __proto__})
|
||||
}
|
||||
|
||||
// Untyped says "Value: {value}"
|
||||
// in the language the app shows.
|
||||
func Untyped(value string) string { return In(i18n.Locale()).Untyped(value) }
|
||||
|
||||
// Untyped says "Value: {value}"
|
||||
// in the language of msgs.
|
||||
func (msgs Messages) Untyped(value string) string {
|
||||
return Catalog.Format(msgs.locale, "untyped", map[string]any{"value": value})
|
||||
}
|
||||
|
||||
// Object says "Item {item}"
|
||||
// in the language the app shows.
|
||||
func Object(item any) string { return In(i18n.Locale()).Object(item) }
|
||||
|
||||
// Object says "Item {item}"
|
||||
// in the language of msgs.
|
||||
func (msgs Messages) Object(item any) string {
|
||||
return Catalog.Format(msgs.locale, "object", map[string]any{"item": item})
|
||||
}
|
||||
|
||||
// SaveAs says "Save As…"
|
||||
// in the language the app shows.
|
||||
func SaveAs() string { return In(i18n.Locale()).SaveAs() }
|
||||
|
||||
// SaveAs says "Save As…"
|
||||
// in the language of msgs.
|
||||
func (msgs Messages) SaveAs() string {
|
||||
return Catalog.Format(msgs.locale, "save_as", nil)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"@@locale": "de",
|
||||
"title": "Notizen",
|
||||
"filesSelected": "{count, plural, =0 {Keine Dateien ausgewählt} one {# Datei ausgewählt} other {# Dateien ausgewählt}}",
|
||||
"greeting": "Hallo, {name}!",
|
||||
"replied": "{gender, select, female {Sie} male {Er} other {Sie}} hat am {when, date, short} geantwortet.",
|
||||
"place": "Du bist {n}. geworden",
|
||||
"guests": "{n, plural, offset:1 =0 {Niemand} =1 {{host}} one {{host} und # weitere Person} other {{host} und # weitere Personen}}",
|
||||
"mygo.cancel": "Abbrechen",
|
||||
"mygo.quitApp": "{app} beenden",
|
||||
"mygo.appName": "Notizen"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"@@locale": "en-GB",
|
||||
"progress": "{done, number, percent} complete"
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"@@locale": "en",
|
||||
"title": "Notes",
|
||||
"@title": {
|
||||
"description": "The name of the app, in its windows' titles."
|
||||
},
|
||||
"filesSelected": "{count, plural, =0 {No files selected} one {# file selected} other {# files selected}}",
|
||||
"@filesSelected": {
|
||||
"description": "The status bar, while files are selected.",
|
||||
"placeholders": {
|
||||
"count": { "type": "int", "example": "3" }
|
||||
}
|
||||
},
|
||||
"greeting": "Hello, {name}!",
|
||||
"@greeting": {
|
||||
"placeholders": {
|
||||
"name": { "type": "String" }
|
||||
}
|
||||
},
|
||||
"replied": "{gender, select, female {She} male {He} other {They}} replied {when, date, short}.",
|
||||
"progress": "{done, number, percent} done",
|
||||
"@progress": {
|
||||
"placeholders": {
|
||||
"done": { "type": "double" }
|
||||
}
|
||||
},
|
||||
"place": "You came {n, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}",
|
||||
"guests": "{n, plural, offset:1 =0 {Nobody} =1 {{host}} one {{host} and # other} other {{host} and # others}}",
|
||||
"@guests": {
|
||||
"placeholders": {
|
||||
"host": { "type": "String" },
|
||||
"n": { "type": "num" }
|
||||
}
|
||||
},
|
||||
"positional": "{0} of {1}",
|
||||
"keyword": "{type} {default} {string} {any} {__proto__}",
|
||||
"untyped": "Value: {value}",
|
||||
"@untyped": {
|
||||
"placeholders": {
|
||||
"value": {}
|
||||
}
|
||||
},
|
||||
"object": "Item {item}",
|
||||
"@object": {
|
||||
"placeholders": {
|
||||
"item": { "type": "Object" }
|
||||
}
|
||||
},
|
||||
"save_as": "Save As…",
|
||||
"mygo.cancel": "Dismiss"
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
// Code generated by mygo generate from the catalogs of the app. DO NOT EDIT.
|
||||
import { createCatalog } from "mygo-runtime/i18n";
|
||||
|
||||
/** The messages of the app in one language. */
|
||||
export interface Messages {
|
||||
/**
|
||||
* The name of the app, in its windows' titles.
|
||||
*
|
||||
* `Notes`
|
||||
*/
|
||||
title(): string;
|
||||
/**
|
||||
* The status bar, while files are selected.
|
||||
*
|
||||
* `{count, plural, =0 {No files selected} one {# file selected} other {# files selected}}`
|
||||
*/
|
||||
filesSelected(count: number): string;
|
||||
/**
|
||||
* `Hello, {name}!`
|
||||
*/
|
||||
greeting(name: string): string;
|
||||
/**
|
||||
* `{gender, select, female {She} male {He} other {They}} replied {when, date, short}.`
|
||||
*/
|
||||
replied(gender: string, when: Date): string;
|
||||
/**
|
||||
* `{done, number, percent} done`
|
||||
*/
|
||||
progress(done: number): string;
|
||||
/**
|
||||
* `You came {n, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}`
|
||||
*/
|
||||
place(n: number): string;
|
||||
/**
|
||||
* `{n, plural, offset:1 =0 {Nobody} =1 {{host}} one {{host} and # other} other {{host} and # others}}`
|
||||
*/
|
||||
guests(host: string, n: number): string;
|
||||
/**
|
||||
* `{0} of {1}`
|
||||
*/
|
||||
positional(arg0: string, arg1: string): string;
|
||||
/**
|
||||
* `{type} {default} {string} {any} {__proto__}`
|
||||
*/
|
||||
keyword(type: string, default_: string, string: string, any: string, __proto__: string): string;
|
||||
/**
|
||||
* `Value: {value}`
|
||||
*/
|
||||
untyped(value: string): string;
|
||||
/**
|
||||
* `Item {item}`
|
||||
*/
|
||||
object(item: unknown): string;
|
||||
/**
|
||||
* `Save As…`
|
||||
*/
|
||||
save_as(): string;
|
||||
}
|
||||
|
||||
const catalog = createCatalog<Messages>({
|
||||
source: "en",
|
||||
languages: ["en", "de", "en-GB", "zh-Hant"],
|
||||
fallbacks: {
|
||||
"en": ["en"],
|
||||
"de": ["de", "en"],
|
||||
"en-GB": ["en-GB", "en"],
|
||||
"zh-Hant": ["zh-Hant", "en"],
|
||||
},
|
||||
params: {
|
||||
"title": [],
|
||||
"filesSelected": ["count"],
|
||||
"greeting": ["name"],
|
||||
"replied": ["gender", "when"],
|
||||
"progress": ["done"],
|
||||
"place": ["n"],
|
||||
"guests": ["host", "n"],
|
||||
"positional": ["0", "1"],
|
||||
"keyword": ["type", "default", "string", "any", "__proto__"],
|
||||
"untyped": ["value"],
|
||||
"object": ["item"],
|
||||
"save_as": [],
|
||||
},
|
||||
messages: {
|
||||
"en": {
|
||||
"title": "Notes",
|
||||
"filesSelected": "{count, plural, =0 {No files selected} one {# file selected} other {# files selected}}",
|
||||
"greeting": "Hello, {name}!",
|
||||
"replied": "{gender, select, female {She} male {He} other {They}} replied {when, date, short}.",
|
||||
"progress": "{done, number, percent} done",
|
||||
"place": "You came {n, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}",
|
||||
"guests": "{n, plural, offset:1 =0 {Nobody} =1 {{host}} one {{host} and # other} other {{host} and # others}}",
|
||||
"positional": "{0} of {1}",
|
||||
"keyword": "{type} {default} {string} {any} {__proto__}",
|
||||
"untyped": "Value: {value}",
|
||||
"object": "Item {item}",
|
||||
"save_as": "Save As…",
|
||||
},
|
||||
"de": {
|
||||
"title": "Notizen",
|
||||
"filesSelected": "{count, plural, =0 {Keine Dateien ausgewählt} one {# Datei ausgewählt} other {# Dateien ausgewählt}}",
|
||||
"greeting": "Hallo, {name}!",
|
||||
"replied": "{gender, select, female {Sie} male {Er} other {Sie}} hat am {when, date, short} geantwortet.",
|
||||
"place": "Du bist {n}. geworden",
|
||||
"guests": "{n, plural, offset:1 =0 {Niemand} =1 {{host}} one {{host} und # weitere Person} other {{host} und # weitere Personen}}",
|
||||
},
|
||||
"en-GB": {
|
||||
"progress": "{done, number, percent} complete",
|
||||
},
|
||||
"zh-Hant": {
|
||||
"title": "筆記",
|
||||
"filesSelected": "{count, plural, other {已選取 # 個檔案}}",
|
||||
"greeting": "你好,{name}!",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* The messages in the language the page shows: the app's, else the
|
||||
* browser's. Each call says its message in the language of the moment.
|
||||
*/
|
||||
export const messages: Messages = catalog.messages();
|
||||
|
||||
/** Returns the messages in the language of locale, as "de" or "zh-Hant". */
|
||||
export function messagesIn(locale: string): Messages {
|
||||
return catalog.messagesIn(locale);
|
||||
}
|
||||
|
||||
/** The languages of the catalogs: the source language, then the others. */
|
||||
export const languages: readonly string[] = catalog.languages;
|
||||
@@ -0,0 +1,30 @@
|
||||
// Command say says messages of the golden catalog, which TestGoldenBuilds
|
||||
// runs.
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing/fstest"
|
||||
|
||||
"github.com/egoist/mygo/i18n"
|
||||
locales "github.com/egoist/mygo/internal/i18ngen/testdata/app"
|
||||
)
|
||||
|
||||
func main() {
|
||||
lib, err := i18n.NewLibraryCatalog(fstest.MapFS{
|
||||
"en.json": {Data: []byte(`{"cancel": "Cancel"}`)},
|
||||
}, "en", "mygo")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(locales.Title())
|
||||
fmt.Println(locales.In("de").Title())
|
||||
fmt.Println(locales.FilesSelected(3))
|
||||
fmt.Println(locales.In("de-AT").FilesSelected(0))
|
||||
fmt.Println(locales.In("zh-TW").FilesSelected(1))
|
||||
fmt.Println(locales.Guests("Ada", 3))
|
||||
fmt.Println(lib.Format(i18n.Locale(), "cancel", nil))
|
||||
i18n.SetLocaleFunc(func() string { return "de" })
|
||||
fmt.Println(lib.Format(i18n.Locale(), "cancel", nil))
|
||||
fmt.Println(i18n.Languages())
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"title": "筆記",
|
||||
"filesSelected": "{count, plural, other {已選取 # 個檔案}}",
|
||||
"greeting": "你好,{name}!"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
locales/de.json:1: "ok" comes twice
|
||||
locales/de.json: warning: 5 of 6 messages missing, which say the language they fall back to: files, broken, dup_name, typed, few
|
||||
locales/en-XA.json: en-XA is a pseudo locale, made from the source language: remove the file
|
||||
locales/en.json:5: "broken" does not parse: the plural argument "n" has no other case
|
||||
locales/en.json:6: "bad-key" is not a key: a letter, then letters, digits and _, as filesSelected
|
||||
locales/en.json:7: "In" would name its Go function In, which the generated code declares
|
||||
locales/en.json:9: "dup_name" and "dupName" would both name their Go function DupName
|
||||
locales/en.json:10: "typed" uses n as a plural argument, which its type String cannot be
|
||||
locales/en.json:11: @typed.placeholders.weird: type "float" is not String, int, double, num, DateTime or Object
|
||||
locales/en.json:11: warning: @typed declares the placeholder unused, which the message does not use
|
||||
locales/en.json:11: warning: @typed declares the placeholder weird, which the message does not use
|
||||
locales/en.json:18: warning: @ghost describes no message
|
||||
locales/en.json:19: "notString" is not a string
|
||||
locales/en.json:20: warning: "few": en has no plural category of few (its plural categories are one, other)
|
||||
locales/en.json:21: "unknown.key": no library has the namespace unknown
|
||||
locales/en.json:22: "mygo.nope": mygo has no message nope
|
||||
locales/en.json:23: "mygo.quitApp" uses the argument application, but the source message has the arguments app
|
||||
locales/en.json:23: warning: "mygo.quitApp" does not use the argument app
|
||||
locales/fr.json: not a JSON object of messages
|
||||
locales/ru.json:2: @@locale "uk" is not ru, the language the file is named after
|
||||
locales/ru.json:3: "ok" uses the argument extra, but the source message has no arguments
|
||||
locales/ru.json:4: warning: "files": the plural argument n lacks few, many, a plural category of ru, which says other in its place
|
||||
locales/ru.json:5: "stray" is not a key of locales/en.json
|
||||
locales/ru.json: warning: 4 of 6 messages missing, which say the language they fall back to: broken, dup_name, typed, few
|
||||
locales/zh_CN.json: the name of a catalog is a BCP 47 tag in its canonical form, as en.json or zh-Hant.json: rename it zh-CN.json
|
||||
@@ -0,0 +1 @@
|
||||
{ "ok": "Gut", "ok": "Twice" }
|
||||
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"@@locale": "en",
|
||||
"ok": "Fine",
|
||||
"files": "{n, plural, one {# file} other {# files}}",
|
||||
"broken": "{n, plural, one {# file}}",
|
||||
"bad-key": "A key with a dash",
|
||||
"In": "Collides with In",
|
||||
"dup_name": "One",
|
||||
"dupName": "Two",
|
||||
"typed": "{n, plural, one {#} other {#}}",
|
||||
"@typed": {
|
||||
"placeholders": {
|
||||
"n": { "type": "String" },
|
||||
"unused": { "type": "int" },
|
||||
"weird": { "type": "float" }
|
||||
}
|
||||
},
|
||||
"@ghost": { "description": "Describes nothing." },
|
||||
"notString": 3,
|
||||
"few": "{n, plural, one {#} few {#} other {#}}",
|
||||
"unknown.key": "No such library",
|
||||
"mygo.nope": "No such message",
|
||||
"mygo.quitApp": "Quit {application}"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
[ "not an object" ]
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"@@locale": "uk",
|
||||
"ok": "Хорошо {extra}",
|
||||
"files": "{n, plural, one {# файл} other {# файлов}}",
|
||||
"stray": "Not in the source"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{}
|
||||
Reference in new issue
Block a user