- 🚀 Getting Started
- Introduction
- Quick Start Guide
- Translator
- Glossary
- Variables
- 💻 Project integration (CLI)
- Project structures
- Translate
- 📄 Formats
- JSON
- Java-Properties
- PHP-Array
- PO
- YAML
- 📚 Resources
- API Reference
- CLI Overview
JSON Format
Format
Simpleen supports JSON (JavaScript Object Notation) in different forms.
// Simple JSON Objects
{
"key": "string to translate",
"key2": "more to translate"
}
// Simple JSON Array
["string to translate", "more to translate"]
// Deep JSON strucutres
{
"main": {
"key": "string to tanslate",
"key2": "more to tranlsate"
}
}
// Combination of object and array
{
"product": {
"name": "Simpleen",
"tags": ["translation", "simple", "saas"]
}
}
By default all strings are getting translated.
The following data types are not getting translated. They are getting returned in the result unaltered:
- numbers (1.5, 10)
- null
- boolean (false, true)
If you need to translate a part of your JSON data, see Selections below.
JSON5 support
The JSON5 format can also be used as a valid input option. You don't need to consequently use double quotes for you keys and you can additionaly use comments within your JSON structures.
Here is an example that can be still parsed and translated:
{
'key1': 'value 1',
// you can use comments
key2: 'value 2',
}
The translated result is always a JSON response, therefore the comments and the double quotes are use consequently.
{
"key1": "valeur 1",
"key2": "valeur 2"
}
Selections
Selections are used to translate some specific parts of your JSON strucutre. They are defined as a JSON Path. This feature is optional and considered more advanced.
// Data
{
"main": {
"save": "Save",
"delete": "Remove"
},
"meta": {
"url": "https://simpleen.io",
"slug": "documentation"
}
}
// Selections to tranlsate only main
// $.main
The translation result is merged with the excluded data again.