Skip to content

Bircoder432/i18n-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

i18n-sync

Crates.io License: MIT

A command-line utility for automatically syncing translation keys in rust_i18n projects.

What it does

  • Scans your Rust source code for t!("key") and i18n!("key") macros
  • Checks your YAML locale files for missing translation keys
  • Automatically adds missing keys with empty values
  • Keeps all your locale files in sync

Installation

cargo install i18n-sync

Usage

Basic usage with default settings:

i18n-sync --locale-dir ./locales

Scan specific source directory:

i18n-sync --path ./src --locale-dir ./locales --default-locale en

With short flags:

i18n-sync -l ./locales -d en

Options

  • -p, --path <PATH> - Root path to scan for Rust files (default: ".")
  • -l, --locale-dir <DIR> - Directory containing locale YAML files (required)
  • -d, --default-locale <LOCALE> - Default locale (default: "en")

Example

Before running i18n-sync:

  • Your code has: t!("hello") and t!("new_key")
  • Your en.yml only has: hello: "Hello"

After running i18n-sync, en.yml becomes:

hello: "Hello"
new_key: ""

All other locale files (like fr.yml, es.yml) will also get the new key with empty values.

Project structure

Your project should look like:

your_project/
├── src/
│   └── *.rs (with t! macros)
└── locales/
    ├── en.yml
    ├── fr.yml
    └── es.yml

License

MIT

About

Utility for generate yaml locale file from code

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages