fimo 0.3.3-staging.23 → 0.3.3-staging.24
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.
|
@@ -85,7 +85,19 @@ Read the active locale with `useLocale()` when component logic needs it:
|
|
|
85
85
|
```tsx
|
|
86
86
|
import { useLocale } from 'fimo/ui';
|
|
87
87
|
|
|
88
|
-
const { locale, defaultLocale, routePath } = useLocale();
|
|
88
|
+
const { locale, defaultLocale, locales, routePath, dir } = useLocale();
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`locales` lists every configured locale, so a language switcher needs no API call and no extra component:
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
const { locale, locales, routePath } = useLocale();
|
|
95
|
+
|
|
96
|
+
locales.map((code) => (
|
|
97
|
+
<FimoLink key={code} to={routePath} locale={code} aria-current={code === locale ? 'true' : undefined}>
|
|
98
|
+
{new Intl.DisplayNames([code], { type: 'language' }).of(code)}
|
|
99
|
+
</FimoLink>
|
|
100
|
+
));
|
|
89
101
|
```
|
|
90
102
|
|
|
91
103
|
## Custom Frameworks
|
package/dist/cli/bundle.json
CHANGED
package/package.json
CHANGED