A drop in solution for exporting translations from https://localise.biz - A translation management tool to Laravel 5 project.
Via Composer
$ composer require mineschan/loco-laravel-export
If you like to have custom configurations
$ php artisan vendor:publish --provider="mineschan\LocoLaravelExport\LocoLaravelExportServiceProvider"
Add your Export Key as LOCO_EXPORT_API_KEY
in .env
Save all available languages to resources/lang directory.
$ php artisan localise:export
By default the package export all available languages from your Loco porjects, if you like to export only part of them you can specify using arguments.
$ php artisan localise:export en zh-Hants
You can pass them one by one, or you can simply pass zh
for all zh
locale. e.g. zh-Hant
, zh-TW
Just like artisan:migrate
. If you run localise:export
on non-local environment, confirmation will be needed.
You can pass -f
or --force
to make it silent. Helpful if you want to include this to your CI/CD flow.
$ php artisan localise:export -f
LocoLaravelExport saves string array files from Localise.biz to resources/lang/{lang}/loco.php
by default.
This package provides a helper function loco()
to help you retrieve your saved strings with this package easily.
loco('your_key');
Alternatively, you can still use Laravel __()
helper like so __('loco.{your_string_key}')
.
Option | default | Explanation |
---|---|---|
api_key* | (null) | Export Key of Loco project |
lang_filename | loco | Default file name after export & save. |
locales | [] | Default languages to export if you do not specific any. |
download | Achieve download options. | |
export | Export options. |
Pull request is welcomed!
This is my first composer package, please do support me by giving me stars.
Please see the changelog for more information on what has changed recently.
MIT. Please see the license file for more information.