Registry / data / l10n-tools-compiler-json

l10n-tools-compiler-json

JSON →
library7.0.10jsnpmunverified

A JSON compiler for the l10n-tools i18n pipeline, targeting formats like vue-i18n, node-i18n, and i18next. Current stable version is 7.0.10, updated as part of a monorepo with active releases. It depends on l10n-tools-core ^8.0.0 as a peer dependency and requires Node.js >=22.19.0. Compared to other l10n compilers, it is specifically designed to integrate with the l10n-tools ecosystem, providing a unified workflow for extracting, compiling, and syncing translations.

npm install l10n-tools-compiler-json
INSTALL
IMPORT
SIG · L10N-TOOLS-COMPILE
L
l10n-tools-compiler-json
datajavascriptv7.0.10
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import compileJson from 'l10n-tools-compiler-json'
const compileJson = require('l10n-tools-compiler-json')
Package is ESM-only; CJS require will fail with MODULE_NOT_FOUND.
compileJson
import { compileJson } from 'l10n-tools-compiler-json'
import compileJson from 'l10n-tools-compiler-json/compile'
Named export is available for tree-shaking; avoid deep imports as they may break in future versions.
CompilerOptions
import type { CompilerOptions } from 'l10n-tools-compiler-json'
TypeScript types are shipped; use `import type` to avoid runtime overhead.

Compiles a JSON locale object into vue-i18n formatted output using the compileJson function.

import { compileJson } from 'l10n-tools-compiler-json'; const source = { en: { greeting: 'Hello' }, fr: { greeting: 'Bonjour' } }; const options = { format: 'vue-i18n', namespace: 'common' }; compileJson(source, options) .then(result => console.log(JSON.stringify(result, null, 2))) .catch(err => console.error(err));
Debug
Known issues
breakingPackage requires Node.js >=22.19.0. Older versions will fail to install or run.
fix
Upgrade Node.js to v22.19.0 or later.
affects: <7.0.0
gotchal10n-tools-compiler-json is ESM-only. It cannot be imported via require() in CommonJS modules.
fix
Use dynamic import() if needed: const { compileJson } = await import('l10n-tools-compiler-json').
affects: >=7.0.0
deprecatedThe `format: 'i18next'` option will be removed in v8. Use `format: 'i18next-v4'` instead.
fix
Replace 'i18next' with 'i18next-v4' in the options.
affects: >=7.0.0 <8.0.0
Errors
Common errors & fixes
Error: Cannot find module 'l10n-tools-compiler-json'
Package is not installed or Node.js version is below 22.19.0.
fix
Run `npm install l10n-tools-compiler-json` and ensure Node.js >=22.19.0.
TypeError: compileJson is not a function
Trying to use the default export as a named import, or vice versa.
fix
Use `import compileJson from 'l10n-tools-compiler-json'` for default export or `import { compileJson }` for named export.
Error [ERR_REQUIRE_ESM]: require() of ES Module
Using CommonJS require() to import an ESM-only package.
fix
Switch to ESM (use import) or use dynamic import: const { compileJson } = await import('l10n-tools-compiler-json').
Upgrade
Version history
7.0.10latest on npm
Audit
Dependencies
l10n-tools-corerequiredPeer dependency providing core compilation and pipeline logic
Agent activity
4 hits · last 30 days
node
4
Resources
l10n-tools-compiler-json — npm install l10n-tools-compiler-json · libregistry