Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

L10n support with english default #15

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions stubs/auth/resources/lang/en/auth.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php

return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'failed' => 'These credentials do not match our records.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
'passwords' => [
'confirm' => [
'title' => 'Confirm your password',
'subtitle' => 'Please continue your password before continuing',
'forgot_password_link' => 'Forgot your password?',
'confirm_password_action' => 'Confirm password'
],
'email' => [
'title' => 'Reset password',
'send_password_reset_link_action' => 'Send password reset link'
],
'reset' => [
'title' => 'Reset password',
'confirm_password_action' => 'Confirm Password',
'reset_password_action' => 'Reset Password'
],
],
'login' => [
'title' => 'Sign in to your account',
'subtitle' => [
'pre' => 'Or',
'link' => 'create a new account',
],
'remember_label' => 'Remember',
'forgot_password_link' => 'Forgot your password?',
'sign_in_action' => 'Sign in',
],
'register' => [
'title' => 'Create a new account',
'subtitle' => [
'pre' => 'Or',
'link' => 'sign in to your account',
],
'confirm_password_label' => 'Confirm Password',
'register_action' => 'Register'
],
'verify' => [
'title' => 'Verify your email address',
'subtitle' => [
'pre' => 'Or',
'link' => 'sign out',
],
'resent_verification_link' => 'A fresh verification link has been sent to your email address.',
'check_email_for_link' => 'Before proceeding, please check your email for a verification link.',
'email_not_received' => [
'pre' => 'If you did not receive the email, ',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get why this is done, but it doesn't necessarily work to have "pre" and "link" text separately like this. It works for what the current English text is, but that won't be the case for every language.

What I prefer doing for things like this is to use parameters where I can, which lets the translator move it about and put text before or after the link if they need to:

'email_not_received' => 'If you did not receive the email, :link.',
'email_not_received_link_text' => 'click here to request another',

That does make it a bit more awkward to handle how to actually put the anchor HTML in there though.

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't feel right to me but I get your point.

Do you have any experience in doing this? I'm quite clueless on this right now.

'link' => 'click here to request another.',
]
],
'links' => [
'register' => 'Register',
'login' => 'Login',
'logout' => 'Log out'
],
'labels' => [
'email' => 'Email address',
'password' => 'Password',
'username' => 'Name',
],
];
2 changes: 1 addition & 1 deletion stubs/auth/resources/views/auth/login.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@extends('layouts.auth')
@section('title', 'Sign in to your account')
@section('title', __('auth.login.title'))

@section('content')
<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@extends('layouts.auth')
@section('title', 'Confirm your password')
@section('title', __('auth.passwords.confirm.title'))

@section('content')
<div>
Expand Down
2 changes: 1 addition & 1 deletion stubs/auth/resources/views/auth/passwords/email.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@extends('layouts.auth')
@section('title', 'Reset password')
@section('title', __('auth.passwords.email.title'))

@section('content')
<div>
Expand Down
2 changes: 1 addition & 1 deletion stubs/auth/resources/views/auth/passwords/reset.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@extends('layouts.auth')
@section('title', 'Reset password')
@section('title', __('auth.passwords.reset.title'))

@section('content')
<div>
Expand Down
2 changes: 1 addition & 1 deletion stubs/auth/resources/views/auth/register.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@extends('layouts.auth')
@section('title', 'Create a new account')
@section('title', __('auth.register.title'))

@section('content')
<div>
Expand Down
2 changes: 1 addition & 1 deletion stubs/auth/resources/views/auth/verify.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@extends('layouts.auth')
@section('title', 'Verify your email address')
@section('title', __('auth.verify.title'))

@section('content')
<div>
Expand Down
34 changes: 17 additions & 17 deletions stubs/auth/resources/views/livewire/auth/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<x-logo class="w-auto h-16 mx-auto text-indigo-600" />
</a>

<h2 class="mt-6 text-3xl font-extrabold text-center text-gray-900 leading-9">
Sign in to your account
<h2 class="mt-6 text-3xl font-extrabold leading-9 text-center text-gray-900">
{{ __('auth.login.title') }}
</h2>
<p class="mt-2 text-sm text-center text-gray-600 leading-5 max-w">
Or
<a href="{{ route('register') }}" class="font-medium text-indigo-600 hover:text-indigo-500 focus:outline-none focus:underline transition ease-in-out duration-150">
create a new account
<p class="mt-2 text-sm leading-5 text-center text-gray-600 max-w">
{{ __('auth.login.subtitle.pre') }}
<a href="{{ route('register') }}" class="font-medium text-indigo-600 transition duration-150 ease-in-out hover:text-indigo-500 focus:outline-none focus:underline">
{{ __('auth.login.subtitle.link') }}
</a>
</p>
</div>
Expand All @@ -19,8 +19,8 @@
<div class="px-4 py-8 bg-white shadow sm:rounded-lg sm:px-10">
<form wire:submit.prevent="authenticate">
<div>
<label for="email" class="block text-sm font-medium text-gray-700 leading-5">
Email address
<label for="email" class="block text-sm font-medium leading-5 text-gray-700">
{{ __('auth.labels.email') }}
</label>

