File Structure

Now that you have configured your locales, you can start writing your translations. This chapter covers where to put your files. We will cover how to write them in another section.

By default, you must put your files in the ./locales directory, and each file must be {locale}.json:

./locales
├── en.json
└── fr.json

Custom Directory

You can change the path to the directory containing the files with the locales_path method on the config builder, for example:

#![allow(unused)]
fn main() {
let cfg = Config::new("en")?.add_locale("fr")?.locales_path("./path/to/mylocales");
}

will look for:

./path
└── to
    └── mylocales
        ├── en.json
        └── fr.json

Other Formats

JSON is the default format, but other formats are supported. We will see how to change that later. Here is a list of supported formats:

Format
JSON (default)
JSON5
YAML
TOML

Additional formats may be supported in the future.