Download the PHP package jrmajor/laravel-fluent without Composer
On this page you can find all versions of the php package jrmajor/laravel-fluent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jrmajor/laravel-fluent
More information about jrmajor/laravel-fluent
Files in jrmajor/laravel-fluent
Package laravel-fluent
Short Description Fluent translations for Laravel
License MIT
Homepage https://github.com/jrmajor/laravel-fluent
Informations about the package laravel-fluent
jrmajor/laravel-fluent
Unleash the expressive power of the natural language in your Laravel application with Project Fluent, a localization system designed by Mozilla.
Read the Fluent Syntax Guide or try it out in the Fluent Playground to learn more about the syntax.
This package is a Laravel wrapper around jrmajor/fluent-php.
You may install it via Composer: composer require jrmajor/laravel-fluent. The package will automatically register itself.
Usage
This package replaces default Laravel translator with Major\Fluent\Laravel\FluentTranslator.
Fluent translations are stored in .ftl files. Place them among your .php translation files in your Laravel app:
If there is no Fluent message for a given key, translator will fall back to a .php file, which allows you to introduce Fluent translation format progressively.
Laravel validator uses custom logic for replacing the :attribute variable and requires deeply nested keys, which are not supported in Fluent, so you should leave validation.php file in the default Laravel format.
The trans_choice() helper always falls back to the default translator, as the Fluent format eliminates the need for this function.
You may use the FluentTranslator::addFunction() method to register Fluent functions.
Configuration
Optionally, you can publish the configuration file with this command:
This will publish the following file in config/fluent.php: