kotori 5.0.0 → 5.0.2
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 +2 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ t(intro, { name: 'John', time: '12-00' })
|
|
|
42
42
|
- No JSON
|
|
43
43
|
- No dependencies
|
|
44
44
|
- No build step
|
|
45
|
-
- 0.
|
|
45
|
+
- 0.31kB minified and gzipped
|
|
46
46
|
- Modular and tree-shakeable
|
|
47
47
|
- Language change in one page rerenders all pages
|
|
48
48
|
- Variables typed and inferred from string literals — no more string typos
|
|
@@ -201,14 +201,13 @@ React hook. Returns the current language tag as a reactive value. Updates when `
|
|
|
201
201
|
|
|
202
202
|
## Language Tags
|
|
203
203
|
|
|
204
|
-
kotori uses [BCP 47](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry) language tags. Both subtags (`en`, `zh`) and full tags (`en-US`, `zh-
|
|
204
|
+
kotori uses [BCP 47](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry) language tags. Both subtags (`en`, `zh`) and full tags (`en-US`, `zh-CN`) are accepted and validated at the type level.
|
|
205
205
|
|
|
206
206
|
## Tips
|
|
207
207
|
|
|
208
208
|
- If you plan to add new languages frequently, consider colocating all your dicts in a single file. It is easier to copy the entire file and hand it to an AI to translate.
|
|
209
209
|
- If your supported languages are fixed, consider splitting dicts by page or component. Translations stay close to the code that uses them and are easier to maintain. This approach also pairs well with TypeScript — every time you add a new language, type errors will guide you to every dict that needs updating.
|
|
210
210
|
- Both approaches are tree-shakeable — only the dicts imported by the current page are included in its bundle.
|
|
211
|
-
- The `primaryLanguageTag` is the source of truth for variable inference and validation. Write your primary language strings carefully — a variable rename in the primary string becomes a compile error across every secondary language, which is intentional.
|
|
212
211
|
|
|
213
212
|
## Roadmap
|
|
214
213
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kotori",
|
|
3
3
|
"description": "Strongly-typed and composable internationalization library for React",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.2",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"setup": "rm -rf node_modules && npm i && git init && husky",
|
|
7
7
|
"prepublishOnly": "npm i && npx tsc && npm run build",
|