tlr / laravel-lang-tools
Some Language Import/Export tools for Laravel
Installs: 1 723
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- php: >=5.3.0
- illuminate/console: 4.x
- illuminate/support: 4.x
- illuminate/view: 4.x
Requires (Dev)
- mockery/mockery: ~0.9@dev
- phpunit/phpunit: ~4.0
This package is auto-updated.
Last update: 2024-11-06 09:31:58 UTC
README
A language export and import command for Laravel 4. (yes, laravel 5 is coming...)
When dealing with agencies and companies who translate programming projects and websites into other languages, they often request it in certain formats.
- Currently works with csv only
Installation
Add the following to your composer.json
's require object:
"tlr/laravel-lang-tools": "1.x"
Then, add Tlr\LaravelLangTools\LaravelLangToolsServiceProvider
to the providers
array in config/app.php
.
Usage
The package provides two CLI commands:
artisan lang:export
Running php artisan lang:export
will display the current lang tokens, and all of their translations in a table in the terminal - in a similar manner to viewing laravel's routes.
Running php artisan lang:export --format csv > translations.csv
will save a csv of all of the translations, and their keys, to a csv file. This can be sent to translators.
artisan lang:import
Running php artisan lang:import translations.csv
will convert a csv file (in the same format as the one outputted) into a laravel-style lang directory structure, with lang.php files in. At the moment, the path to the provided file must be relative to the project directory.
By default, the output is saved to a directory called lang
in your project's root directory. You can pass a relative path as a third argument to change this. The target directory must not already exist.
Notes for translators
You may want to give translators some notes from laravel's localization docs page - especially regarding variables, and pluralisation.