Package Data | |
---|---|
Maintainer Username: | dusterio |
Maintainer Contact: | denis@mysenko.com (Denis Mysenko) |
Package Create Date: | 2017-03-28 |
Package Last Update: | 2017-05-19 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-07 03:05:09 |
Package Statistics | |
---|---|
Total Downloads: | 27 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Laravel package for Fluent translations (application localisation)
Laravel offers two options for localization: key-based texts and plain JSON texts.
Use: __('auth.please_wait')
Drawbacks: after adding a new key to the main locale, the same key has to be manually added to all other locales.
It's easy for locales to go out of sync. Some texts may be present in the language files but not be in use anywhere.
Use: __('Please wait, authorizing')
Drawbacks: if the same text needs different translations in different contexts, this doesn't work well.
It's hard to say how much of content is translated because there is no original text dictionary.
Fluent offers you to store and manage your translations in the "cloud" which makes it trivial to outsource translations to translation market places or colleagues. Even if you translate everything yourself, Fluent interface will be far more convenient for this task (eg. you will see clearly current status, get hints from MTs, find unused texts, etc).
Use Composer to install this package:
$ composer require menarasolutions/fluent-laravel
Add our service provider to config/app.php
:
'providers' => [
/// ...
MenaraSolutions\FluentLaravel\Providers\LaravelServiceProvider::class,
/// ...
],
Create a config file (config/fluent.php
):
$ php artisan vendor:publish
Add your Fluent API key and application ID in this config file and you are ready to run!
You need to submit your original, untranslated texts to Fluent from time to time so that you or your translators
can start working on translations. To do that run scan
command:
$ php artisan fluent:scan -v
This command will scan your src
and resources/views
folders and look for all invocations of __()
, trans()
and @lang()
.
Moreover, you will be prompted whether you want to upload your existing translations from resources/lang
folder to Fluent.
Run the following command anytime during development or during your CI/CD pipeline:
$ php artisan fluent:fetch
This command will look for any new translations on Fluent and download them to resources/lang-fluent
folder.
This package will not alter any of your files. This package creates an extra folder in resources/
- lang-fluent
, all new languagae
files will be stored here.
You can move back to standard translation implementation at any time. Simply comment out our service provider in config/app.php
.