The main Babel transform plugin for Facebook's FBT (Facebook Translation) internationalization framework. Current stable version is 1.0.0, released with a regular cadence alongside the FBT ecosystem. It provides compile-time extraction and transformation of <fbt> elements and fbt() calls for localization. Key differentiators include React-integrated string interpolation with gender and number variations, and a hash-based string collection approach. Requires pairing with fbt-babel-plugin-runtime for runtime token resolution and @fbtjs/default-collection-transform for string collection outputs.
npm install babel-plugin-fbtVerified import paths — ran on the pinned version, not inferred.
Installs the FBT Babel plugin and runtime, configures them, and demonstrates basic usage with a React JSX component.
Install @fbtjs/default-collection-transform as a devDependency.
Migrate to using @fbtjs/default-collection-transform and remove fbtCommonPath/fbtEnumPath from plugin options.
Ensure plugins are ordered correctly: first babel-plugin-fbt, then babel-plugin-fbt-runtime.
Install fbt as a regular dependency: npm install fbt
Run: npm install --save-dev @fbtjs/default-collection-transform
Install babel-plugin-fbt-runtime and add it to babel.config.js after babel-plugin-fbt.
Ensure @babel/preset-react is included and that babel-plugin-fbt appears before the runtime plugin in the plugins array.