Localizator
is a small tool for Laravel that gives you the ability to extract
untranslated strings from project files. It works using the artisan
command line and the provided localize
command:
php artisan localize de,fr
The above command will create a de.json
and fr.json
file in the resources/lang
folder or add missing keys if these files already exist.
You can also use the configuration value in app.locale
by running the command without arguments:
# Use the `config('app.locale')` value
php artisan localize
The package also provides configurable values to suit your project’s needs, along with sensible defaults:
return [
/**
* Search criteria for files.
*/
'search' => [
/**
* Directories which should be looked inside.
*/
'dirs' => ['resources/views'],
/**
* Patterns by which files should be queried.
* The values can be a regular expresion, glob, or just a string.
*/
'patterns' => ['*.php'],
/**
* Functions that the strings will be extracted from.
* Add here any custom defined functions.
* NOTE: The translation string should always be the first argument.
*/
'functions' => ['__', 'trans', '@lang']
],
/**
* Should the localize command sort extracted strings alphabetically?
*/
'sort' => true,
];
You can learn more about this package, get full installation instructions, and view the source code on GitHub.
0 comments:
Post a Comment
Thanks