<div class="mt-1 rounded-md shadow-sm">
Expand All @@ -33,8 +33,8 @@
</div>

<div class="mt-6">
<label for="password" class="block text-sm font-medium text-gray-700 leading-5">
Password
<label for="password" class="block text-sm font-medium leading-5 text-gray-700">
{{ __('auth.labels.password') }}
</label>

<div class="mt-1 rounded-md shadow-sm">
Expand All @@ -48,23 +48,23 @@

<div class="flex items-center justify-between mt-6">
<div class="flex items-center">
<input wire:model.lazy="remember" id="remember" type="checkbox" class="form-checkbox w-4 h-4 text-indigo-600 transition duration-150 ease-in-out" />
<label for="remember" class="block ml-2 text-sm text-gray-900 leading-5">
Remember
<input wire:model.lazy="remember" id="remember" type="checkbox" class="w-4 h-4 text-indigo-600 transition duration-150 ease-in-out form-checkbox" />
<label for="remember" class="block ml-2 text-sm leading-5 text-gray-900">
{{ __('auth.login.remember_label') }}
</label>
</div>

<div class="text-sm leading-5">
<a href="{{ route('password.request') }}" class="font-medium text-indigo-600 hover:text-indigo-500 focus:outline-none focus:underline transition ease-in-out duration-150">
Forgot your password?
<a href="{{ route('password.request') }}" class="font-medium text-indigo-600 transition duration-150 ease-in-out hover:text-indigo-500 focus:outline-none focus:underline">
{{ __('auth.forgot_password_link') }}
</a>
</div>
</div>

<div class="mt-6">
<span class="block w-full rounded-md shadow-sm">
<button type="submit" class="flex justify-center w-full px-4 py-2 text-sm font-medium text-white bg-indigo-600 border border-transparent rounded-md hover:bg-indigo-500 focus:outline-none focus:border-indigo-700 focus:shadow-outline-indigo active:bg-indigo-700 transition duration-150 ease-in-out">
Sign in
<button type="submit" class="flex justify-center w-full px-4 py-2 text-sm font-medium text-white transition duration-150 ease-in-out bg-indigo-600 border border-transparent rounded-md hover:bg-indigo-500 focus:outline-none focus:border-indigo-700 focus:shadow-outline-indigo active:bg-indigo-700">
{{ __('auth.login.sign_in_action') }}
</button>
</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
<x-logo class="w-auto h-16 mx-auto text-indigo-600" />
</a>

<h2 class="mt-6 text-3xl font-extrabold text-center text-gray-900 leading-9">
Confirm your password
<h2 class="mt-6 text-3xl font-extrabold leading-9 text-center text-gray-900">
{{ __('auth.passwords.confirm.title') }}
</h2>
<p class="mt-2 text-sm text-center text-gray-600 leading-5 max-w">
Please confirm your password before continuing
<p class="mt-2 text-sm leading-5 text-center text-gray-600 max-w">
{{ __('auth.passwords.confirm.subtitle') }}
</p>
</div>

<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
<div class="px-4 py-8 bg-white shadow sm:rounded-lg sm:px-10">
<form wire:submit.prevent="confirm">
<div>
<label for="password" class="block text-sm font-medium text-gray-700 leading-5">
Password
<label for="password" class="block text-sm font-medium leading-5 text-gray-700">
{{ __('auth.labels.password') }}
</label>

<div class="mt-1 rounded-md shadow-sm">
Expand All @@ -31,16 +31,16 @@

<div class="flex items-center justify-end mt-6">
<div class="text-sm leading-5">
<a href="{{ route('password.request') }}" class="font-medium text-indigo-600 hover:text-indigo-500 focus:outline-none focus:underline transition ease-in-out duration-150">
Forgot your password?
<a href="{{ route('password.request') }}" class="font-medium text-indigo-600 transition duration-150 ease-in-out hover:text-indigo-500 focus:outline-none focus:underline">
{{ __('auth.passwords.confirm.forgot_password_link') }}
</a>
</div>
</div>

<div class="mt-6">
<span class="block w-full rounded-md shadow-sm">
<button type="submit" class="flex justify-center w-full px-4 py-2 text-sm font-medium text-white bg-indigo-600 border border-transparent rounded-md hover:bg-indigo-500 focus:outline-none focus:border-indigo-700 focus:shadow-outline-indigo active:bg-indigo-700 transition duration-150 ease-in-out">
Confirm password
<button type="submit" class="flex justify-center w-full px-4 py-2 text-sm font-medium text-white transition duration-150 ease-in-out bg-indigo-600 border border-transparent rounded-md hover:bg-indigo-500 focus:outline-none focus:border-indigo-700 focus:shadow-outline-indigo active:bg-indigo-700">
{{ __('auth.passwords.confirm.confirm_password_action') }}
</button>
</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
<x-logo class="w-auto h-16 mx-auto text-indigo-600" />
</a>

