hazo_ui 6.12.5 → 6.14.0

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/CHANGE_LOG.md CHANGED
@@ -5,6 +5,96 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## v6.14.0 (2026-10-04)
9
+
10
+ ### Added — German (`de`) catalog and LocalePicker demo
11
+
12
+ - New `src/locales/de.json`: German translation of all 219 keys in `en.json`
13
+ (flat dotted keys, identical key set, every `{{placeholder}}` preserved
14
+ verbatim). Consumers register it through hazo_i18n alongside `en`; the package
15
+ does not bundle non-English catalogs into `dist/`.
16
+ - The German catalog was produced with the hazo_i18n pipeline, not by hand:
17
+ `translateMessages()` (export, then Gemini via `hazo_llm_api` per chunk, then
18
+ `importMessages()` with ICU/HTML/expansion validation). 9 chunks, 0 failed,
19
+ 0 rejected. 14 non-blocking length-expansion warnings on very short strings
20
+ (e.g. `Save` to `Speichern`) were accepted; no translation was changed by hand.
21
+ - Rationale: German is the first non-English catalog for hazo_ui, and it exercises
22
+ the hazo_i18n export/LLM/import round trip on a real package catalog.
23
+ - Test-app: new `/locale-picker` page demoing `LocalePicker` (dropdown, compact and
24
+ inline variants; native, native+code and code display; flags) with real locale
25
+ alternates. Alternates point at a new `/set-locale` route that sets the
26
+ `NEXT_LOCALE` cookie and redirects back.
27
+ - Test-app `i18n_runtime.ts` now registers the hazo_ui `en` and `de` catalogs under
28
+ the `hazo_ui` namespace, so hazo_ui components switch language in the test-app
29
+ through `HazoUiI18nProvider`. Previously they stayed English.
30
+
31
+ ### Fixed — dialog re-render loop on open
32
+
33
+ - `HazoUiMultiFilterDialog` and `HazoUiMultiSortDialog` defaulted `initialFilters` /
34
+ `initialSortFields` to a fresh `[]` each render. Their open-time sync effect depends
35
+ on that prop, so every render reset state to a new array and looped until React
36
+ threw `RangeError: Invalid array length`. Defaults now reference a module-level
37
+ empty constant.
38
+ - `filter_dialog_i18n.test.tsx`: the "explicit title wins" assertion queried
39
+ `getByText("Filter")`, which matched the still-mounted trigger button; it now asserts
40
+ no heading named "Filter".
41
+
42
+ ## v6.13.1 (2026-10-03)
43
+
44
+ ### Fixed — remaining hardcoded English strings now go through i18n
45
+
46
+ - Wired the last user-facing strings that bypassed `useHazoUiT()`: RTE output
47
+ tabs (HTML / Plain Text / Raw HTML), RTE `(empty)` fallbacks, RTE link
48
+ placeholder, kanban filter `Clear`, kanban card edit aria-label, browser tab
49
+ close aria-label, notification unread-count aria-label, canvas text toolbar
50
+ font options (Sans / Serif / Mono), and markdown editor upload placeholder.
51
+ - New en.json keys: `rte.tab_html`, `rte.tab_plain_text`, `rte.tab_raw_html`,
52
+ `rte.empty_content`, `rte.link_placeholder`, `kanban.clear`,
53
+ `browser_tab.close_aria`, `notification.unread_count`, `canvas_toolbar.font_sans`,
54
+ `canvas_toolbar.font_serif`, `canvas_toolbar.font_mono`,
55
+ `markdown.upload_placeholder`.
56
+ - `hazo_browser_tab` and `notification_count_badge` now call `useHazoUiT()`.
57
+ - Proper nouns (font family names), the `x` table-size separator and file-size
58
+ units are intentionally left untranslated.
59
+
60
+ ## v6.13.0 (2026-10-03)
61
+
62
+ ### Added — locale-aware i18n via `HazoUiI18nProvider`
63
+
64
+ - `HazoUiI18nProvider` + `useHazoUiT()` (and types `HazoUiTFunction`,
65
+ `HazoUiI18nProviderProps`) are exported from the package root. The app mounts
66
+ the provider under `<HazoI18nProvider>` and passes a locale-aware `t`, e.g.
67
+ `useTranslations("hazo_ui")` from `hazo_i18n/client`. Same pattern as
68
+ hazo_auth's `HazoAuthProvider` `t` prop.
69
+ - `defaultHazoUiT` exported for non-React callers (English, not locale-aware).
70
+ - `permissionToast()` accepts an optional `t` option (defaults to English).
71
+
72
+ ### Fixed — hazo_ui rendered English in every locale
73
+
74
+ - v6.12.x wired strings through `createPackageT`, which is locale-blind: every
75
+ component read the bundled English catalog regardless of the active locale.
76
+ Components now call `useHazoUiT()`, which returns the app-supplied locale
77
+ under a provider and the English catalog otherwise.
78
+ - Missing keys in the active locale fall back to English per key (logged via
79
+ the hazo_ui logger) instead of throwing hazo_i18n's dev-mode error.
80
+
81
+ ### Changed
82
+
83
+ - All 34 i18n-wired components use `useHazoUiT()` in the component body;
84
+ no module-level `t`. Prop defaults that used `t()` now resolve in the body
85
+ (`prop ?? t(key)`) — the public prop names are unchanged.
86
+ - Helpers that need translation take `t` explicitly: `validateInput`
87
+ (flex_input), `auto_detect_fields` and `default_announcements` (kanban),
88
+ `renderErrorState` (table).
89
+ - Without a provider, output is unchanged (English).
90
+
91
+ ### Test-app
92
+
93
+ - `test-app/components/hazo_ui_i18n_root.tsx` bridges `useTranslations("hazo_ui")`
94
+ into the provider; mounted in the root layout.
95
+ - `src/contexts/__tests__/hazo_ui_i18n.test.tsx` covers app-supplied locale,
96
+ per-key English fallback, and the no-provider default.
97
+
8
98
  ## v6.12.5 (2026-10-03)
