mineschan/loco-laravel-export

Export strings and translations from https://localise.biz for Laravel 5 projects

0.2 2019-02-21 12:03 UTC

This package is auto-updated.

Last update: 2024-04-22 11:04:19 UTC


README

Latest Version on Packagist Total Downloads License

A drop in solution for exporting translations from https://localise.biz - A translation management tool to Laravel 5 project.

Installation

Via Composer

$ composer require mineschan/loco-laravel-export

If you like to have custom configurations

$ php artisan vendor:publish --provider="mineschan\LocoLaravelExport\LocoLaravelExportServiceProvider"

Usage: Export

Step 1

Add your Export Key as LOCO_EXPORT_API_KEY in .env

Step 2

Save all available languages to resources/lang directory.

$ php artisan localise:export

Done!

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

Export in Live servers

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

Usage: Get string

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}').

Configurable options

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.

Contributions

Pull request is welcomed!

This is my first composer package, please do support me by giving me stars.

Change log

Please see the changelog for more information on what has changed recently.

Author

License

MIT. Please see the license file for more information.