open-index/open-npm huggingface dataset:
npm package: @kopynator/core
Description: Core agnostic logic for Kopynator SDKs
Latest version: 2.0.0

# @kopynator/core

The agnostic core engine for the Kopynator i18n platform.

## Features
- **Zero Dependencies**: Lightweight and fast.
- **ICU Pluralization**: `{n, plural, =0 {None} =1 {One} other {# items}}`.
- **Variable Interpolation**: `Hello {{name}}`.
- **Intelligent Caching**: Syncs with `localStorage` (Web) or uses Memory (Node).
- **Agnostic**: Works in Browser, React, Vue, Angular, Node.js, and more.

## Installation
```bash
npm install @kopynator/core
```

## Basic Usage
```typescript
import { Kopynator } from '@kopynator/core';

const kopy = new Kopynator({
  apiKey: 'YOUR_PROJECT_TOKEN',
  projectId: 'YOUR_PROJECT_ID',
  defaultLocale: 'en'
});

await kopy.init();

// Simple translation
console.log(kopy.t('welcome_message'));

// Interpolation
console.log(kopy.t('greeting', { name: 'Carlos' }));

// Pluralization
console.log(kopy.t('inbox_count', { n: 5 }));
```
npm package: @kopynator/node
Description: Node.js wrapper for Kopynator
Latest version: 1.0.2

# @kopynator/node

Node.js wrapper for the Kopynator i18n platform. Includes Express middleware support.

## Features
- **Express Middleware**: Auto-detects locale from headers or query params.
- **Server-Side**: Fetch translations for CLI tools, CRON jobs, or APIs.
- **TypeScript**: Full type safety for your configuration and translations.

## Installation
```bash
npm install @kopynator/core @kopynator/node
```

## Usage

### 1. With Express
The middleware automatically attaches the `t` function to the request object.

```typescript
import { createKopyNode } from '@kopynator/node';
import express from 'express';

const app = express();

const kopyNode = createKopyNode({
  apiKey: 'YOUR_API_KEY',
  defaultLocale: 'en',
  mode: 'live'
});

// Load initial translations
await kopyNode.init();

app.use(kopyNode.middleware());

app.get('/', (req, res) => {
  // Use the auto-detected locale helper
  const title = req.t('welcome_message');
  res.send(`<h1>${title}</h1>`);
});
```

#### Locale Detection Logic
The middleware checks for locale in the following order:
1.  **Query Parameter**: `?lang=es`
2.  **Header**: `Accept-Language` (extracts the first language)
3.  **Default**: Falls back to `defaultLocale` from config.

### 2. General Node.js Usage
For scripts or other frameworks:

```typescript
import { createKopyNode } from '@kopynator/node';

const kopy = createKopyNode({ apiKey: '...', defaultLocale: 'en' });
await kopy.init();

console.log(kopy.t('greeting'));
```

#### Configuration Options

| Option | Type | Description |
|---|---|---|
| `apiKey` | `string` | **Required**. Your public project token. |
| `defaultLocale` | `string` | **Required**. The fallback language. |
| `mode` | `'local' \| 'live'` | Determines how translations are loaded. |
npm package: @kopynator/react
Description: React wrapper for the Kopynator i18n platform. Works with React 18+ and supports SSR (Next.js/Remix).
Latest version: 1.0.2

# @kopynator/react

React wrapper for the Kopynator i18n platform. Works with React 18+ and supports SSR (Next.js/Remix).

## Features
- **Context API**: Access translations anywhere in your component tree.
- **Hooks-based**: Easy to use with the `useKopy` hook.
- **SSR Ready**: Safe to use in server-side rendering environments.

## Installation
```bash
npm install @kopynator/core @kopynator/react
```

## Usage

### 1. Configuration
Wrap your application with the `KopyProvider`:

```tsx
import { KopyProvider } from '@kopynator/react';

const config = {
  apiKey: 'YOUR_API_KEY', // Get it from https://www.kopynator.com
  defaultLocale: 'en',
  mode: 'hybrid', // 'local' | 'hybrid' | 'live'
  languages: ['en', 'es']
};

function App() {
  return (
    <KopyProvider config={config}>
      <MyComponent />
    </KopyProvider>
  );
}
```

