Skip to content

Commit 1b49820

Browse files
committed
Merge branch 'veare-language-file' into 3.0
Translation
2 parents 5d497ca + 8383eb1 commit 1b49820

File tree

5 files changed

+55
-20
lines changed

5 files changed

+55
-20
lines changed

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ Or run the following command:
4747

4848
Once Larvel User Verification is installed, you need to register the service provider in `config/app.php`. Make sure to add the following line **above** the `RouteServiceProvider`.
4949

50-
```php
51-
Jrean\UserVerification\UserVerificationServiceProvider::class,
50+
```PHP
51+
Jrean\UserVerification\UserVerificationServiceProvider::class,
5252
```
5353

5454
You may add the following `aliases` to your `config/app.php`:
5555

56-
```php
57-
'UserVerification' => Jrean\UserVerification\Facades\UserVerification::class
56+
```PHP
57+
'UserVerification' => Jrean\UserVerification\Facades\UserVerification::class
5858
```
5959

6060
## CONFIGURATION
@@ -114,7 +114,6 @@ Once the migration is generated, edit the generated migration file in
114114
$table->dropColumn('verification_token');
115115
});
116116
}
117-
118117
```
119118

120119
Where `:table` is replaced by the table name of your choice.
@@ -194,7 +193,7 @@ By default the `user-verification.blade.php` view will be loaded for the verific
194193
**You may customize this view to your needs.** To do so first publish the view to your resources folder:
195194

196195
```
197-
php artisan vendor:publish --tag=laravel-user-verification-views
196+
php artisan vendor:publish --tag=laravel-user-verification-views
198197
```
199198

200199
The view will be available in the `resources/views/vendor/laravel-user-verification/` directory and can be customized.
@@ -206,11 +205,11 @@ The view will be available in the `resources/views/vendor/laravel-user-verificat
206205
By default this packages ships with two routes. If you want to change them, you can simply define your own routes.
207206

208207
```PHP
209-
Route::get('email-verification/error', 'Auth\RegisterController@getVerificationError')->name('email-verification.error');
210-
Route::get('email-verification/check/{token}', 'Auth\RegisterController@getVerification')->name('email-verification.check');
208+
Route::get('email-verification/error', 'Auth\RegisterController@getVerificationError')->name('email-verification.error');
209+
Route::get('email-verification/check/{token}', 'Auth\RegisterController@getVerification')->name('email-verification.check');
211210
```
212211

213-
### Trait
212+
### Traits
214213

215214
The package offers two (2) traits for a quick implementation.
216215
**Only `VerifiesUsers` must be included.**
@@ -307,6 +306,16 @@ Name of the default e-mail view.
307306

308307
Name of the default table used for managing users.
309308

309+
### Translations
310+
311+
To customize the translations you may publish the files to your `resources/lang/vendor` folder using the following command:
312+
313+
```
314+
php artisan vendor:publish --tag=laravel-user-verification-translations
315+
```
316+
317+
This will add `laravel-user-verification/en/user-verification.php` to your vendor folder. By creating new language folders, like `de` or `fr` and placing a `user-verification.php` with the translations inside, you can add translations for other languages. You can find out more about localization in the [Laravel documentation](https://laravel.com/docs/5.3/localization).
318+
310319
### Customize
311320

312321
You can customize the package behaviour by overriding/overwriting the
@@ -445,16 +454,16 @@ update the middleware exception to allow `getVerification` and
445454
`getVerificationError` routes to be accessed.
446455

447456
```PHP
448-
$this->middleware('guest', ['except' => ['getVerification', 'getVerificationError']]);
457+
$this->middleware('guest', ['except' => ['getVerification', 'getVerificationError']]);
449458
```
450459

451460
## RELAUNCH THE PROCESS ANYTIME
452461

453462
If you want to regenerate and resend the verification token, you can do this with the following two lines:
454463

455464
```PHP
456-
UserVerification::generate($user);
457-
UserVerification::send($user, 'My Custom E-mail Subject');
465+
UserVerification::generate($user);
466+
UserVerification::send($user, 'My Custom E-mail Subject');
458467
```
459468

460469
The `generate` method will generate a new token for the given user and change the `verified` column to 0. The `send` method will send a new e-mail to the user.

src/UserVerification.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ protected function emailVerificationLink(AuthenticatableContract $user, $subject
336336

337337
$m->to($user->email);
338338

339-
$m->subject(is_null($subject) ? 'Your Account Verification Link' : $subject);
339+
$m->subject(is_null($subject) ? trans('laravel-user-verification::user-verification.verification_email_subject') : $subject);
340340
});
341341
}
342342

