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
1php artisan localize de,fr
The above command will create a
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 [23 /**4 * Search criteria for files.5 */6 'search' => [7 /**8 * Directories which should be looked inside.9 */10 'dirs' => ['resources/views'],1112 /**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'],1718 /**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 ],2526 /**27 * Should the localize command sort extracted strings alphabetically?28 */29 'sort' => true,3031];
You can learn more about this package, get full installation instructions, and view the source code on GitHub.