When labeling keys in JSON files for translation, follow these guidelines:
- Use Descriptive Keys: Keys should be descriptive and provide context about the text they represent.
- CamelCase Format: Use camelCase for key names or lowercase for dynamic keys.
- Use Subsections for Keys: Create subsections for keys to group related translations together.
{
"header": {
"title": "Welcome",
"subtitle": "Your journey starts here"
},
"footer": {
"contact": "Contact Us"
}
}Translation files should be named according to the following conventions:
- Common File: Use
common.jsonfor translations that are used across multiple routes or components. - Route-Specific Files: Name files based on the first segment of the route they correspond to.
For a route /dashboard/settings, the translation file should be named dashboard.json.
/en
├── common.json
├── dashboard.json
└── profile.json
By following these guidelines, you ensure a consistent and maintainable approach to internationalization in your project.