9
99
 
10
100
  ### Changed — i18n string wiring (remaining hardcoded strings)
package/README.md CHANGED
@@ -83,7 +83,24 @@ The `tw-animate-css` import replaces the legacy `tailwindcss-animate` plugin (us
83
83
 
84
84
  ## Internationalisation
85
85
 
86
- All built-in user-facing strings (dialogs, form inputs, rich text toolbar, sort dialog, kanban, loading/error states, kanban editor, markdown editor, image cropper, memory dropdown, celebration, date-range selector, etc.) resolve through `createPackageT("hazo_ui", en)` from `hazo_core/i18n`. The English catalogue lives in `src/locales/en.json` (207 keys). Prop defaults for labels resolve as `prop ?? t(key)`, so explicit props always override translations. Other locales are generated through `hazo_i18n` (see the test-app `/translations` page).
86
+ All built-in user-facing strings resolve through a `t` function from `useHazoUiT()`. The English catalogue lives in `src/locales/en.json`, and `createPackageT("hazo_ui", en)` from `hazo_core/i18n` is the English fallback. Prop defaults for labels resolve as `prop ?? t(key)`, so explicit props always override translations.
87
+
88
+ To render another locale, mount `HazoUiI18nProvider` under your hazo_i18n provider and pass a locale-aware `t` (same pattern as hazo_auth's provider):
89
+
90
+ ```tsx
91
+ import { HazoI18nProvider, useTranslations } from "hazo_i18n/client";
92
+ import { HazoUiI18nProvider } from "hazo_ui";
93
+
94
+ function HazoUiI18nRoot({ children }: { children: React.ReactNode }) {
95
+ const t = useTranslations("hazo_ui");
96
+ return <HazoUiI18nProvider t={t}>{children}</HazoUiI18nProvider>;
97
+ }
98
+
99
+ // In your root layout, inside <HazoI18nProvider locale={locale} messages={messages}>:
100
+ <HazoUiI18nRoot>{children}</HazoUiI18nRoot>
101
+ ```
102
+
103
+ Without a provider, every component renders English. A key missing from the active locale falls back to English for that key. Other locales are generated through `hazo_i18n` (see the test-app `/translations` page).
87
104
 
88
105
  ## Color Configuration
89
106