diff --git a/.changeset/yaml-first-translations.md b/.changeset/yaml-first-translations.md deleted file mode 100644 index f784b84..0000000 --- a/.changeset/yaml-first-translations.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -'@edoxen/browser': minor ---- - -YAML-first translations. - -Translators work in YAML, not JS literals. The runtime i18n table now ships as six per-locale YAML files (`src/i18n/strings/.yaml`) parsed at build time via Vite's `?raw` import + the `yaml` package. Consumer overrides gain a symmetric loader. - -### Added -- `loadYamlTranslations(yamlString)` helper, exported from `@edoxen/browser`. Parses a YAML mapping of `'key': 'value'` pairs into a frozen `UiStrings` record. Throws clearly on non-mapping input, ignores non-string values, returns `{}` for empty input. -- `src/i18n/load-translations.spec.ts` — six tests covering happy path, unicode/quote escaping, empty input, malformed input, freeze guarantee. - -### Changed -- `src/i18n/strings/{eng,fra,zho,spa,ara,rus}.yaml` — built-in locale tables extracted from the TS literal that used to live inline in `ui.ts`. Same keys, same values, just YAML. Translators can read these as worked examples. -- `src/i18n/ui.ts` — `STRINGS` const now references `BUILTIN_STRINGS` (loaded from YAML); the 557-line inline table is gone. `loadYamlTranslations` is re-exported for consumers. -- `src/virtual.d.ts` — declares `*.yaml?raw` and `*.yml?raw` modules so TypeScript accepts Vite's raw YAML imports. -- README §Custom translations rewritten to make YAML the primary path: Option A (file-based, recommended) loads via `readFileSync` + `loadYamlTranslations`; Option B (inline literals) still works for small overrides. Includes YAML escaping rules (`'` doubling inside single-quoted scalars, or backslash escapes in double-quoted). - -### Migration notes for consumers -No breaking changes — inline `uiStrings: { fra: {...} }` literals still work. Consumers who want file-based translations can adopt the new helper without touching existing config. Built-in English + French values are unchanged. diff --git a/examples/bilingual/CHANGELOG.md b/examples/bilingual/CHANGELOG.md index 6811b7f..c859408 100644 --- a/examples/bilingual/CHANGELOG.md +++ b/examples/bilingual/CHANGELOG.md @@ -1,5 +1,12 @@ # @edoxen/browser-example-bilingual +## 0.0.18 + +### Patch Changes + +- Updated dependencies [5501082] + - @edoxen/browser@0.10.0 + ## 0.0.17 ### Patch Changes diff --git a/examples/bilingual/package.json b/examples/bilingual/package.json index 11cabda..f5e5170 100644 --- a/examples/bilingual/package.json +++ b/examples/bilingual/package.json @@ -1,6 +1,6 @@ { "name": "@edoxen/browser-example-bilingual", - "version": "0.0.17", + "version": "0.0.18", "private": true, "type": "module", "description": "Bilingual @edoxen/browser example — EN + FR content via per-field LocalizedString.", diff --git a/examples/minimal/CHANGELOG.md b/examples/minimal/CHANGELOG.md index a399d22..c2b6411 100644 --- a/examples/minimal/CHANGELOG.md +++ b/examples/minimal/CHANGELOG.md @@ -1,5 +1,12 @@ # @edoxen/browser-example-minimal +## 0.0.18 + +### Patch Changes + +- Updated dependencies [5501082] + - @edoxen/browser@0.10.0 + ## 0.0.17 ### Patch Changes diff --git a/examples/minimal/package.json b/examples/minimal/package.json index 77e41d3..6f64ab9 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -1,6 +1,6 @@ { "name": "@edoxen/browser-example-minimal", - "version": "0.0.17", + "version": "0.0.18", "private": true, "type": "module", "description": "Minimal @edoxen/browser example — single-locale, decisions-only.", diff --git a/examples/multibody/CHANGELOG.md b/examples/multibody/CHANGELOG.md index e446abd..e51fae7 100644 --- a/examples/multibody/CHANGELOG.md +++ b/examples/multibody/CHANGELOG.md @@ -1,5 +1,12 @@ # @edoxen/browser-example-multibody +## 0.0.18 + +### Patch Changes + +- Updated dependencies [5501082] + - @edoxen/browser@0.10.0 + ## 0.0.17 ### Patch Changes diff --git a/examples/multibody/package.json b/examples/multibody/package.json index 800ccb8..0e9d19b 100644 --- a/examples/multibody/package.json +++ b/examples/multibody/package.json @@ -1,6 +1,6 @@ { "name": "@edoxen/browser-example-multibody", - "version": "0.0.17", + "version": "0.0.18", "private": true, "type": "module", "description": "Multi-body @edoxen/browser example — CIML + Conference + DC badges.", diff --git a/examples/standalone/CHANGELOG.md b/examples/standalone/CHANGELOG.md index 74dfb96..0def5ca 100644 --- a/examples/standalone/CHANGELOG.md +++ b/examples/standalone/CHANGELOG.md @@ -1,5 +1,12 @@ # @edoxen/browser-example-standalone +## 0.0.18 + +### Patch Changes + +- Updated dependencies [5501082] + - @edoxen/browser@0.10.0 + ## 0.0.17 ### Patch Changes diff --git a/examples/standalone/package.json b/examples/standalone/package.json index cd46796..58bbb60 100644 --- a/examples/standalone/package.json +++ b/examples/standalone/package.json @@ -1,6 +1,6 @@ { "name": "@edoxen/browser-example-standalone", - "version": "0.0.17", + "version": "0.0.18", "private": true, "type": "module", "description": "Standalone-mode @edoxen/browser showcase — no astro.config: edoxen.config.ts + data + src/styles/override.css theming demo.", diff --git a/packages/browser/CHANGELOG.md b/packages/browser/CHANGELOG.md index c4e592d..16446a5 100644 --- a/packages/browser/CHANGELOG.md +++ b/packages/browser/CHANGELOG.md @@ -1,5 +1,29 @@ # @edoxen/browser +## 0.10.0 + +### Minor Changes + +- 5501082: YAML-first translations. + + Translators work in YAML, not JS literals. The runtime i18n table now ships as six per-locale YAML files (`src/i18n/strings/.yaml`) parsed at build time via Vite's `?raw` import + the `yaml` package. Consumer overrides gain a symmetric loader. + + ### Added + + - `loadYamlTranslations(yamlString)` helper, exported from `@edoxen/browser`. Parses a YAML mapping of `'key': 'value'` pairs into a frozen `UiStrings` record. Throws clearly on non-mapping input, ignores non-string values, returns `{}` for empty input. + - `src/i18n/load-translations.spec.ts` — six tests covering happy path, unicode/quote escaping, empty input, malformed input, freeze guarantee. + + ### Changed + + - `src/i18n/strings/{eng,fra,zho,spa,ara,rus}.yaml` — built-in locale tables extracted from the TS literal that used to live inline in `ui.ts`. Same keys, same values, just YAML. Translators can read these as worked examples. + - `src/i18n/ui.ts` — `STRINGS` const now references `BUILTIN_STRINGS` (loaded from YAML); the 557-line inline table is gone. `loadYamlTranslations` is re-exported for consumers. + - `src/virtual.d.ts` — declares `*.yaml?raw` and `*.yml?raw` modules so TypeScript accepts Vite's raw YAML imports. + - README §Custom translations rewritten to make YAML the primary path: Option A (file-based, recommended) loads via `readFileSync` + `loadYamlTranslations`; Option B (inline literals) still works for small overrides. Includes YAML escaping rules (`'` doubling inside single-quoted scalars, or backslash escapes in double-quoted). + + ### Migration notes for consumers + + No breaking changes — inline `uiStrings: { fra: {...} }` literals still work. Consumers who want file-based translations can adopt the new helper without touching existing config. Built-in English + French values are unchanged. + ## 0.9.0 ### Minor Changes diff --git a/packages/browser/package.json b/packages/browser/package.json index 8251d72..1ef5cf3 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -1,6 +1,6 @@ { "name": "@edoxen/browser", - "version": "0.9.0", + "version": "0.10.0", "description": "Astro-based browser for edoxen YAML data — drop in your data and ship a resolutions archive site.", "type": "module", "license": "BSD-2-Clause",