@@ -3,6 +3,7 @@ import { existsSync } from "node:fs";
33import { mkdir , readFile , stat , writeFile } from "node:fs/promises" ;
44import path from "node:path" ;
55import { fileURLToPath , pathToFileURL } from "node:url" ;
6+ import { OPENCLAW_LOCALES } from "../packages/localization-core/src/locale-registry.js" ;
67import { CONTROL_UI_LOCALE_ENTRIES } from "./lib/control-ui-i18n-config.ts" ;
78import { syncControlUiRawCopyBaseline } from "./lib/control-ui-i18n-raw-copy.ts" ;
89import type { TranslationMap } from "./lib/control-ui-i18n-sync-plan.ts" ;
@@ -238,9 +239,15 @@ export async function verifyRuntimeLocaleConfig() {
238239 path . join ( ROOT , "ui" , "src" , "i18n" , "lib" , "registry.ts" ) ,
239240 "utf8" ,
240241 ) ;
241- const typesRaw = await readFile ( path . join ( ROOT , "ui" , "src" , "i18n" , "lib" , "types.ts" ) , "utf8" ) ;
242+ const configuredLocales = [ "en" , ...CONTROL_UI_LOCALE_ENTRIES . map ( ( entry ) => entry . locale ) ] ;
243+ const sharedUiLocales = OPENCLAW_LOCALES . filter ( ( locale ) => locale !== "sv" ) ;
244+ if ( ! compareStringArrays ( configuredLocales , sharedUiLocales ) ) {
245+ throw new Error (
246+ `runtime locale config is out of sync with the shared registry: expected ${ sharedUiLocales . join ( ", " ) } , got ${ configuredLocales . join ( ", " ) } ` ,
247+ ) ;
248+ }
242249 for ( const entry of CONTROL_UI_LOCALE_ENTRIES ) {
243- if ( ! registryRaw . includes ( `"${ entry . locale } "` ) || ! typesRaw . includes ( `| " ${ entry . locale } "` ) ) {
250+ if ( ! registryRaw . includes ( `"${ entry . locale } "` ) ) {
244251 throw new Error ( `runtime locale config is missing ${ entry . locale } ` ) ;
245252 }
246253 }
0 commit comments