From a35309799e93fe384d16ead531add16b98b634e1 Mon Sep 17 00:00:00 2001 From: Zak Nesler <7189795+zaknesler@users.noreply.github.com> Date: Thu, 14 Nov 2019 10:50:30 -0500 Subject: [PATCH] [5.0] Localization and password confirmation view (#14) * Update dependencies * Add confirm view * Allow all text to be localized * Add StyleCI configuration to repo --- readme.md | 6 ++ src/Tailwind.php | 10 ++-- src/stubs/en.stub | 40 +++++++++++++ src/stubs/views/auth/auth/login.stub | 20 ++++--- .../views/auth/auth/passwords/confirm.stub | 56 +++++++++++++++++++ .../views/auth/auth/passwords/email.stub | 11 ++-- .../views/auth/auth/passwords/reset.stub | 12 ++-- src/stubs/views/auth/auth/register.stub | 17 +++--- src/stubs/views/auth/auth/verify.stub | 11 ++-- src/stubs/views/auth/errors/404.stub | 8 ++- src/stubs/views/auth/errors/419.stub | 8 ++- src/stubs/views/auth/errors/500.stub | 8 ++- src/stubs/views/auth/errors/503.stub | 6 +- .../views/auth/layouts/partials/_header.stub | 12 ++-- src/stubs/views/auth/welcome.stub | 8 +-- styleci.yml | 7 +++ 16 files changed, 186 insertions(+), 54 deletions(-) create mode 100644 src/stubs/en.stub create mode 100644 src/stubs/views/auth/auth/passwords/confirm.stub create mode 100644 styleci.yml diff --git a/readme.md b/readme.md index cf264d7..9b57d6c 100644 --- a/readme.md +++ b/readme.md @@ -59,6 +59,12 @@ yarn dev // npm run dev Ensure that your database is properly configured and migrated, and you're done! +### Localization + +All of the text in the views that this preset provides are configured to be easily translatable. When you install the `tailwind-auth` preset, the file `en.json` will be copied into your application's `resources/lang` directory. + +This file includes all of the text found in this package. To update the default English text, simply update the values of any of the key-value pairs. To translate into a different language, duplicate `en.json` and rename it to `{locale}.json`; you can then translate the values into the destination language. For more about localization, please refer to the [Laravel documentation](https://laravel.com/docs/6.x/localization). + ### EditorConfig To ensure proper guide highlighting in your text editor, it is recommended that you add the following to the end of the `.editorconfig` file: diff --git a/src/Tailwind.php b/src/Tailwind.php index 3258105..fd2d86a 100644 --- a/src/Tailwind.php +++ b/src/Tailwind.php @@ -57,6 +57,7 @@ public static function installWithAuth() ]); static::installViews('auth', [ + 'auth/passwords/confirm.stub', 'auth/passwords/email.stub', 'auth/passwords/reset.stub', 'auth/login.stub', @@ -73,6 +74,7 @@ public static function installWithAuth() ]); file_put_contents(app_path('Http/Controllers/HomeController.php'), static::compileControllerStub()); + File::copy(__DIR__.'/stubs/en.stub', resource_path('lang/en.json')); } /** @@ -85,11 +87,11 @@ protected static function updatePackageArray(array $packages) { return [ '@tailwindcss/custom-forms' => '^0.2', - 'autoprefixer' => '^9.6', + 'autoprefixer' => '^9.7', 'axios' => '^0.19', - 'cross-env' => '^5.2', - 'laravel-mix' => '^4.1', - 'laravel-mix-purgecss' => '^4.1', + 'cross-env' => '^6.0', + 'laravel-mix' => '^5.0', + 'laravel-mix-purgecss' => '^4.2', 'tailwindcss' => '^1.1', 'vue' => '^2.6', 'vue-template-compiler' => '^2.6', diff --git a/src/stubs/en.stub b/src/stubs/en.stub new file mode 100644 index 0000000..af6e397 --- /dev/null +++ b/src/stubs/en.stub @@ -0,0 +1,40 @@ +{ + "404 Page Not Found": "404 Page Not Found", + "419 Page Expired": "419 Page Expired", + "500 Internal Server Error": "500 Internal Server Error", + "503 Service Unavailable": "503 Service Unavailable", + "Confirm New Password": "Confirm New Password", + "Confirm Password": "Confirm Password", + "Confirm your password": "Confirm your password", + "Confirm": "Confirm", + "Create a new account": "Create a new account", + "Create account": "Create account", + "Didn't get the email?": "Didn't get the email?", + "Email": "Email", + "Enter your email address and we'll send you a link to reset your password": "Enter your email address and we'll send you a link to reset your password", + "Forgot password?": "Forgot password?", + "Have an account?": "Have an account?", + "Home": "Home", + "Logout": "Logout", + "Name": "Name", + "New Password": "New Password", + "Page expired (Try refreshing)": "Page expired (Try refreshing)", + "Page not found": "Page not found", + "Password": "Password", + "Please confirm your password before continuing": "Please confirm your password before continuing", + "Remember it?": "Remember it?", + "Remember me": "Remember me", + "Resend it": "Resend it", + "Reset password": "Reset password", + "Reset your password": "Reset your password", + "Send Link": "Send Link", + "Sign in to your account": "Sign in to your account", + "Sign in": "Sign in", + "Sign up": "Sign up", + "Something went wrong": "Something went wrong", + "Verify your email": "Verify your email", + "We have sent you a fresh verification link, please check your email.": "We have sent you a fresh verification link, please check your email.", + "We're performing some maintenance, check back soon": "We're performing some maintenance, check back soon", + "Welcome": "Welcome", + "You must verify your email address before proceeding. Please check your email for a verification link.": "You must verify your email address before proceeding. Please check your email for a verification link." +} diff --git a/src/stubs/views/auth/auth/login.stub b/src/stubs/views/auth/auth/login.stub index b722005..1269dba 100644 --- a/src/stubs/views/auth/auth/login.stub +++ b/src/stubs/views/auth/auth/login.stub @@ -1,6 +1,6 @@ @extends('layouts.base') -@section('title', 'Sign in') +@section('title', __('Sign in')) @section('show-header', false) @section('content-full') @@ -11,7 +11,7 @@