Skip to content

Commit 7be9506

Browse files
authored
Update readme.md
1 parent 822d67e commit 7be9506

File tree

1 file changed

+29
-22
lines changed

1 file changed

+29
-22
lines changed

readme.md

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,42 +21,40 @@ Require this package in your composer.json and run composer update (or run `comp
2121

2222
composer require barryvdh/laravel-translation-manager
2323

24-
After updating composer, add the ServiceProvider to the providers array in `config/app.php`
25-
26-
'Barryvdh\TranslationManager\ManagerServiceProvider',
2724

2825
You need to run the migrations for this package.
2926

30-
$ php artisan vendor:publish --provider="Barryvdh\TranslationManager\ManagerServiceProvider" --tag=migrations
31-
$ php artisan migrate
27+
```
28+
php artisan vendor:publish --provider="Barryvdh\TranslationManager\ManagerServiceProvider" --tag=migrations
29+
php artisan migrate
30+
```
3231

3332
You need to publish the config file for this package. This will add the file `config/translation-manager.php`, where you can configure this package.
3433

35-
$ php artisan vendor:publish --provider="Barryvdh\TranslationManager\ManagerServiceProvider" --tag=config
34+
```
35+
php artisan vendor:publish --provider="Barryvdh\TranslationManager\ManagerServiceProvider" --tag=config
36+
```
3637

3738
In order to edit the default template, the views must be published as well. The views will then be placed in `resources/views/vendor/translation-manager`.
3839

39-
$ php artisan vendor:publish --provider="Barryvdh\TranslationManager\ManagerServiceProvider" --tag=views
40+
```
41+
php artisan vendor:publish --provider="Barryvdh\TranslationManager\ManagerServiceProvider" --tag=views
42+
```
4043

4144
Routes are added in the ServiceProvider. You can set the group parameters for the routes in the configuration.
4245
You can change the prefix or filter/middleware for the routes. If you want full customisation, you can extend the ServiceProvider and override the `map()` function.
4346

4447
This example will make the translation manager available at `http://yourdomain.com/translations`
4548

46-
If you would like to use auto translation using Google Translate API
49+
If you would like to use auto translation using Google Translate API, install https://github.com/tanmuhittin/laravel-google-translate
50+
4751
```
52+
composer require tanmuhittin/laravel-google-translate
4853
php artisan vendor:publish --provider=Tanmuhittin\LaravelGoogleTranslate\LaravelGoogleTranslateServiceProvider
4954
```
5055

51-
Edit config/laravel_google_translate.php and add your Google Translate API key.
52-
53-
```
54-
php artisan config:cache
55-
```
56-
57-
Now you can use Auto Translation Trait
5856

59-
### Laravel >= 5.2
57+
### Middleware / Auth
6058

6159
The configuration file by default only includes the `auth` middleware, but the latests changes in Laravel 5.2 makes it that session variables are only accessible when your route includes the `web` middleware. In order to make this package work on Laravel 5.2, you will have to change the route/middleware setting from the default
6260

@@ -97,7 +95,9 @@ You can also use the commands below.
9795

9896
The import command will search through app/lang and load all strings in the database, so you can easily manage them.
9997

100-
$ php artisan translations:import
98+
```
99+
php artisan translations:import
100+
```
101101

102102
Translation strings from app/lang/locale.json files will be imported to the __json_ group.
103103

@@ -110,7 +110,9 @@ The Find command/button will look search for all php/twig files in the app direc
110110
The found keys will be added to the database, so they can be easily translated.
111111
This can be done through the webinterface, or via an Artisan command.
112112

113-
$ php artisan translations:find
113+
```
114+
php artisan translations:find
115+
```
114116

115117
If your project uses translation strings as keys, these will be stored into then __json_ group.
116118

@@ -120,7 +122,9 @@ The export command will write the contents of the database back to app/lang php
120122
This will overwrite existing translations and remove all comments, so make sure to backup your data before using.
121123
Supply the group name to define which groups you want to publish.
122124

123-
$ php artisan translations:export <group>
125+
```
126+
php artisan translations:export <group>
127+
```
124128

125129
For example, `php artisan translations:export reminders` when you have 2 locales (en/nl), will write to `app/lang/en/reminders.php` and `app/lang/nl/reminders.php`
126130

@@ -130,14 +134,17 @@ To export translation strings as keys to JSON files , use the `--json` (or `-J`)
130134

131135
The clean command will search for all translation that are NULL and delete them, so your interface is a bit cleaner. Note: empty translations are never exported.
132136

133-
$ php artisan translations:clean
137+
```
138+
php artisan translations:clean
139+
```
134140

135141
### Reset command
136142

137143
The reset command simply clears all translation in the database, so you can start fresh (by a new import). Make sure to export your work if needed before doing this.
138144

139-
$ php artisan translations:reset
140-
145+
```
146+
php artisan translations:reset
147+
```
141148

142149

143150
### Detect missing translations

0 commit comments

Comments
 (0)