Download the PHP package singlequote/laravel-locale-finder without Composer
On this page you can find all versions of the php package singlequote/laravel-locale-finder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-locale-finder
Laravel Translation Finder
Find all translation keys in your blades, scripts, files etc. and translate to the given language.
Installation
Install the package using composer. Save the package to the dev section for the package is only needed when developing your project. If you need it on your production, remove the --dev
option.
Publish config
You can change the behaviour of the package by editing the config file. Publish the config file with the command below.
Usage
The package searches for translations key in your blade files. For example {{ __("My translation") }}
. Or @lang('My Translation')
.
After searching the package will try to translate the keys using the google translate package.
When removing translations from your view, the package will also remove the keys from the files.
The command can be used from the commandline
For example, find and translate all dutch translation keys
or find and translate the dutch and german translations keys
Translate all available locales
The all
option will scan your lang folder and select the available .json files.
Change source
If you develop your application in a different language you can change the defualt source from en
to something else.
Disabling key translations
If you would like to just get the keys from your views, you can use the --notranslate
option.
This will fill the values with the default keys.
Exclude keys
If you want the package to only search for specific translation keys, you can use the --only
option.
This will exclude everthing outside the --only
scope.
The above will exclude every translation key that doesn't belong in the app
directive.
For example:
Add multiple only keys to your command
Using patterns
When using modules or large translation files, it can be a lot of work to fill the --only
option with all keys.
You can use the *
pattern to include keys. For example if you execute the command below:
Create missing php key files
When adding new translations keys such as __("newkey.some text")
the file newkey.php
should exists in order to add the translation keys.
When using the --create
option the package will auto generate these files.
Beta
Modules
When using modules in your laravel package with their own lang folder, you would like to add the keys to the right files in the module folders.
So for example when we have a module called Horses
and we loaded the translations using $this->loadTranslationsFrom(PATHTOTRANS, "horses");
in our Service provider. The key should be something like this : __("horses::")
and with a translation __("horsed.colors.red")
where colors.php
is the file.
When using the --modules
option, the package will auto detect the loaded translation files and adds the keys to the right files.
Contributing
Please see CONTRIBUTING for details.
Postcardware
You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.
Our address is: Quotec, Traktieweg 8c 8304 BA, Emmeloord, Netherlands.
Credits
- Wim Pruiksma
- All Contributors
License
The MIT License (MIT). Please see License File for more information.