1. Go to this page and download the library: Download tio/laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tio / laravel example snippets
return [
'title' => 'Title to be translated',
'hello' => 'Hello :name',
'messages' => 'One message|Many messages',
'menu' => [
'title' => 'Title of menu'
]
];
~~~
Notes:
* `trans` can also be used instead of `__`.
* You can organize your PHP files with subfolders like `en/subfolder/inbox.php` using keys like `subfolder/inbox.title`.
### Laravel Localization (JSON source text)
[A new feature](https://laravel.com/docs/5.4/localization#using-translation-strings-as-keys) of Laravel 5.4
is the possibility to use `__` with the source text (and not only with keys like in the previous section).
These translations are stored into JSON files located in the `lang` directory.
~~~php
// Regular
__("Text to be translated");
// Pluralization
trans_choice(__('One message|Many messages'), $number);
// Interpolation
__('Hello :name', ['name' => $user->name]);
~~~
With the JSON file `lang/en.json`:
~~~json
{
"Text to be translated": "",
"One message|Many messages": "",
"Hello :name": ""
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.