@pico-intl-dev/core
v1.0.7
Published
Zero lock-in, framework-independent i18n core with zero runtime dependencies
Downloads
164
Maintainers
Readme
@pico-intl-dev/core
Framework-independent i18n core runtime for pico-intl.
Status: stable v1. The core runtime is covered by E2E tests, integration tests, package readiness checks, release coverage gates, and published npm adoption fixtures.
Install
npm install @pico-intl-dev/coreBasic usage
import { createI18n } from '@pico-intl-dev/core';
const i18n = createI18n({
base: 'en',
locale: 'en',
messages: {
greeting: 'Hello, {{name}}',
items: '{{count}} item | {{count}} items',
},
});
i18n.t('greeting', { name: 'Ana' });
i18n.t('items', { count: 3 });Message formatting
pico-intl core supports ICU-lite formatting for common app copy:
| Use case | Syntax |
| --- | --- |
| Interpolation | Hello, {{name}} |
| Plural | {{count}} item \| {{count}} items |
| Select | {{role, select, admin{Admin} user{User} other{Guest}}} |
| Number | {value, number} |
| Currency | {price, number, ::currency/USD} |
| Date | {date, date, ::yMMMd} |
| Time | {time, time, ::hm} |
Double braces interpolate values as text. Single braces with a type, such as
{price, number, ::currency/USD}, run native Intl formatting.
See message formatting for examples and ICU strategy for the exact support boundary.
Entry points
Use subpath exports when you only need part of the runtime:
import { createI18n } from '@pico-intl-dev/core/runtime';
import { detectLocale } from '@pico-intl-dev/core/detect';
import { formatDate } from '@pico-intl-dev/core/format';
import { getTextDirection } from '@pico-intl-dev/core/rtl';
import { createLocalStorageAdapter } from '@pico-intl-dev/core/storage';Available subpaths:
| Subpath | Purpose |
| --- | --- |
| @pico-intl-dev/core | Full public surface |
| @pico-intl-dev/core/runtime | createI18n, interpolation, plural/select helpers |
| @pico-intl-dev/core/detect | Locale detection and Accept-Language parsing |
| @pico-intl-dev/core/format | Number, date, relative, and list formatting helpers |
| @pico-intl-dev/core/http | HTTP/CDN locale loader |
| @pico-intl-dev/core/namespace | Namespace helpers and lazy namespace loader |
| @pico-intl-dev/core/rtl | Direction helpers |
| @pico-intl-dev/core/storage | Locale persistence adapters |
Production notes
- The package has zero runtime dependencies.
- Bundle size depends on import path and bundler tree-shaking. Run
npm run benchfrom the repo root for local measurements. - Message formatting is intentionally ICU-lite, not full FormatJS parity. See message formatting and ICU strategy.
- Use react-intl/FormatJS today if you need full MessageFormat behavior, rich text formatting, message descriptors, exact plural selectors, or nested ICU message trees.
Verification
npm run build:core
npm test
npm run bench