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:
1php 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:
1# Use the `config('app.locale')` value2php artisan localize
The package also provides configurable values to suit your project’s needs, along with sensible defaults:
1return [ 2 3 /** 4 * Search criteria for files. 5 */ 6 'search' => [ 7 /** 8 * Directories which should be looked inside. 9 */10 'dirs' => ['resources/views'],11 12 /**13 * Patterns by which files should be queried.14 * The values can be a regular expresion, glob, or just a string.15 */16 'patterns' => ['*.php'],17 18 /**19 * Functions that the strings will be extracted from.20 * Add here any custom defined functions.21 * NOTE: The translation string should always be the first argument.22 */23 'functions' => ['__', 'trans', '@lang']24 ],25 26 /**27 * Should the localize command sort extracted strings alphabetically?28 */29 'sort' => true,30 31];
You can learn more about this package, get full installation instructions, and view the source code on GitHub.
0 comments:
Post a Comment
Thanks