Skip to content

Artisan Commands

Vladimir Schneider edited this page Sep 23, 2015 · 9 revisions

You can also use the commands below.

Import command

The import command will load all translations in the resources/lang directory.

$ php artisan translations:import

Note: By default, only new strings are added. Translations already in the DB are kept the same. If you want to replace all values with the ones from the files, add the --replace (or -R) option: php artisan translations:import --replace

Find translations in source

The Find command and the web interface 'Add References' button will search for all php/twig files in the app directory for translation functions. It will do its best to extract the group/item names. If you have a lot of dynamically generated keys expect some false positives to show up in the database that you will need to delete via the web interface.

The found keys will be added to the database, so they can be easily translated. This can be done through the web interface, or via an Artisan command.

$ php artisan translations:find

Export command

The export command will write the contents of the database back to app/lang php files. This will overwrite existing translations and remove all comments, so make sure to backup your data before using.

Supply the group name to define which groups you want to publish.

$ php artisan translations:export <group>

For example, php artisan translations:export reminders when you have 2 locales (en/nl), will write to resources/lang/en/reminders.php and resources/lang/nl/reminders.php

Clean command

The clean command will search for all translation that are NULL and delete them, so your interface is a bit cleaner. Empty translations are never exported to language files.

$ php artisan translations:clean

Reset command

The reset command clears all translation in the database, so you can start fresh (by a new import). Make sure to export your work or download a zip archive of it, to make sure you don't irretrievably blow away your or someone else's work.

$ php artisan translations:reset

Clone this wiki locally