#### Configuration Options

| Option | Type | Description |
|---|---|---|
| `apiKey` | `string` | **Required**. Your public project token found at [kopynator.com](https://www.kopynator.com). |
| `defaultLocale` | `string` | **Required**. The fallback language if no other is detected (e.g. 'en'). |
| `languages` | `string[]` | **Required for 'local' mode**. Array of supported language codes. |
| `mode` | `'local' \| 'hybrid' \| 'live'` | Determines how translations are loaded. |

### 2. In Components
Use the `useKopy` hook to access translation functions:

```tsx
import { useKopy } from '@kopynator/react';

function MyComponent() {
  const { t, setLocale, isReady } = useKopy();

  if (!isReady) return <p>Loading...</p>;

  return (
    <div>
      <h1>{t('welcome_title')}</h1>
      <p>{t('greeting', { name: 'User' })}</p>
      
      <button onClick={() => setLocale('es')}>Español</button>
      <button onClick={() => setLocale('en')}>English</button>
    </div>
  );
}
```

#### Loading Modes

1.  **`local`**: Offline First. Only loads JSON files from your local assets.
2.  **`live`**: Cloud First. Fetches the latest translations directly from Kopynator CDN.
3.  **`hybrid`** (Recommended): Best of Both Worlds. Loads local files instantly, then updates from Cloud in the background.
npm package: @kopynator/vue
Description: Vue.js wrapper for the Kopynator i18n platform. Works with Vue 3 (Composition API).
Latest version: 1.0.2

# @kopynator/vue

Vue.js wrapper for the Kopynator i18n platform. Works with Vue 3 (Composition API).

## Features
- **Composition API**: Full support for `useKopy` hook.
- **Global Helper**: Access `$t` in any template.
- **Reactive**: Updates automatically when the locale changes.

## Installation
```bash
npm install @kopynator/core @kopynator/vue
```

## Usage

### 1. Configuration
In your `main.ts` or `main.js`:

```typescript
import { createApp } from 'vue';
import { createKopy } from '@kopynator/vue';
import App from './App.vue';

const app = createApp(App);

const kopy = createKopy({
  apiKey: 'YOUR_API_KEY', // Get it from https://www.kopynator.com
  defaultLocale: 'en',
  mode: 'hybrid', // 'local' | 'hybrid' | 'live'
  languages: ['en', 'es']
});

app.use(kopy);
app.mount('#app');
```

#### Configuration Options

| Option | Type | Description |
|---|---|---|
| `apiKey` | `string` | **Required**. Your public project token found at [kopynator.com](https://www.kopynator.com). |
| `defaultLocale` | `string` | **Required**. The fallback language if no other is detected (e.g. 'en'). |
| `languages` | `string[]` | **Required for 'local' mode**. Array of supported language codes. |
| `mode` | `'local' \| 'hybrid' \| 'live'` | Determines how translations are loaded. |

### 2. In Templates
You can use the global `$t` function directly in templates:

```html
<template>
  <h1>{{ $t('welcome_title') }}</h1>
  <p>{{ $t('greeting', { name: 'User' }) }}</p>
</template>
```

### 3. In Setup Script
Use the `useKopy` hook for more control:

```html
<script setup>
import { useKopy } from '@kopynator/vue';

const { t, isReady } = useKopy();
</script>

<template>
  <div v-if="isReady">
    <h1>{{ t('hero_title') }}</h1>
  </div>
  <div v-else>Loading translations...</div>
</template>
```

#### Loading Modes

1.  **`local`**: Offline First. Only loads JSON files from your local assets.
2.  **`live`**: Cloud First. Fetches the latest translations directly from Kopynator CDN.
3.  **`hybrid`** (Recommended): Best of Both Worlds. Loads local files instantly, then updates from Cloud in the background.
npm package: @kopz/vue-npm
Description: ## Project setup ``` npm install ```
Latest version: 0.1.0

# vue-npm

## Project setup
```
npm install
```

### Compiles and hot-reloads for development
```
npm run serve
```

### Compiles and minifies for production
```
npm run build
```

### Lints and fixes files
```
npm run lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).