@better-i18n/core 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/README.md +32 -22
  2. package/package.json +2 -3
package/README.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  Framework-agnostic core utilities for fetching translations from Better i18n CDN.
4
4
 
5
+ ## Features
6
+
7
+ - **Framework Agnostic** - Works with any JavaScript runtime
8
+ - **Edge-Ready** - Optimized for edge environments (Cloudflare, Vercel, etc.)
9
+ - **Type-Safe** - Full TypeScript support
10
+ - **Cached** - Built-in manifest caching with configurable TTL
11
+
5
12
  ## Installation
6
13
 
7
14
  ```bash
@@ -13,26 +20,26 @@ bun add @better-i18n/core
13
20
  ## Usage
14
21
 
15
22
  ```typescript
16
- import { createI18nCore } from '@better-i18n/core'
23
+ import { createI18nCore } from "@better-i18n/core";
17
24
 
18
25
  const i18n = createI18nCore({
19
- project: 'your-org/your-project',
20
- defaultLocale: 'en',
21
- })
26
+ project: "your-org/your-project",
27
+ defaultLocale: "en",
28
+ });
22
29
 
23
30
  // Fetch messages for a locale
24
- const messages = await i18n.getMessages('en')
31
+ const messages = await i18n.getMessages("en");
25
32
 
26
33
  // Get available locales
27
- const locales = await i18n.getLocales()
28
- // ['en', 'tr', 'de', ...]
34
+ const locales = await i18n.getLocales();
35
+ // ["en", "tr", "de", ...]
29
36
 
30
37
  // Get language options with metadata (for UI)
31
- const languages = await i18n.getLanguages()
32
- // [{ code: 'en', name: 'English', nativeName: 'English', flagUrl: '...' }, ...]
38
+ const languages = await i18n.getLanguages();
39
+ // [{ code: "en", name: "English", nativeName: "English", flagUrl: "..." }, ...]
33
40
 
34
41
  // Get manifest
35
- const manifest = await i18n.getManifest()
42
+ const manifest = await i18n.getManifest();
36
43
  ```
37
44
 
38
45
  ## Configuration
@@ -40,26 +47,29 @@ const manifest = await i18n.getManifest()
40
47
  ```typescript
41
48
  interface I18nCoreConfig {
42
49
  // Required
43
- project: string // "org/project" format
44
- defaultLocale: string // e.g., "en"
50
+ project: string; // "org/project" format
51
+ defaultLocale: string; // e.g., "en"
45
52
 
46
53
  // Optional
47
- cdnBaseUrl?: string // default: "https://cdn.better-i18n.com"
48
- manifestCacheTtlMs?: number // default: 300000 (5 minutes)
49
- debug?: boolean // default: false
50
- logLevel?: LogLevel // default: "warn"
51
- fetch?: typeof fetch // custom fetch function
54
+ cdnBaseUrl?: string; // default: "https://cdn.better-i18n.com"
55
+ manifestCacheTtlMs?: number; // default: 300000 (5 minutes)
56
+ debug?: boolean; // default: false
57
+ logLevel?: LogLevel; // default: "warn"
58
+ fetch?: typeof fetch; // custom fetch function
52
59
  }
53
60
  ```
54
61
 
55
- ## Used By
62
+ ## Framework Integrations
56
63
 
57
64
  This package is the foundation for:
58
65
 
59
- - `@better-i18n/next` - Next.js integration
60
- - `@better-i18n/use-intl` - TanStack/React integration
61
- - `@better-i18n/i18next-backend` - i18next backend plugin
66
+ - `@better-i18n/next` - Next.js integration with ISR support
67
+ - `@better-i18n/react` - React/TanStack integration (coming soon)
68
+
69
+ ## Documentation
70
+
71
+ Full documentation available at [docs.better-i18n.com](https://docs.better-i18n.com)
62
72
 
63
73
  ## License
64
74
 
65
- MIT
75
+ MIT © [Better i18n](https://better-i18n.com)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-i18n/core",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Framework-agnostic core utilities for Better i18n",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -11,7 +11,7 @@
11
11
  "bugs": {
12
12
  "url": "https://github.com/better-i18n/better-i18n/issues"
13
13
  },
14
- "homepage": "https://github.com/better-i18n/better-i18n/tree/main/packages/i18n-core",
14
+ "homepage": "https://github.com/better-i18n/better-i18n/tree/main/packages/core",
15
15
  "type": "module",
16
16
  "main": "./dist/index.js",
17
17
  "types": "./dist/index.d.ts",
@@ -43,7 +43,6 @@
43
43
  "clean": "rm -rf dist"
44
44
  },
45
45
  "devDependencies": {
46
- "@better-i18n/typescript-config": "workspace:*",
47
46
  "@types/node": "^20.0.0",
48
47
  "typescript": "~5.9.2"
49
48
  }