mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-11-20 07:00:58 +08:00
Every user-visible string in the web UI now goes through t() from web/src/i18n. The English source text is the key, so a missing entry falls back to English and nothing breaks; Turkish lives in one flat file, web/src/i18n/locales/tr.json (about 2,600 entries). The locale is chosen once per page load: a saved choice, else the browser language, else English. Switching (new Language toggle under Preferences) stores the choice and reloads, so t() also works in module constants, helpers and toasts without hooks. Also: - hard-coded zh-CN / implicit date locales now follow the UI language - sentences assembled from fragments became single templates - "Toujours autoriser" in approval records is now English - upload.test.mjs stubs the new @/i18n import Values sent to the API or compared in code, agent prompts, and backend messages are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
828 B
TypeScript
31 lines
828 B
TypeScript
import { t } from "@/i18n";
|
|
import type { NewAssetType } from "@/lib/types";
|
|
|
|
const ASSET_TYPE_LABELS: Record<NewAssetType, string> = {
|
|
app: t("App"),
|
|
endpoint: t("Endpoint"),
|
|
ip: "IP",
|
|
root_domain: t("Root domain"),
|
|
service: t("Service"),
|
|
subdomain: t("Subdomain"),
|
|
};
|
|
|
|
const TASK_ASSET_SOURCE_LABELS: Record<string, string> = {
|
|
agent: t("Agent-discovered"),
|
|
anchor: t("Blackboard anchor"),
|
|
api: t("Assets API"),
|
|
company: t("Company association"),
|
|
legacy: t("Legacy association"),
|
|
manual: t("Manually added"),
|
|
system: t("System association"),
|
|
task: t("Task initialization"),
|
|
};
|
|
|
|
export function taskAssetTypeLabel(type: NewAssetType): string {
|
|
return ASSET_TYPE_LABELS[type];
|
|
}
|
|
|
|
export function taskAssetSourceLabel(source: string): string {
|
|
return TASK_ASSET_SOURCE_LABELS[source] ?? source;
|
|
}
|