Project structures
Project structures
We don't assume a specific project structure. You can translate multiple JSON files in different directories. You can also store them directly.
1 file per locale
📦src
┣ 📂pages
┗ 📂public
┃ ┣ 📂locales
┃ ┃ ┣ 📜en.json
┃ ┃ ┗ 📜fr.json
┃ ┗ 📜styles.css
Input path: src/public/locales/en.json
Output path: src/public/locales/\$locale.json
Use $LOCALE
for uppercase version of locale en => EN
1 directory per locale
📦src
┣ 📂pages
┗ 📂public
┃ ┣ 📂locale
┃ ┃ ┣ 📂en
┃ ┃ ┃ ┣ 📜main.json
┃ ┃ ┃ ┗ 📜product.json
┃ ┃ ┗ 📂fr
┃ ┃ ┃ ┣ 📜main.json
┃ ┃ ┃ ┗ 📜product.json
┃ ┗ 📜styles.css
Input path: src/public/locales/en/*.json
Output path: src/public/locales/$locale/$FILE.json
Locales per feature
📦src
┣ 📂features
┃ ┣ 📂main
┃ ┃ ┣ 📜en.json
┃ ┃ ┗ 📜fr.json
┃ ┗ 📂product
┃ ┃ ┣ 📜en.json
┃ ┃ ┗ 📜fr.json
┗ 📂public
┃ ┗ 📜styles.css
Input path: src/features/**/en.json
Output path: src/features/$FOLDER/$locale.json