Repository navigation
CatCup Tavern 0.5.1
Early-access release. Moves your existing data in and handles single-character and group roleplay end to end. The Windows installer is unsigned, and what works and what does not says exactly where the line is.
An interface that can speak Chinese. The app's own words now come from a message deck rather than from
components, a profile chooses its language in Settings → Appearance, and the first surfaces have been moved
onto it. The extraction continues one screen at a time; nothing is half-translated where it has been done.
Added
- The interface can be shown in 简体中文, and the setting is per profile.
ui.languagehas been in the settings schema since 0.2.0 marked "reserved for future i18n" and nothing read it: every string in the app was a literal in a component, so there was nothing to translate. User-facing text now lives inapps/web/src/i18n/en.tsand its translations,ui.languagepicks the deck, and Settings → Appearance → Interface language switches it with no reload. The choice is saved with the profile, so two profiles can read the app in two languages, and it follows a profile switch for the same reason the skin does. The runtime is about ninety lines overIntl.PluralRules,Intl.NumberFormatandIntl.DateTimeFormat— no dependency, because the four things needed (nested decks,{named}interpolation, CLDR plural categories, locale-aware numbers and dates) are things the browser already implements, and a message-parsing framework would have been larger than the problem without answering the one that matters: how a half-finished translation is refused. It is refused by the type. A translation is declared as a deep mirror of the English deck, so a missing, renamed or moved key is a compile error in the editor rather than a blank space someone notices in another language, and a test additionally holds every{placeholder}set to be identical across decks. Plurals live in their own namespace with their own mirror, because whether a language has aoneor afewis a property of the language — Chinese hasotheralone — and forcing a translation to invent a category its grammar never uses would be the wrong kind of parity. - A ratchet, so the rest of the extraction actually finishes.
scripts/check-i18n.mjsscans.tsxfiles for JSX text, the string props a person reads and inline toast text, and fails on any string in a file that is not on its list of surfaces still to come. The list is only ever shortened. A checker that simply failed would be red until the last file moved and would be ignored long before that; this one prints the count that is left, which is the progress bar, and turns a regression into a failing CI gate rather than a review comment. It is a scanner rather than a parser on purpose: a false negative costs one string caught by review, a false positive costs one line in its exemption list. - A failure reads as the person's own action, in their language. Every error toast was
error.message— the server's English prose — with the translated sentence only as a fallback for the case where the server said nothing at all, so a Chinese reader saw "Character not found".useErrorToastnow shows the caller's translated sentence as the title and the server's line beneath it as the detail: what the person was doing, and the specific reason to quote. The server's message is not discarded because the server is what knows what went wrong. Translating by errorcode— the codes are already on the wire — is the remaining step that removes the English line entirely.
Changed
- The sign-in screen, the library rail, the profile switcher, the Settings navigation, the Appearance panel and message timestamps are translated. These are the pilot: one or two of every kind of string the rest of the app has — a sentence, a label, an accessible name, a placeholder, a count with a plural, an interpolation, a toast — so the mechanism is proven against all of them before forty more files are moved onto it. Sign-in and setup render before a profile exists, so they use the language the browser asks for; once settings resolve, the saved language wins, which is what makes a saved choice survive a browser set to something else.
- A Chinese heading is a Chinese typeface.
InterandNewsreadership as Latin subsets, so Chinese display text fell through to whatever the operating system callsserif— SimSun on Windows, which reads like a page of a document rather than a title. A locale now carries its own display stack (Songti SC,Noto Serif CJK SC,Source Han Serif, …),styles.cssreads it ahead of the built-in one, and a skin that sets--font-displayoutright still wins because the file is the person's own choice. These are system faces rather than bundled files: every platform we ship has one, offline, and a subsetted CJK face is a separate piece of tooling. - Message times follow the language.
formatMessageTimehaden-USwritten into it; it takes a locale now, so a timestamp is06:22in Chinese rather than06:22 AM.