UI Locale Resolver (shared/ui-locale.ts)

imcodes · shared/ui-locale.ts · typescript · MIT
ui, lang:typescript, tag:knn-classified, tag:language, tag:resolver

Centralized language resolution for web app and controlled node panels, ensuring consistent locale handling across all product surfaces.

// Source: https://github.com/im4codes/imcodes | License: MIT | Copyright 2026 IM.codes
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Which of the product's seven UI languages a person should see.
 *
 * One definition for every surface that has its own language picker: the web
 * app and the controlled node's local panel both resolve the system language
 * through this module, so a language tag can never mean one thing in one and
 * another thing in the other.
 */

export const UI_LOCALES = ['en', 'zh-CN', 'zh-TW', 'es', 'ru', 'ja', 'ko'] as const;
export type UiLocale = (typeof UI_LOCALES)[number];

/** What a person sees when nothing they speak is offered. */
export const UI_LOCALE_DEFAULT: UiLocale = 'en';

/** The stored choice that means "use whatever the sys

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key