Download the PHP package asbiin/localizator without Composer
On this page you can find all versions of the php package asbiin/localizator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download asbiin/localizator
More information about asbiin/localizator
Files in asbiin/localizator
Package localizator
Short Description 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.
License MIT
Homepage https://github.com/asbiin/localizator
Informations about the package localizator
Localizator
[!IMPORTANT] This is a fork from amiranagram/localizator package, as it is not maintained for now...
Localizator is a small tool for Laravel that gives you the ability to extract untranslated string from your project files with one command.
Support
Compatibility
| Laravel | Localizator | | 13.x | ^1.0 |
Installation
You can install the package via composer:
This package makes use of Laravels package auto-discovery mechanism, which means if you don't install dev dependencies in production, it also won't be loaded.
If for some reason you want manually control this:
-
add the package to the
extra.laravel.dont-discoverkey incomposer.json, e.g. -
Add the following class to the
providersarray inconfig/app.php:If you want to manually load it only in non-production environments, instead you can add this to your
AppServiceProviderwith theregister()method:
Note: Avoid caching the configuration in your development environment, it may cause issues after installing this package; respectively clear the cache beforehand via
php artisan cache:clearif you encounter problems when running the commands
You can publish the config file with:
This is the contents of the published config file:
Usage
To extract all the strings, it's as simple as running:
This command will create (if don't exist) de.json and fr.json files inside the resources/lang directory.
If you have short keys enabled and used in your files (e.g. pagination.next) the localize command will create folders de and fr inside resources/lang directory and PHP files inside by the short key's prefix (e.g. pagination.php).
You can also run the artisan command without the country code arguments.
In this case translation strings will be generated for the language specified in app.locale config.
Note: Strings you have already translated will not be overwritten.
Remove Missing Keys
By default, the strings inside the locale files will be preserved even if they are not present the next time you run the localize command. If you want to remove those keys that are not present in your files anymore you can append the --remove-missing option to the localize command.
Key Sorting
By default, the strings generated inside those JSON files will be sorted alphabetically by their keys.
If you wanna turn off this feature just set sort => false in the config file.
Searching
The way the strings are being extracted is simple.
We are looking inside the directories defined in search.dirs config, we match the files using patterns defined in search.patterns, and finally we look to extract strings
which are the first argument of the functions defined in search.functions.
You are free to change any of these values inside the config file to suit you own needs.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Amir Rami
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of localizator with dependencies
ext-json Version *
illuminate/config Version ^13.0
illuminate/console Version ^13.0
illuminate/support Version ^13.0
illuminate/filesystem Version ^13.0
symfony/finder Version ^7.0 || ^8.0