fluent-transpiler is a build-time tool that compiles Fluent (.ftl) localization files into optimized, tree-shakable JavaScript ES modules. Current stable version is 0.4.1. It supports single and multiple locales, allows selective message inclusion/exclusion, and offers variable naming conventions (camelCase, PascalCase, etc.). Unlike runtime i18n libraries like @fluent/react or react-intl, fluent-transpiler produces zero-runtime code, ideal for modern bundlers with tree shaking. Requires Node >=24 and ships TypeScript definitions.
npm install fluent-transpilerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Reads an FTL file, compiles it to a JS module using fluent-transpiler, and writes the output.
Pass { comments: true } in options or use CLI flag --comments.Review include/exclude options to ensure the desired messages are present in the output.
Set variableNotation option to an appropriate value (e.g., 'snakeCase') to match your naming conventions.
No action needed; these are positive indicators.
Use ES modules (import) and ensure the package is installed as a dependency (npm i -D is for devDependencies; if needed at runtime, use npm i).
Change to named import: import { compile } from 'fluent-transpiler'.Read the .ftl file content first: const ftlContent = readFileSync('file.ftl', 'utf8'); then compile(ftlContent, options).