mirror of
https://github.com/bitbaum/causius.git
synced 2026-12-04 04:47:34 +01:00
The owner narrowed the focus: no US market for now. Markets are now a config (lib/jurisdictions.ts): each country is one record with its regions, interface languages and a note for the agent; MARKETS lists the ones that are switched on. Adding a country is that record, its words under Home.where.<code>, and its code in MARKETS. A test fails if a market lacks its words in any language. The agent's country rules moved out of its prompt into each market's note, read for the matter's own jurisdiction. The front page's markets and kicker are generated from MARKETS. The US stays pickable under Elsewhere. The Spanish interface existed for the US market and goes with it (git history keeps it); a letter can still be translated into Spanish. Claude-Session: https://claude.ai/code/session_018Lem7GyhyyjKhmwjG8G7Ud Co-authored-by: Claude <noreply@anthropic.com>
25 lines
1008 B
TypeScript
25 lines
1008 B
TypeScript
/**
|
|
* Languages a letter can be translated into, as BCP 47 codes. Wider than the
|
|
* interface (i18n/routing.ts) on purpose: the people who most need a letter
|
|
* explained are often the ones who do not read the language it is written in.
|
|
* The interface's languages come first, then the languages most spoken by
|
|
* people who moved to Switzerland and Liechtenstein.
|
|
*/
|
|
export const TRANSLATION_LANGUAGES = [
|
|
"en", "de", "fr", "it", "es",
|
|
"pt", "sq", "sr", "hr", "tr", "ar", "uk", "ru", "fa", "ti", "ta", "zh", "vi", "tl",
|
|
] as const;
|
|
export type TranslationLanguage = (typeof TRANSLATION_LANGUAGES)[number];
|
|
|
|
/** The analysis translates into at most this many at once (lib/analyze.ts). */
|
|
export const MAX_TRANSLATIONS = 4;
|
|
|
|
/** A language's name in the reader's language, from the runtime's own tables. */
|
|
export function languageName(code: string, locale: string): string {
|
|
try {
|
|
return new Intl.DisplayNames([locale], { type: "language" }).of(code) ?? code;
|
|
} catch {
|
|
return code;
|
|
}
|
|
}
|