Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Commit

Permalink
refactor: better localization and clean up of hardcoded text (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
Highjhacker authored Nov 11, 2020
1 parent 5ca4cee commit c48ff46
Show file tree
Hide file tree
Showing 34 changed files with 356 additions and 145 deletions.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,58 @@ return [
```

**Note:** If you use the `username_alt` setting, you need to ensure that your users table has that column.

6. Register databags in your `AppServiceProvider` that are used by the auth pages

```php
use Konceiver\DataBags\DataBag;

...

public function boot()
{
...

$this->registerDataBags();
}

private function registerDataBags(): void
{
DataBag::register('fortify-content', [
'register' => [
'pageTitle' => '',
'title' => '',
'description' => '',
],
'login' => [
'pageTitle' => '',
'title' => '',
'description' => '',
],
'password' => [
'reset' => [
'pageTitle' => '',
],
'request' => [
'pageTitle' => '',
],
],
'verification' => [
'notice' => [
'pageTitle' => '',
],
'verify' => [
'pageTitle' => '',
],
'send' => [
'pageTitle' => '',
],
],
'two-factor' => [
'login' => [
'pageTitle' => '',
],
],
]);
}
```
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"jenssegers/agent": "^2.6",
"arkecosystem/ui": "^1.0",
"spatie/laravel-personal-data-export": "^1.3",
"spatie/laravel-medialibrary": "^8.9"
"spatie/laravel-medialibrary": "^8.9",
"konceiver/laravel-data-bags": "^1.1"
},
"autoload": {
"psr-4": {
Expand Down
75 changes: 74 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 15 additions & 7 deletions resources/lang/en/actions.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
<?php

return [

'disable' => 'Disable',
'enable' => 'Enable',
'export_personal_data' => 'Export Personal Data',
'understand' => 'I Understand',
'update' => 'Update',
'select_timezone' => 'Select Timezone',
'disable' => 'Disable',
'enable' => 'Enable',
'export_personal_data' => 'Export Personal Data',
'understand' => 'I Understand',
'update' => 'Update',
'select_timezone' => 'Select Timezone',
'sign_in' => 'Sign In',
'reset_password' => 'Reset Password',
'use_recovery_code' => 'Use a recovery code',
'use_authentication_code' => 'Use an authentication code',
'verify' => 'Verify',
'delete_account' => 'Delete Account',
'nevermind' => 'Nevermind',
'done' => 'Done',
'confirm_logout' => 'Logout Other Browser Sessions',
];
32 changes: 31 additions & 1 deletion resources/lang/en/auth.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
<?php

return [
'confirm-password' => [
'page_header' => 'Confirm Password',
],

'forgot-password' => [
'page_header' => 'Password Reset Email',
'reset_link' => 'Send Password Reset Link',
],

'sign-in' => [
'forgot_password' => 'Forgot password?',
'register_now' => 'Not a member? <a href=":route" class="link">Sign up now</a>',
],

'register-form' => [
'conditions' => "Creating an account means you're okay with our <a href=':termsOfServiceRoute' class='link'>Terms of Service</a> and <a href=':privacyPolicyRoute' class='link'>Privacy Policy</a>.",
'create_account' => 'Create Account',
'already_member' => 'Already a member? <a href=":route" class="link">Sign in</a>',
],

'register' => [
'page_header' => 'Sign Up',
],

'reset-password' => [
'page_header' => 'Reset Password',
],

'two-factor' => [
'page_header' => 'Two-Factor Authentication',
],

'verified' => [
'page_header' => 'Congratulations!',
Expand All @@ -13,5 +44,4 @@
'link_description' => 'A verification link has been sent to your email address.',
'resend_verification' => 'Before proceeding, please check your email for a verification link. If you did not receive the email, <button type="submit" class="link">click here to request another</button>.',
],

];
26 changes: 23 additions & 3 deletions resources/lang/en/forms.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

return [

'confirm_password' => 'Confirm Password',
'current_password' => 'Current Password',
'email_address' => 'Email Address',
Expand All @@ -10,16 +9,37 @@
'new_password' => 'New Password',
'password' => 'Password',
'username' => 'Username',
'code' => 'Code',
'recovery_code' => 'Recovery Code',

'update_password' => [
'update-password' => [
'requirements_notice' => 'Password must be 12–128 characters, and include a number, a symbol, a lower and an upper case letter.',
],

'password_rules' => [
'password-rules' => [
'needs_lowercase' => 'One lowercase character',
'needs_uppercase' => 'One uppercase character',
'needs_numeric' => 'One number',
'needs_special_character' => 'One special character',
'needs_minimum_length' => '12 characters minumum',
],

'delete-user' => [
'title' => 'Delete Account',
'description' => 'Permanently delete your account.',
'content' => 'Once your account is deleted, all of its resources and data will be permanently deleted. Before deleting your account, please download any data or information that you wish to retain.',
'confirmation' => 'Are you sure you want to delete your account? Once your account is deleted, all of its resources and data will be permanently deleted. Please enter your password to confirm you would like to permanently delete your account.',
],

'logout-sessions' => [
'title' => 'Browser Sessions',
'description' => 'Manage and logout your active sessions on other browsers and devices.',
'content' => 'If necessary, you may logout of all of your other browser sessions across all of your devices. If you feel your account has been compromised, you should also update your password',
'confirm_logout' => 'Logout Other Browser Sessions',
],

'confirming-logout' => [
'title' => 'Logout Other Browser Sessions',
'content' => 'Please enter your password to confirm you would like to logout of your other browser sessions across all of your devices.',
],
];
6 changes: 6 additions & 0 deletions resources/lang/en/generic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

return [
'this_device' => 'This Device',
'last_active' => 'Last Active',
];
11 changes: 5 additions & 6 deletions resources/lang/en/menu.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?php

return [

'2fa' => 'Two Factor Authentication',
'password-reset-email' => 'Password Reset Email',
'password_reset_email' => 'Password Reset Email',
'register' => 'Register',
'reset-password' => 'Reset Password',
'sign-in' => 'Sign In to MarketSquare',
'sign-up' => 'Sign Up to MarketSquare',
'reset_password' => 'Reset Password',
'sign_in' => 'Sign In to MarketSquare',
'sign_up' => 'Sign Up to MarketSquare',
'verify' => 'Verify Email',

'home' => 'Home',
];
5 changes: 5 additions & 0 deletions resources/lang/en/messages.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'invalid_2fa_authentication_code' => 'The provided two factor authentication code was invalid',
];
6 changes: 2 additions & 4 deletions resources/lang/en/metatags.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?php

return [

'reset-password' => 'Reset Password',
'reset_password' => 'Reset Password',
'login' => 'Login',
'register' => 'Register',
'login-with-two-factor' => 'Login With Two Factor',
'login_with_two_factor' => 'Login With Two Factor',
'verify' => 'Verify',

];
3 changes: 0 additions & 3 deletions resources/lang/en/pages.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?php

return [

'user-settings' => [

'2fa_title' => 'Two Factor Authentication',
'2fa_description' => 'Add additional security to your account using two factor authentication.',
'2fa_enabled_title' => 'You have enabled two factor authentication.',
Expand All @@ -24,5 +22,4 @@
'gdpr_title' => 'General Data Protection Regulation (GDPR)',
'gdpr_description' => 'This will will create a zip containing all personal data to respect your right to data portability. You will receive the zip file on the email address linked to your Deployer account.',
],

];
10 changes: 10 additions & 0 deletions resources/lang/en/validation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

return [
'password_doesnt_match' => 'The provided password does not match your current password.',
'password_doesnt_match_records' => 'This password does not match our records.',

'messages' => [
'one_time_password' => 'We were not able to enable two-factor authentication with this one-time password.',
],
];
2 changes: 1 addition & 1 deletion resources/views/auth/confirm-password.blade.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Confirm Password
@lang('fortify::auth.confirm-password.page_header')
12 changes: 6 additions & 6 deletions resources/views/auth/forgot-password.blade.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
@extends('layouts.app')

@section('title')
@lang('fortify::metatags.reset-password')
<x-data-bag key="fortify-content" resolver="name" view="ark-fortify::components.page-title" />
@endsection

@section('back-bar')
@section('breadcrumbs')
<x-breadcrumbs :crumbs="[
['route' => 'login', 'label' => trans('fortify::menu.sign-in')],
['label' => trans('fortify::menu.password-reset-email')],
['route' => 'login', 'label' => trans('fortify::menu.sign_in')],
['label' => trans('fortify::menu.password_reset_email')],
]" />
@endsection

@section('content')
<div class="container mx-auto">
<div class="mx-auto my-8 md:w-3/4 lg:w-3/5 xl:w-1/2">
<h1 class="mx-4 text-2xl font-bold md:text-4xl md:mx-8 xl:mx-16">Password Reset Email</h1>
<h1 class="mx-4 text-2xl font-bold md:text-4xl md:mx-8 xl:mx-16">@lang('fortify::auth.forgot-password.page_header')</h1>

<div class="px-8">
<x-ark-flash />
Expand Down Expand Up @@ -44,7 +44,7 @@ class="w-full"

<div class="text-right">
<button type="submit" class="w-full button-primary md:w-auto">
Send Password Reset Link
@lang('fortify::auth.forgot-password.reset_link')
</button>
</div>
</form>
Expand Down
Loading

0 comments on commit c48ff46

Please sign in to comment.