mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-05 10:29:58 +02:00
feat(l10n): single-source localization pipeline
Add localization/ — one strings.json is the source of truth for every
user-facing string, and a Bun CLI generates the platform files:
loc migrate rebuild strings.json from existing platform files (one-time)
loc validate structural checks (plural `other`, arg refs, coverage)
loc generate emit .xcstrings (Apple) + per-language strings.xml (KMP)
Canonical `{name}` placeholders are converted to each platform's positional
printf tokens using declared arg types. Plurals use CLDR categories and emit
native forms: xcstrings plural variations and Compose <plurals> blocks.
Migration folds the KMP `transfer_file_count_one`/`_other` pair into a single
plural key, so `transferFileCountResource` now returns the plural resource and
callers resolve it with pluralStringResource.
This commit is contained in:
24
localization/src/config.ts
Normal file
24
localization/src/config.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
/** Repo root = parent of the localization/ directory. */
|
||||
export const REPO_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
||||
export const LOC_DIR = join(REPO_ROOT, "localization");
|
||||
export const STRINGS_JSON = join(LOC_DIR, "strings.json");
|
||||
|
||||
/** Apple String Catalog — one file, all languages nested. */
|
||||
export const APPLE_XCSTRINGS = join(
|
||||
REPO_ROOT,
|
||||
"apple/VniDrop/Resources/Localizable.xcstrings",
|
||||
);
|
||||
|
||||
/** KMP / Compose Multiplatform resources root; one values[-lang]/strings.xml per language. */
|
||||
export const KMP_RESOURCES = join(
|
||||
REPO_ROOT,
|
||||
"shared/src/commonMain/composeResources",
|
||||
);
|
||||
|
||||
/** Directory holding a language's strings.xml under the compose resources root. */
|
||||
export function kmpValuesDir(lang: string, sourceLanguage: string): string {
|
||||
return lang === sourceLanguage ? "values" : `values-${lang}`;
|
||||
}
|
||||
Reference in New Issue
Block a user