You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-19Lines changed: 9 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -824,33 +824,23 @@ Whenever an exception is caught by `Application::handle()`, it will show a beaut
824
824
825
825
**adhocore/cli** also supports internationalisation. This is particularly useful if you are not very comfortable with English or if you are creating a framework or CLI application that could be used by people from a variety of backgrounds.
826
826
827
-
By default, all texts generated by our system are in English. But you can easily change them at any time
827
+
By default, all the texts generated by our system are in English. But you can easily modify them by defining your translations as follows
828
828
829
829
```php
830
-
\Ahc\Translations\Translator::$locale = 'fr';
830
+
\Ahc\Application::addLocale('fr', [
831
+
'Only last argument can be variadic' => 'Seul le dernier argument peut être variadique',
832
+
], true);
831
833
```
832
834
833
-
The system currently supports 5 fully translated languages:
834
-
835
-
* English: `en`
836
-
* French: `fr`
837
-
* Spanish: `es`
838
-
* German: `de`
839
-
* Russian: `ru`
840
-
841
-
If the language you want to use is not supported natively, you can create your own translation file from the main translation file. Simply copy the entire contents of the file `vendor/adhocore/cli/src/Translations/en.php` and translate all the translation values into the desired language.
842
-
843
-
After that, you will need to enter the path to the folder where your translation files are stored.
844
-
For example, if you have made Chinese (`ch`) and Arabic (`ar`) translations, and they are respectively in the `APP_PATH/translations/ch.php` and `APP_PATH/translations/ar.php` files, you can configure the translator as follows
835
+
You can also change the default English text to make the description more explicit if you wish.
\Ahc\Translations\Translator::$locale = 'ch'; // or 'ar'
838
+
\Ahc\Application::addLocale('en', [
839
+
'Show help' => 'Shows helpful information about a command',
840
+
]);
849
841
```
850
842
851
-
In the same way, you can override the built-in translations, just create your own file `en.php` or `fr.php`, etc... and indicate the folder in which it is located
852
-
853
-
You don't have to translate all the translation keys. If a translation key does not exist in your implementation, the default value will be used. This allows you to translate only the elements you consider important (for example, exception messages do not necessarily need to be translated).
843
+
vous pouvez trouver toutes les clés de traduction supportées par le paquet dans cette gist : https://gist.github.com/dimtrovich/1597c16d5c74334e68eef15a4e7ba3fd
0 commit comments