i18n-works 0.1.9 → 0.1.11
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/llms.txt +2 -2
- package/package.json +1 -1
package/llms.txt
CHANGED
|
@@ -78,7 +78,7 @@ useSyncExternalStore(subscribe, getVersion, getVersion);
|
|
|
78
78
|
- `setLocale(code)` is async and loads the catalogue for that code.
|
|
79
79
|
- If the build has module-level `t()` calls (outside any function), the locale is stored in `localStorage` (`i18n-works:locale`) and applied before any module runs (top-level await). `setLocale(code)` then saves the choice and reloads the page. Do not call `setLocale` at startup in that case, because it overwrites the saved choice. The build target must support top-level await.
|
|
80
80
|
- React memoized components (`memo`) must subscribe themselves, or they keep old text until their props change.
|
|
81
|
-
- Add a type declaration for `virtual:i18n-works` in a `.d.ts` file if TypeScript reports it missing. The example
|
|
81
|
+
- Add a type declaration for `virtual:i18n-works` in a `.d.ts` file if TypeScript reports it missing. The React example has one at `examples/react/src/i18n-works-virtual.d.ts`.
|
|
82
82
|
- `tpick`, `createLocaleLoader` and `resolveLocale` are also exported from the `i18n-works/tools` subpath, which holds only the browser-safe runtime helpers, so plugin code stays out of client bundles. Import `tpick` from there in client code. `tpick(variable, options, fallback = "other")` returns the option whose key equals the value of a single variable, for example `tpick({ status }, { online: t("Online"), other: t("Unknown") })`.
|
|
83
83
|
|
|
84
84
|
## Frameworks
|
|
@@ -223,4 +223,4 @@ npx vite-i18n browse --directory .i18n-works --list --json # stats report for
|
|
|
223
223
|
|
|
224
224
|
- Repository and full documentation: https://github.com/rand0mC0d3r/i18n-works
|
|
225
225
|
- Install script: https://github.com/rand0mC0d3r/i18n-works/blob/main/scripts/install-i18n-works.mjs
|
|
226
|
-
- Example app: https://github.com/rand0mC0d3r/i18n-works/tree/main/
|
|
226
|
+
- Example app: https://github.com/rand0mC0d3r/i18n-works/tree/main/examples/react
|