kotori 6.1.0 → 6.1.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 CHANGED
@@ -288,10 +288,8 @@ kotori({ primary: 'klingon', secondaries: ['zh'] }) // ❌ compile error
288
288
 
289
289
  ## Tips
290
290
 
291
- - If you plan to add new languages frequently, consider colocating all your dicts in a single file or multiple files in one folder. It is easier to copy the entire file and hand it to an AI to translate.
292
- - 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.
293
- - Both approaches are tree-shakeable — only the dicts imported by the current page are included in its bundle.
294
- - The `primary` language 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.
291
+ - If you plan to add new languages frequently, consider colocating all your dicts in a single file or multiple files in one folder. It is easier to copy the entire files and hand it to an AI to translate.
292
+ - 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.
295
293
 
296
294
  ## Roadmap
297
295
 
package/dist/index.d.cts CHANGED
@@ -235,13 +235,13 @@ declare const detectLanguage: <const T extends {
235
235
  secondaries: BCP47LanguageTagNameWithSubTag[];
236
236
  };
237
237
  }>(instance: T["config"]["primary"] | T["config"]["secondaries"][number] extends infer A ? {
238
- setLanguage: Parameters<T["setLanguage"]>[0] extends infer L ? L[] extends A[] ? A[] extends L[] ? (language: L) => void : "language param does not match primary or secondaries language types" : A : never;
238
+ setLanguage: Parameters<T["setLanguage"]>[0] extends infer L ? L[] extends BCP47LanguageTagNameWithSubTag[] ? A[] extends L[] ? (language: L) => void : "language param does not match primary or secondaries language types" : "language param does not match BCP47LanguageTagNameWithSubTag types" : never;
239
239
  config: {
240
240
  primary: T["config"]["primary"];
241
241
  secondaries: Exclude<BCP47LanguageTagNameWithSubTag, T["config"]["primary"]>[];
242
242
  };
243
243
  } : T, options?: {
244
244
  fallbackToSubtag?: boolean;
245
- }) => void;
245
+ }) => any;
246
246
  //#endregion
247
247
  export { BCP47LanguageTagNameWithSubTag, SubTags, Tags, detectLanguage, kotori };
package/dist/index.d.mts CHANGED
@@ -235,13 +235,13 @@ declare const detectLanguage: <const T extends {
235
235
  secondaries: BCP47LanguageTagNameWithSubTag[];
236
236
  };
237
237
  }>(instance: T["config"]["primary"] | T["config"]["secondaries"][number] extends infer A ? {
238
- setLanguage: Parameters<T["setLanguage"]>[0] extends infer L ? L[] extends A[] ? A[] extends L[] ? (language: L) => void : "language param does not match primary or secondaries language types" : A : never;
238
+ setLanguage: Parameters<T["setLanguage"]>[0] extends infer L ? L[] extends BCP47LanguageTagNameWithSubTag[] ? A[] extends L[] ? (language: L) => void : "language param does not match primary or secondaries language types" : "language param does not match BCP47LanguageTagNameWithSubTag types" : never;
239
239
  config: {
240
240
  primary: T["config"]["primary"];
241
241
  secondaries: Exclude<BCP47LanguageTagNameWithSubTag, T["config"]["primary"]>[];
242
242
  };
243
243
  } : T, options?: {
244
244
  fallbackToSubtag?: boolean;
245
- }) => void;
245
+ }) => any;
246
246
  //#endregion
247
247
  export { BCP47LanguageTagNameWithSubTag, SubTags, Tags, detectLanguage, kotori };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kotori",
3
- "description": "0.28kB Strongly-typed and tree-shakeable internationalization library for React",
4
- "version": "6.1.0",
3
+ "description": "0.29kB Strongly-typed and tree-shakeable internationalization library for React",
4
+ "version": "6.1.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",