kotori 2.0.0 → 2.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 +1 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -162,39 +162,9 @@ export const Page2 = () => {
|
|
|
162
162
|
}
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
-
## How It Works
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
### One `kotori` instance per app
|
|
170
|
-
|
|
171
|
-
`kotori` holds the language state. All `createT` calls share that state — changing the language anywhere rerenders everywhere.
|
|
172
|
-
|
|
173
|
-
### One `createT` per page/component/feature
|
|
174
|
-
|
|
175
|
-
Translations are colocated with the component that uses them. Bundlers naturally code-split them, so each page only loads what it needs.
|
|
176
|
-
|
|
177
|
-
### Variables are inferred from string literals
|
|
178
|
-
|
|
179
|
-
kotori parses `{{variable}}` at the type level. No separate type definitions needed — the string *is* the schema.
|
|
180
|
-
|
|
181
|
-
```ts
|
|
182
|
-
// primary string drives the contract
|
|
183
|
-
const greeting = dict({ en: 'Hi {{name}}', zh: '你好 {{name}}' })
|
|
184
|
-
// ^^^^^^ — inferred as required arg
|
|
185
|
-
|
|
186
|
-
// secondary strings are validated against it
|
|
187
|
-
const mismatch = dict({ en: 'Hi {{name}}', zh: '你好 {{other}}' })
|
|
188
|
-
// ^^^^^^^ — compile error
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Custom argument types
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
165
|
## API
|
|
196
166
|
|
|
197
|
-

|
|
198
168
|
|
|
199
169
|
### `kotori(options)`
|
|
200
170
|
|
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": "2.0.
|
|
4
|
+
"version": "2.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",
|