Skip to content

Commit 35f9f83

Browse files
committed
add more usage info to readme
1 parent 9d3b276 commit 35f9f83

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ You can install it via Composer: `composer require jrmajor/laravel-fluent`. It r
3131

3232
## Usage
3333

34+
This package replaces default Laravel translator with `Major\Fluent\Laravel\FluentTranslator`.
35+
36+
```php
37+
app('translator') instanceof Major\Fluent\Laravel\FluentTranslator; // true
38+
```
39+
3440
Fluent translations are stored in `.ftl` files. Place them among your `.php` translation files in your Laravel app:
3541

3642
```
@@ -44,9 +50,21 @@ Fluent translations are stored in `.ftl` files. Place them among your `.php` tra
4450
validation.php
4551
```
4652

47-
If there is no Fluent message for given key, translator will fall back to `.php` file, which allows you to introduce Fluent translation format progressively. Laravel validator uses custom logic for replacing `:attribute` variable and requires deeply nested keys, which are not supported in Fluent, so you should leave `validation.php` file in default Laravel format.
53+
If there is no Fluent message for given key, translator will fall back to `.php` file, which allows you to introduce Fluent translation format progressively.
54+
55+
Laravel validator uses custom logic for replacing `:attribute` variable and requires deeply nested keys, which are not supported in Fluent, so you should leave `validation.php` file in default Laravel format.
56+
57+
`trans_choice()` helper always falls back to default translator, as Fluent format eliminates the need for another function.
58+
59+
## Installation
60+
61+
You may install the package via Composer:
62+
63+
```shell
64+
composer require jrmajor/laravel-fluent
65+
```
4866

49-
### Configuration
67+
The package will automatically register itself.
5068

5169
Optionally, you can publish the configuration file with this command:
5270

0 commit comments

Comments
 (0)