<h2 class="mt-6 text-3xl font-extrabold text-center text-gray-900 leading-9">
Reset password
<h2 class="mt-6 text-3xl font-extrabold leading-9 text-center text-gray-900">
{{ __('auth.passwords.email.title') }}
</h2>
</div>

<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
<div class="px-4 py-8 bg-white shadow sm:rounded-lg sm:px-10">
@if ($emailSentMessage)
<div class="rounded-md bg-green-50 p-4">
<div class="p-4 rounded-md bg-green-50">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-green-400" fill="currentColor" viewBox="0 0 20 20">
<svg class="w-5 h-5 text-green-400" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
</svg>
</div>

<div class="ml-3">
<p class="text-sm leading-5 font-medium text-green-800">
<p class="text-sm font-medium leading-5 text-green-800">
{{ $emailSentMessage }}
</p>
</div>
Expand All @@ -30,8 +30,8 @@
@else
<form wire:submit.prevent="sendResetPasswordLink">
<div>
<label for="email" class="block text-sm font-medium text-gray-700 leading-5">
Email address
<label for="email" class="block text-sm font-medium leading-5 text-gray-700">
{{ __('auth.labels.email') }}
</label>

<div class="mt-1 rounded-md shadow-sm">
Expand All @@ -45,8 +45,8 @@

<div class="mt-6">
<span class="block w-full rounded-md shadow-sm">
<button type="submit" class="flex justify-center w-full px-4 py-2 text-sm font-medium text-white bg-indigo-600 border border-transparent rounded-md hover:bg-indigo-500 focus:outline-none focus:border-indigo-700 focus:shadow-outline-indigo active:bg-indigo-700 transition duration-150 ease-in-out">
Send password reset link
<button type="submit" class="flex justify-center w-full px-4 py-2 text-sm font-medium text-white transition duration-150 ease-in-out bg-indigo-600 border border-transparent rounded-md hover:bg-indigo-500 focus:outline-none focus:border-indigo-700 focus:shadow-outline-indigo active:bg-indigo-700">
{{ __('auth.passwords.email.send_password_reset_link_action') }}
</button>
</span>
</div>
Expand Down
22 changes: 11 additions & 11 deletions stubs/auth/resources/views/livewire/auth/passwords/reset.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<x-logo class="w-auto h-16 mx-auto text-indigo-600" />
</a>

<h2 class="mt-6 text-3xl font-extrabold text-center text-gray-900 leading-9">
Reset password
<h2 class="mt-6 text-3xl font-extrabold leading-9 text-center text-gray-900">
{{ __('auth.passwords.reset.title') }}
</h2>
</div>

Expand All @@ -15,8 +15,8 @@
<input wire:model="token" type="hidden">

<div>
<label for="email" class="block text-sm font-medium text-gray-700 leading-5">
Email address
<label for="email" class="block text-sm font-medium leading-5 text-gray-700">
{{ __('auth.labels.email') }}
</label>

<div class="mt-1 rounded-md shadow-sm">
Expand All @@ -29,8 +29,8 @@
</div>

<div class="mt-6">
<label for="password" class="block text-sm font-medium text-gray-700 leading-5">
Password
<label for="password" class="block text-sm font-medium leading-5 text-gray-700">
{{ __('auth.labels.password') }}
</label>

<div class="mt-1 rounded-md shadow-sm">
Expand All @@ -43,19 +43,19 @@
</div>

<div class="mt-6">
<label for="password_confirmation" class="block text-sm font-medium text-gray-700 leading-5">
Confirm Password
<label for="password_confirmation" class="block text-sm font-medium leading-5 text-gray-700">
{{ __('auth.passwords.reset.confirm_password_action') }}
</label>

<div class="mt-1 rounded-md shadow-sm">
<input wire:model.lazy="passwordConfirmation" id="password_confirmation" type="password" required class="block w-full px-3 py-2 placeholder-gray-400 border border-gray-300 appearance-none rounded-md focus:outline-none focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:text-sm sm:leading-5" />
<input wire:model.lazy="passwordConfirmation" id="password_confirmation" type="password" required class="block w-full px-3 py-2 placeholder-gray-400 transition duration-150 ease-in-out border border-gray-300 rounded-md appearance-none focus:outline-none focus:shadow-outline-blue focus:border-blue-300 sm:text-sm sm:leading-5" />
</div>
</div>

<div class="mt-6">
<span class="block w-full rounded-md shadow-sm">
<button type="submit" class="flex justify-center w-full px-4 py-2 text-sm font-medium text-white bg-indigo-600 border border-transparent rounded-md hover:bg-indigo-500 focus:outline-none focus:border-indigo-700 focus:shadow-outline-indigo active:bg-indigo-700 transition duration-150 ease-in-out">
Reset password
<button type="submit" class="flex justify-center w-full px-4 py-2 text-sm font-medium text-white transition duration-150 ease-in-out bg-indigo-600 border border-transparent rounded-md hover:bg-indigo-500 focus:outline-none focus:border-indigo-700 focus:shadow-outline-indigo active:bg-indigo-700">
{{ __('auth.passwords.reset.reset_password_action') }}
</button>
</span>
</div>
Expand Down
Loading