Vue I18n Contributing Guide
March 12, 2026 ยท View on GitHub
General Guidelines
Thanks for understanding that English is used as a shared language in this repository. Maintainers do not use machine translation to avoid miscommunication due to error in translation. If description of issue / PR are written in non-English languages, those may be closed.
It is of course fine to use non-English language, when you open a PR to translate documents and communicates with other users in same language.
Pull Request Guidelines
-
The
masterbranch is the latest stable version release. All development should be done in dedicated branches. -
Checkout a topic branch from the relevant branch, e.g.
master, and merge back against that branch. -
Work in the
srcfolder and DO NOT checkindistin the commits. -
If adding new feature:
- Add accompanying test case.
- Provide convincing reason to add this feature. Ideally you should open a suggestion issue first and have it greenlighted before working on it.
-
If fixing a bug:
- Provide detailed description of the bug in the PR. Live demo preferred.
- Add appropriate test coverage if applicable.
-
It's OK to have multiple small commits as you work on the PR - we will let GitHub automatically squash it before merging.
-
Make sure
npm testpasses. (see development setup)
Work Step Example
- Fork the repository from intlify/vue-i18n !
- Create your topic branch from
master:git branch my-new-topic origin/master - Add codes and pass tests !
- Commit your changes:
git commit -am 'Add some topic' - Push to the branch:
git push origin my-new-topic - Submit a pull request to
masterbranch ofintlify/vue-i18nrepository !
Development Setup
You will need Node.js version 20+, and PNPM.
We also recommend installing ni to help switching between repos using different package managers. ni also provides the handy nr command which running npm scripts easier.
After cloning the repo, run:
$ pnpm i # install the dependencies of the project
A high level overview of tools used:
- TypeScript as the development language
- rolldown for bundling
- Vitest for unit testing
- Playwright for e2e testing
- ESLint for code linting
- Prettier for code formatting
Scripts
pnpm build
The build script builds all public packages (packages without private: true in their package.json).
Packages to build can be specified with fuzzy matching:
# build message-compiler only
pnpm build -- message-compiler
# build all packages
pnpm build -- --all
Build Formats
By default, each package will be built in multiple distribution formats as specified in the buildOptions.formats field in its package.json. These can be overwritten via the -f flag. The following formats are supported:
-
global -
esm-bundler- Leaves prod/dev branches with
process.env.NODE_ENVguards (to be replaced by bundler) - Does not ship a minified build (to be done together with the rest of the code after bundling)
- For use with bundlers like
webpack,rollupandparcel.
- Leaves prod/dev branches with
-
esm-browser- For usage via native ES modules imports (in browser via
<script type="module">, or via Node.js native ES modules support in the future) - Inlines all dependencies - i.e. it's a single ES module with no imports from other files
- This means you must import everything from this file and this file only to ensure you are getting the same instance of code.
- Hard-coded prod/dev branches, and the prod build is pre-minified (you will have to use different paths/aliases for dev/prod)
- For usage via native ES modules imports (in browser via
For example, to build compiler with the global build only:
pnpm build -- message-compiler -f global
Multiple formats can be specified as a comma-separated list:
pnpm build -- message-compiler -f esm-browser,global
Build with Source Maps
Use the --sourcemap or -s flag to build with source maps. Note this will make the build much slower.
Build with Type Declarations
The --types or -t flag will generate type declarations during the build and in addition:
- Roll the declarations into a single
.d.tsfile for each package withrolldown-plugin-dts
pnpm dev
The dev script bundles a target package (default: vue-i18n) in a specified format (default: global) in dev mode and watches for changes. This is useful when you want to load up a build in an HTML page for quick debugging:
$ pnpm dev
built: vue-i18n
-
The
devscript also supports fuzzy match for the target package, but will only match the first package matched. -
The
devscript supports specifying build format via the-fflag just like thebuildscript. -
The
devscript also supports the-sflag for generating source maps, but it will make rebuilds slower.
pnpm test
The test script simply calls the jest binary, so all Jest CLI Options can be used. Some examples:
# run all tests
$ pnpm test
# run tests in watch mode
$ pnpm test -- --watch
# run all tests under the runtime-core package
$ pnpm test -- compiler
# run tests in a specific file
$ pnpm test -- fileName
# run a specific test in a specific file
$ pnpm test -- fileName -t 'test name'
Project Structure
This repository employs a monorepo setup which hosts a number of associated packages under the packages directory:
flowchart TD
message-compiler
core-base
core
vue-i18n-core
petite-vue-i18n
vue-i18n
subgraph Framework Agnostice Packages
core-base --> message-compiler
core --> core-base
end
subgraph Vue Layer Packages
vue-i18n-core --> core-base
vue-i18n --> core-base
vue-i18n --> vue-i18n-core
petite-vue-i18n --> core-base
petite-vue-i18n --> vue-i18n-core
end
message-compiler: The intlify message format compiler.core-base: The inlitfy core logic implementation.core: The intlify core "full build" which includes both the runtime AND the compiler.vue-i18n-core: The vue-i18n core implementation.petite-vue-i18n: The vue-i18n "small build" which includes both the runtime AND the compiler.vue-i18n: The vue-i18n "full build" which includes both the runtime AND the compiler.
There are some caveats to these packages:
- The modules
vue-i18nandvue-i18n-core, the core logic ofpetite-vue-i18n, should be imported with relative paths. - Similarly for
core, modules ofcore-base, which is the core logic implemented, should be imported with relative paths.
Importing Packages
The packages can import each other directly using their package names. Note that when importing a package, the name listed in its package.json should be used. Most of the time the @intlify/ prefix is needed:
import { baseCompile } from '@intlify/compiler'
This is made possible via several configurations:
- For TypeScript,
compilerOptions.pathintsconfig.json - For plain Node.js, they are linked using PNPM Workspaces.
Contributing Tests
Unit tests are collocated with directories named test. Consult the Jest docs and existing test cases for how to write new test specs. Here are some additional guidelines:
Use the minimal API needed for a test case. For example, if a test can be written without involving the reactivity system ra component, it should be written so. This limits the test's exposure to changes in unrelated parts and makes it more stable.
Financial Contribution
As a pure community-driven project without major corporate backing, we also welcome financial contributions via GitHub Sponsors and Patreon
Funds donated via GitHub Sponsors and Patreon go to support kazuya kawaguchi full-time work on Intlify.
Credits
Thank you to all the people who have already contributed to Intlify project and my OSS work !