@kopynator/core
v1.0.8
Published
Core agnostic logic for Kopynator SDKs
Readme
@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
npm install @kopynator/coreBasic Usage
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 }));