@@ -358,7 +358,7 @@ protected function emailQueueVerificationLink(AuthenticatableContract $user, $su
358358

359359
$m->to($user->email);
360360

361-
$m->subject(is_null($subject) ? 'Your Account Verification Link' : $subject);
361+
$m->subject(is_null($subject) ? trans('laravel-user-verification::user-verification.verification_email_subject') : $subject);
362362
});
363363
}
364364

@@ -381,7 +381,7 @@ protected function emailQueueOnVerificationLink($queue, AuthenticatableContract
381381

382382
$m->to($user->email);
383383

384-
$m->subject(is_null($subject) ? 'Your Account Verification Link' : $subject);
384+
$m->subject(is_null($subject) ? trans('laravel-user-verification::user-verification.verification_email_subject') : $subject);
385385
});
386386
}
387387

@@ -404,7 +404,7 @@ protected function emailLaterVerificationLink($seconds, AuthenticatableContract
404404

405405
$m->to($user->email);
406406

407-
$m->subject(is_null($subject) ? 'Your Account Verification Link' : $subject);
407+
$m->subject(is_null($subject) ? trans('laravel-user-verification::user-verification.verification_email_subject') : $subject);
408408
});
409409
}
410410

@@ -427,7 +427,7 @@ protected function emailLaterOnVerificationLink($queue, $seconds, Authenticatabl
427427

428428
$m->to($user->email);
429429

430-
$m->subject(is_null($subject) ? 'Your Account Verification Link' : $subject);
430+
$m->subject(is_null($subject) ? trans('laravel-user-verification::user-verification.verification_email_subject') : $subject);
431431
});
432432
}
433433

src/UserVerificationServiceProvider.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,24 @@ class UserVerificationServiceProvider extends ServiceProvider
1818
*/
1919
public function boot()
2020
{
21+
// routes
2122
if (! $this->app->routesAreCached()) {
2223
require __DIR__ . '/routes.php';
2324
}
2425

26+
// views
2527
$this->loadViewsFrom(__DIR__ . '/resources/views', 'laravel-user-verification');
2628

2729
$this->publishes([
2830
__DIR__ . '/resources/views' => resource_path('views/vendor/laravel-user-verification'),
2931
], 'laravel-user-verification-views');
32+
33+
// translations
34+
$this->loadTranslationsFrom(__DIR__ . '/resources/lang', 'laravel-user-verification');
35+
36+
$this->publishes([
37+
__DIR__ . '/resources/lang' => resource_path('lang/vendor/laravel-user-verification'),
38+
], 'laravel-user-verification-translations');
3039
}
3140

3241
/**
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Laravel User Verification Language Lines
8+
|--------------------------------------------------------------------------
9+
*/
10+
11+
'verification_email_subject' => 'Your Account Verification Link',
12+
// error view
13+
'verification_error_header' => 'Verification failed',
14+
'verification_error_message' => 'Your account could not be verified.',
15+
'verification_error_back_button' => 'Back',
16+
17+
];

src/resources/views/user-verification.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
<div class="row">
77
<div class="col-md-8 col-md-offset-2">
88
<div class="panel panel-default">
9-
<div class="panel-heading">Verification failed</div>
9+
<div class="panel-heading">{!! trans('laravel-user-verification::user-verification.verification_error_header') !!}</div>
1010
<div class="panel-body">
1111
<span class="help-block">
12-
<strong>Your account could not be verified.</strong>
12+
<strong>{!! trans('laravel-user-verification::user-verification.verification_error_message') !!}</strong>
1313
</span>
1414
<div class="form-group">
1515
<div class="col-md-12">
1616
<a href="{{url('/')}}" class="btn btn-primary">
17-
Back
17+
{!! trans('laravel-user-verification::user-verification.verification_error_back_button') !!}
1818
</a>
1919
</div>
2020
</div>

0 commit comments

Comments
 (0)