@attraccess/plugins-frontend-ui 1.9.0 → 1.11.0-beta.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/README.md +40 -1
- package/index.js +2002 -2408
- package/lib/components/AlertStatusIcon.d.ts +6 -0
- package/lib/components/EmptyState.d.ts +5 -0
- package/lib/components/LabeledSwitch.d.ts +11 -0
- package/lib/components/StandardDrawer.d.ts +12 -0
- package/lib/components/StandardModal.d.ts +21 -0
- package/lib/components/StatusAlert.d.ts +9 -0
- package/lib/components/attraccess-user/AttraccessUser.d.ts +3 -2
- package/lib/components/attraccess-user/AttraccessUserActionsContext.d.ts +2 -2
- package/lib/components/button/index.d.ts +3 -0
- package/lib/components/delete-confirmation-modal/index.d.ts +10 -0
- package/lib/components/index.d.ts +13 -0
- package/lib/components/loading-indicator/index.d.ts +4 -0
- package/lib/components/page-header/actions.d.ts +39 -0
- package/lib/components/page-header/index.d.ts +18 -0
- package/lib/components/password-input/PasswordInput.d.ts +15 -0
- package/lib/components/status-dialog/index.d.ts +33 -0
- package/lib/components/string-list-field/StringListField.d.ts +25 -0
- package/lib/components/user-search/UserSearch.d.ts +3 -4
- package/lib/components/user-search/UserSearch.utils.d.ts +3 -3
- package/lib/hooks/dateTimePreferences.d.ts +5 -0
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/useFormatDateTime.d.ts +1 -0
- package/lib/hooks/useFormatDuration.d.ts +2 -2
- package/lib/i18n.d.ts +17 -2
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
# plugins-frontend-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared frontend components and internationalization for the core and plugins.
|
|
4
|
+
|
|
5
|
+
## Plugin translations
|
|
6
|
+
|
|
7
|
+
Use `useTranslations` with plugin-owned English and German catalogs. The hook
|
|
8
|
+
subscribes to the core language store, so already-mounted pages, forms and slot
|
|
9
|
+
contributions update when the user selects a language in Attraccess.
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { useTranslations } from '@attraccess/plugins-frontend-ui';
|
|
13
|
+
import en from './en.json';
|
|
14
|
+
import de from './de.json';
|
|
15
|
+
|
|
16
|
+
const translations = { en, de };
|
|
17
|
+
|
|
18
|
+
export function DevicesPage() {
|
|
19
|
+
const { t, language } = useTranslations(translations);
|
|
20
|
+
return <h1>{t('devices.title')}</h1>;
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Catalog strings support Handlebars interpolation (`{{name}}`) and plural
|
|
25
|
+
objects (`{ "one": "One device", "many": "{{count}} devices" }`). Missing German
|
|
26
|
+
keys fall back to English. Use the returned `language` for locale-dependent
|
|
27
|
+
date and number formatting. Translate labels and explanatory text; retain
|
|
28
|
+
user-entered names, identifiers and protocol values.
|
|
29
|
+
|
|
30
|
+
The host and plugin federation configurations must share
|
|
31
|
+
`@attraccess/plugins-frontend-ui`. The official plugin build helper configures
|
|
32
|
+
this as a host-owned singleton with no remote fallback. Bundling a private
|
|
33
|
+
copy would create a separate language store. Plugins should not call
|
|
34
|
+
`detectAndSetLanguage` or persist an independent language preference: the core
|
|
35
|
+
owns detection and selection. Supported personal choices and browser languages
|
|
36
|
+
take precedence over the configured system default. The system default is the
|
|
37
|
+
fallback when neither has an English or German translation. Detection does not
|
|
38
|
+
persist a fallback as a personal choice.
|
|
39
|
+
|
|
40
|
+
Explicit selections are retained in memory when browser storage is unavailable.
|
|
41
|
+
Detection and system fallback resolution update the displayed language without
|
|
42
|
+
marking it as an explicit preference.
|
|
4
43
|
|
|
5
44
|
## Running unit tests
|
|
6
45
|
|