@rivinia/i18n 0.7.2 → 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +130 -1
- package/README.md +121 -1191
- package/fesm2022/rivinia-i18n-select.mjs +391 -0
- package/fesm2022/rivinia-i18n-select.mjs.map +1 -0
- package/fesm2022/rivinia-i18n-ui.mjs +2 -2
- package/fesm2022/rivinia-i18n-ui.mjs.map +1 -1
- package/package.json +10 -2
- package/types/rivinia-i18n-select.d.ts +149 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,103 @@
|
|
|
1
1
|
# @rivinia/i18n
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
From 1.0.0 this package follows **strict semver**: only a major may break, a new
|
|
4
|
+
config key, export, token or loader hook is a minor, and a patch never changes
|
|
5
|
+
what a page renders. The contract is wider than the export list: **the
|
|
6
|
+
`provideRiviniaI18n` config keys**, the pipe name (`rvTranslate`), **the loader
|
|
7
|
+
descriptor contract — including the `LoaderContext` a custom loader receives**,
|
|
8
|
+
the ICU placeholder rules, the `--rv-i18n-*` token names, and the declaration
|
|
9
|
+
shape `rivinia-i18n-keys` generates (`RiviniaI18nKeyRegistry`). Changing any of
|
|
10
|
+
those is a major; adding one is a minor. A new token is always additive — the
|
|
11
|
+
toggle and the picker read `var(--rv-i18n-<name>, var(--rv-<semantic>, <previous
|
|
12
|
+
value>))`.
|
|
13
|
+
|
|
14
|
+
Coming from 0.8.0: **nothing to do** — 1.0.0 removes no name and renames none.
|
|
15
|
+
The removals a consumer already met were in 0.6.0 (`RTranslatePipe` /
|
|
16
|
+
`rTranslate`), recorded below, and the freeze that fixed what ships is
|
|
17
|
+
[`docs/API-SURFACE-1.0.md`](https://github.com/abdelfattahqandil21-oss/Revinia/blob/main/docs/API-SURFACE-1.0.md).
|
|
18
|
+
The README is the start-here tier; everyday patterns and the reference live in
|
|
19
|
+
[`docs/i18n/`](https://github.com/abdelfattahqandil21-oss/Revinia/tree/main/docs/i18n),
|
|
20
|
+
one topic per page. This file keeps what a consumer of this package needs,
|
|
21
|
+
including the migration notes for 0.6.0 and 0.4.0.
|
|
22
|
+
|
|
23
|
+
## 1.0.0-rc.1
|
|
24
|
+
|
|
25
|
+
- **The optional `@rivinia/select` peer is now `^1.0.0-rc.1`** (it was `^0.7.0`, a
|
|
26
|
+
pre-1.0 caret so narrow that a select 0.8 or 1.0 conflicted with it). The range
|
|
27
|
+
admits every select 1.x release, the rc and the final alike, and excludes a 2.0 —
|
|
28
|
+
verified with `semver.satisfies` against the installed semver 7.8.5. Nothing
|
|
29
|
+
changes for an app that never imports `@rivinia/i18n/select`: the peer stays
|
|
30
|
+
`optional` in `peerDependenciesMeta`.
|
|
31
|
+
- **The toggle reads the theme's accent.** `--rv-accent` paints the focus ring
|
|
32
|
+
and the held-down fill (16% over the button's own background). Both read
|
|
33
|
+
`var(--rv-accent, currentColor)`, so a page that does not import
|
|
34
|
+
`@rivinia/theme` renders exactly as before (snapshot-proved).
|
|
35
|
+
- **Forced colors.** `@media (forced-colors: active)` switches the button to
|
|
36
|
+
`Canvas`/`CanvasText`, `Highlight`/`HighlightText` while held, and
|
|
37
|
+
`GrayText` at full opacity when disabled. While held, the focus ring is
|
|
38
|
+
`CanvasText` — a `Highlight` ring on the `Highlight` fill cannot be seen. The
|
|
39
|
+
toggle has no motion, so `prefers-reduced-motion` has nothing to reduce.
|
|
40
|
+
|
|
41
|
+
## 0.8.0 - 2026-10-31
|
|
42
|
+
|
|
43
|
+
The language picker: a third entry point, `@rivinia/i18n/select`, composed from
|
|
44
|
+
`@rivinia/select` instead of re-implementing a listbox. Additive — no core or `/ui`
|
|
45
|
+
signature changed, and no new dependency for consumers that do not import it.
|
|
46
|
+
|
|
47
|
+
- **`@rivinia/i18n/select` entry point.** Own FESM and types chunk, exported as
|
|
48
|
+
`exports["./select"]`. `@rivinia/select` (`^0.7.0`) is declared as an **optional**
|
|
49
|
+
peer: the core and `/ui` entry points never import it, so an application that does
|
|
50
|
+
not import `@rivinia/i18n/select` neither installs the peer nor pays for its code.
|
|
51
|
+
The core and `/ui` FESMs in this tarball are byte-identical to 0.7.2's.
|
|
52
|
+
- **`RiviniaLanguageSelect` (`rv-language-select`).** One trigger, one option per
|
|
53
|
+
configured language, in declared order, showing the native name. Managed
|
|
54
|
+
(`[manager]`, structurally satisfied by `RiviniaI18n`) or presentational
|
|
55
|
+
(`[languages]` + `[current]`); a manager wins over the presentational inputs. The
|
|
56
|
+
managed path goes through `setLanguageAsync()`, which never rejects, so the trigger
|
|
57
|
+
never keeps a failed pick: after a failure it falls back to the manager's current
|
|
58
|
+
language.
|
|
59
|
+
- **A later intent outvotes a switch still in flight.** Managed picks are
|
|
60
|
+
last-wins: resolving an older `setLanguageAsync()` after the user has picked again
|
|
61
|
+
emits nothing. That includes re-picking the language that is _currently_ current —
|
|
62
|
+
no manager call is made for it, but it still supersedes the pending switch, whose
|
|
63
|
+
confirmation must not surface as a change the user never asked for
|
|
64
|
+
(`projects/i18n/tests/language-select.spec.ts`, holds the manager's promise open and
|
|
65
|
+
re-picks the current language; it fails without the guard).
|
|
66
|
+
- **Each row name carries `lang` and `dir`.** `العربية` is pronounced as Arabic and
|
|
67
|
+
laid out right-to-left even while the page runs `en`; the language id is an
|
|
68
|
+
accessible hint when the native name differs from it. The closed trigger is
|
|
69
|
+
`rv-select`'s own value span and inherits the page language — the marking starts at
|
|
70
|
+
the panel (documented in the README).
|
|
71
|
+
- **`languageSelectOptions(languages)` and `LanguageSelectOption`.** The pure mapper
|
|
72
|
+
the component uses, exported for consumers who want `rv-select` with their own
|
|
73
|
+
trigger or row. It preserves order and resolves each name as `nativeName` →
|
|
74
|
+
`Intl.DisplayNames` → id, the same rule as `/ui`.
|
|
75
|
+
- **`RiviniaLanguageManager` and `LanguageLike` are re-exported** from this entry, so
|
|
76
|
+
a consumer importing only `/select` does not need `@rivinia/i18n/ui` on the side.
|
|
77
|
+
- **The picker owns a width floor.** The host is `inline-block` with
|
|
78
|
+
`min-inline-size: 14rem`. `rv-select`'s own `min-width: min(14rem, 100%)` cannot
|
|
79
|
+
supply it: inside a shrink-to-fit host that `100%` resolves to `0`, so a bare
|
|
80
|
+
`<rv-language-select [manager]="i18n" />` rendered the trigger, the panel and every
|
|
81
|
+
row one character wide, and `English` wrapped as `En / gli / sh`. Caught in the
|
|
82
|
+
packed build in a browser, not by a build or a test double; the `i18n-e2e` suite now
|
|
83
|
+
measures the host, the panel and the row line count in Chromium and Firefox, and both
|
|
84
|
+
geometry tests fail when the floor is removed.
|
|
85
|
+
- Packaging/build: the new entry consumes `@rivinia/select/ui` from dist, so
|
|
86
|
+
`build:select` runs before `build:i18n`. No new byte budget for anyone else: the
|
|
87
|
+
tarball grows by the `/select` FESM, its map and its types, and the pack gate checks
|
|
88
|
+
the built FESM — only `fesm2022/rivinia-i18n-select.mjs` may mention
|
|
89
|
+
`@rivinia/select/ui`.
|
|
90
|
+
- Proven end-to-end: 371 tests in 35 files; the repo's `i18n-e2e` Playwright suite
|
|
91
|
+
green (96 tests across Chromium, system Chrome and Firefox, four of them the new
|
|
92
|
+
`/select` page); two clean consumers built from the packed tarball — one without the
|
|
93
|
+
peer (its JS contains no select code at all) and one with the peer and a lazy route
|
|
94
|
+
(the picker lands in a 45.71 kB / 10.72 kB chunk, zero occurrences of
|
|
95
|
+
`rv-language-select` in the initial bundle); and a real-browser run of the packed
|
|
96
|
+
build in Chromium and Firefox, 30 checks each over a three-language `ar`/`en`/`de`
|
|
97
|
+
demo: rows' `lang`/`dir`, managed pick flipping `<html lang>` to the locale
|
|
98
|
+
(`de-DE`) and `dir`, a presentational pick leaving the manager untouched, and no
|
|
99
|
+
console, page or network errors. WebKit was **not run** — the host is missing
|
|
100
|
+
`libavif.so.16`, so MiniBrowser cannot launch.
|
|
4
101
|
|
|
5
102
|
## 0.7.2 - 2026-10-30
|
|
6
103
|
|
|
@@ -158,6 +255,23 @@ names were removed instead of carried to 1.0.
|
|
|
158
255
|
- **Behaviour:** none intended. The characterization test (`fallback-after-init`)
|
|
159
256
|
and the SSR smoke suite were added before the split and pass unchanged after it.
|
|
160
257
|
|
|
258
|
+
Migration from 0.5.0 — three names, and the core split is internal:
|
|
259
|
+
|
|
260
|
+
1. **The pipe is `rvTranslate`.** `RTranslatePipe` (`rTranslate`) was removed with
|
|
261
|
+
no alias to keep:
|
|
262
|
+
|
|
263
|
+
```html
|
|
264
|
+
<!-- before -->
|
|
265
|
+
{{ 'booking.seats' | rTranslate: { count: seats } }}
|
|
266
|
+
<!-- after -->
|
|
267
|
+
{{ 'booking.seats' | rvTranslate: { count: seats } }}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
2. **`languageChanged` is gone.** It was the same signal as `currentLanguage`;
|
|
271
|
+
switch your reads to `currentLanguage`.
|
|
272
|
+
3. **`loadTranslations(id, { silent })` is now `loadTranslations(id)`.** `silent`
|
|
273
|
+
never did anything — background loads are an internal concern.
|
|
274
|
+
|
|
161
275
|
## 0.5.0
|
|
162
276
|
|
|
163
277
|
The 0.4.0 code-review set. 0.4.1 was never published, so its fixes ship here;
|
|
@@ -245,6 +359,21 @@ The production-hardening release. Additive API; two behaviour changes.
|
|
|
245
359
|
Behaviour changes: `#` inside a plural uses the locale's digits
|
|
246
360
|
(`ar-EG`: `٣`), and an unresolved key warns once per session in dev mode.
|
|
247
361
|
|
|
362
|
+
Migration from 0.3.3 — everything below is additive; no export was removed and no
|
|
363
|
+
import path changed. Two behaviour changes are worth reading:
|
|
364
|
+
|
|
365
|
+
1. **`#` in a plural now uses the locale's digits.** It is formatted with
|
|
366
|
+
`Intl.NumberFormat(locale)` instead of the raw number, so a locale whose default
|
|
367
|
+
numbering system is not Latin (for example `ar-EG`) renders `٣` where it used to
|
|
368
|
+
render `3`. `en` and `ar` are unchanged.
|
|
369
|
+
2. **Missing keys warn in dev mode.** A key that resolves to nothing now logs
|
|
370
|
+
`[rivinia/i18n] missing key "…"` once per session when `isDevMode()` is true. Set
|
|
371
|
+
`warnOnMissingKey: false`, or pass `onMissingKey`, to control it.
|
|
372
|
+
|
|
373
|
+
The default loader is unchanged (`i18n/{language}.json`); `jsonLoader({ path:
|
|
374
|
+
'assets/i18n' })` keeps the old layout. The internal source layout moved
|
|
375
|
+
(models/services/utils/providers/pipes), but nothing under `src/` was ever exported.
|
|
376
|
+
|
|
248
377
|
## 0.3.0
|
|
249
378
|
|
|
250
379
|
- **Breaking:** the default `jsonLoader()` path is `i18n` (files in
|