Laravel
In Laravel you have 2 choices:
- PHP files for the translations
- JSON files for the translations
A complete tutorial including a small demo project is available here: How to translate your Laravel project
JSON files
You can use all JSON formats for Laravel:
- JSON with nested namespaces (Namespaced JSON)
- JSON with namespaces in key (Flat JSON)
- JSON with plaintext keys - not recommended
PHP files
BabelEdit can read PHP files that simply return an array.
The PHP parser in BabelEdit is restricted and does not perform calculations, nor does it support variables. BabelEdit does not maintain comments, or the file structure of the original php file.
BabelEdit's php parsing engine is limited to a return statement with a nested array structure. Variables, string concatenation and other constructs are not permitted.
Comments are ignored and not written back into the .php file on save.
<?php
return [
"menu" => [
"documentation" => "Documentation",
"news" => "News"],
"title" => "Translation demo"
];