Skip to content

Commit

Permalink
Merge pull request #5 from abdessamadbettal/profile-localization
Browse files Browse the repository at this point in the history
Profile localization
  • Loading branch information
abdessamadbettal authored Dec 4, 2024
2 parents 1626c12 + b89dcfa commit e7b7dc9
Show file tree
Hide file tree
Showing 15 changed files with 168 additions and 76 deletions.
23 changes: 22 additions & 1 deletion lang/ar/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,26 @@
'profile' => 'الملف الشخصي',
'logout' => 'تسجيل الخروج',
'login' => 'تسجيل الدخول',
'register' => 'تسجيل',
'password_confirmation' => 'تأكيد كلمة المرور',
'forgot_password' => 'نسيت كلمة المرور',
'forgot_password_message' => 'هل نسيت كلمة المرور؟ لا مشكلة. فقط أخبرنا بعنوان بريدك الإلكتروني وسنرسل لك رابط إعادة تعيين كلمة المرور الذي سيسمح لك باختيار كلمة مرور جديدة.',
'email_password_reset_link' => 'إرسال رابط إعادة تعيين كلمة المرور',
'reset_password' => 'إعادة تعيين كلمة المرور',
'profile_information' => 'معلومات الملف الشخصي',
'update_profile_information' => 'قم بتحديث معلومات الملف الشخصي وعنوان البريد الإلكتروني لحسابك.',
'email_unverified' => 'عنوان بريدك الإلكتروني غير مؤكد.',
'resend_verification_email' => 'انقر هنا لإعادة إرسال بريد التحقق.',
'verification_link_sent' => 'تم إرسال رابط تحقق جديد إلى عنوان بريدك الإلكتروني.',
'save' => 'حفظ',
'saved' => 'تم الحفظ.',
'update_password' => 'تحديث كلمة المرور',
'ensure_password' => 'تأكد من أن حسابك يستخدم كلمة مرور طويلة وعشوائية للبقاء آمنًا.',
'current_password' => 'كلمة المرور الحالية',
'new_password' => 'كلمة المرور الجديدة',
'delete_account' => 'حذف الحساب',
'delete_account_warning' => 'بمجرد حذف حسابك، سيتم حذف جميع موارده وبياناته بشكل دائم. قبل حذف حسابك، يرجى تنزيل أي بيانات أو معلومات ترغب في الاحتفاظ بها.',
'delete_account_confirmation' => 'هل أنت متأكد أنك تريد حذف حسابك؟',
'delete_account_password_confirmation' => 'بمجرد حذف حسابك، سيتم حذف جميع موارده وبياناته بشكل دائم. يرجى إدخال كلمة المرور الخاصة بك لتأكيد أنك ترغب في حذف حسابك بشكل دائم.',
'password' => 'كلمة المرور',
'cancel' => 'إلغاء',
];
23 changes: 22 additions & 1 deletion lang/en/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,27 @@
'profile' => 'Profile',
'logout' => 'Log Out',
'login' => 'Login',
'register' => 'Register',
'password_confirmation' => 'Confirm Password',
'forgot_password' => 'Forgot Password',
'forgot_password_message' => 'Forgot your password? No problem. Just let us know your email address and we will email you a password reset link that will allow you to choose a new one.',
'email_password_reset_link' => 'Email Password Reset Link',
'reset_password' => 'Reset Password',
'profile_information' => 'Profile Information',
'update_profile_information' => 'Update your account\'s profile information and email address.',
'email_unverified' => 'Your email address is unverified.',
'resend_verification_email' => 'Click here to re-send the verification email.',
'verification_link_sent' => 'A new verification link has been sent to your email address.',
'save' => 'Save',
'saved' => 'Saved.',
'update_password' => 'Update Password',
'ensure_password' => 'Ensure your account is using a long, random password to stay secure.',
'current_password' => 'Current Password',
'new_password' => 'New Password',
'delete_account' => 'Delete Account',
'delete_account_warning' => '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.',
'delete_account_confirmation' => 'Are you sure you want to delete your account?',
'delete_account_password_confirmation' => '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.',
'password' => 'Password',
'cancel' => 'Cancel',

];
22 changes: 22 additions & 0 deletions lang/es/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,27 @@
'logout' => 'Cerrar sesión',
'login' => 'Iniciar sesión',
'register' => 'Registrarse',
'password_confirmation' => 'Confirmar contraseña',
'forgot_password' => '¿Olvidaste tu contraseña?',
'forgot_password_message' => '¿Olvidaste tu contraseña? No hay problema. Simplemente háganos saber su dirección de correo electrónico y le enviaremos un enlace de restablecimiento de contraseña que le permitirá elegir una nueva.',
'email_password_reset_link' => 'Enviar enlace de restablecimiento de contraseña',
'reset_password' => 'Restablecer la contraseña',
'profile_information' => 'Información del perfil',
'update_profile_information' => 'Actualice la información del perfil y la dirección de correo electrónico de su cuenta.',
'email_unverified' => 'Su dirección de correo electrónico no está verificada.',
'resend_verification_email' => 'Haga clic aquí para reenviar el correo electrónico de verificación.',
'verification_link_sent' => 'Se ha enviado un nuevo enlace de verificación a su dirección de correo electrónico.',
'save' => 'Guardar',
'saved' => 'Guardado.',
'update_password' => 'Actualizar contraseña',
'ensure_password' => 'Asegúrese de que su cuenta esté utilizando una contraseña larga y aleatoria para mantenerse seguro.',
'current_password' => 'Contraseña actual',
'new_password' => 'Nueva contraseña',
'delete_account' => 'Eliminar cuenta',
'delete_account_warning' => 'Una vez que su cuenta sea eliminada, todos sus recursos y datos serán eliminados permanentemente. Antes de eliminar su cuenta, descargue cualquier dato o información que desee conservar.',
'delete_account_confirmation' => '¿Está seguro de que desea eliminar su cuenta?',
'delete_account_password_confirmation' => 'Una vez que su cuenta sea eliminada, todos sus recursos y datos serán eliminados permanentemente. Por favor, ingrese su contraseña para confirmar que desea eliminar permanentemente su cuenta.',
'password' => 'Contraseña',
'cancel' => 'Cancelar',

];
23 changes: 22 additions & 1 deletion lang/fr/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,27 @@
'profile' => 'Profil',
'logout' => 'Se déconnecter',
'login' => 'Se connecter',
'register' => 'S\'inscrire',
'password_confirmation' => 'Confirmer le mot de passe',
'forgot_password' => 'Mot de passe oublié',
'forgot_password_message' => 'Vous avez oublié votre mot de passe ? Pas de problème. Faites-nous simplement savoir votre adresse e-mail et nous vous enverrons un lien de réinitialisation de mot de passe qui vous permettra d\'en choisir un nouveau.',
'email_password_reset_link' => 'Envoyer le lien de réinitialisation du mot de passe',
'reset_password' => 'Réinitialiser le mot de passe',
'profile_information' => 'Informations du profil',
'update_profile_information' => 'Mettez à jour les informations de profil et l\'adresse e-mail de votre compte.',
'name' => 'Nom',
'email' => 'Email',
'verification_link_sent' => 'Un nouveau lien de vérification a été envoyé à votre adresse e-mail.',
'save' => 'Enregistrer',
'saved' => 'Enregistré.',
'update_password' => 'Mettre à jour le mot de passe',
'ensure_password' => 'Assurez-vous que votre compte utilise un mot de passe long et aléatoire pour rester sécurisé.',
'current_password' => 'Mot de passe actuel',
'new_password' => 'Nouveau mot de passe',
'delete_account' => 'Supprimer le compte',
'delete_account_warning' => 'Une fois votre compte supprimé, toutes ses ressources et données seront définitivement supprimées. Avant de supprimer votre compte, veuillez télécharger toutes les données ou informations que vous souhaitez conserver.',
'delete_account_confirmation' => 'Êtes-vous sûr de vouloir supprimer votre compte?',
'delete_account_password_confirmation' => 'Une fois votre compte supprimé, toutes ses ressources et données seront définitivement supprimées. Veuillez entrer votre mot de passe pour confirmer que vous souhaitez supprimer définitivement votre compte.',
'password' => 'Mot de passe',
'cancel' => 'Annuler',

];
2 changes: 1 addition & 1 deletion resources/js/Components/Home/Hero.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const props = defineProps({
{{ trans('home.hero_description') }}
</p>
<div class="mt-10 flex justify-center gap-x-6">
<Button href="/register">{{ trans('home.get_started') }}</Button>
<Button :href="route('register')">{{ trans('home.get_started') }}</Button>
<Button href="https://github.com/abdessamadbettal/laravel-starter" variant="outline">
{{ trans('home.view_on_github') }}
</Button>
Expand Down
18 changes: 11 additions & 7 deletions resources/js/Components/LanguageSwitcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { computed, ref } from 'vue'
import { router as inertiaRouter } from '@inertiajs/vue3'
import Dropdown from '@/Components/Forms/Dropdown.vue';
import DropdownLink from '@/Components/DropdownLink.vue';
import { loadLanguageAsync, getActiveLanguage } from 'laravel-vue-i18n';
const props = defineProps(['locales', 'currentLocale'])
Expand Down Expand Up @@ -65,16 +66,19 @@ function getLanguageUrl(langCode) {
function changeLanguage(lang) {
const newPath = getLanguageUrl(lang.code)
// Reload the page with the new language
window.location.href = newPath;
// Load the new language
loadLanguageAsync(lang.code)
// TODO: should change lang without reload page
// inertiaRouter.visit(newPath, {
// inertiaRouter.post('/change-language', { locale: lang.code }, {
// preserveScroll: true, // Optionally preserve scroll position
// preserveState: false, // Reload state to reflect new locale
// headers: {
// 'X-Locale': lang.code, // Optional, in case you want to pass locale explicitly
// },
// });
// Reload the page with the new language
window.location.href = newPath;
}
</script>
11 changes: 5 additions & 6 deletions resources/js/Pages/Auth/ForgotPassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import InputLabel from '@/Components/Forms/InputLabel.vue';
import Button from '@/Components/Button.vue';
import TextInput from '@/Components/Forms/TextInput.vue';
import { Head, useForm } from '@inertiajs/vue3';
import { trans } from 'laravel-vue-i18n';
defineProps({
status: {
Expand All @@ -23,12 +24,10 @@ const submit = () => {

<template>
<GuestLayout>
<Head title="Forgot Password" />
<Head :title="trans('auth.forgot_password')" />

<div class="mb-4 text-sm text-gray-600 dark:text-gray-400">
Forgot your password? No problem. Just let us know your email
address and we will email you a password reset link that will allow
you to choose a new one.
{{ trans('auth.forgot_password_message') }}
</div>

<div
Expand All @@ -40,7 +39,7 @@ const submit = () => {

<form @submit.prevent="submit">
<div>
<InputLabel for="email" value="Email" />
<InputLabel for="email" :value="trans('auth.email')" />

<TextInput
id="email"
Expand All @@ -59,7 +58,7 @@ const submit = () => {
<Button
:isLoading="form.processing"
>
Email Password Reset Link
{{ trans('auth.email_password_reset_link') }}
</Button>
</div>
</form>
Expand Down
17 changes: 9 additions & 8 deletions resources/js/Pages/Auth/Register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Button from '@/Components/Button.vue';
import TextInput from '@/Components/Forms/TextInput.vue';
import { Head, Link, useForm } from '@inertiajs/vue3';
import ProvidersAuth from './Partials/ProvidersAuth.vue';
import { trans } from 'laravel-vue-i18n';
const form = useForm({
name: '',
Expand All @@ -23,13 +24,13 @@ const submit = () => {

<template>
<GuestLayout>
<Head title="Register" />
<Head :title="trans('auth.register')" />

<ProvidersAuth />

<form @submit.prevent="submit">
<div>
<InputLabel for="name" value="Name" />
<InputLabel for="name" :value="trans('auth.name')" />

<TextInput
id="name"
Expand All @@ -45,7 +46,7 @@ const submit = () => {
</div>

<div class="mt-4">
<InputLabel for="email" value="Email" />
<InputLabel for="email" :value="trans('auth.email')" />

<TextInput
id="email"
Expand All @@ -60,7 +61,7 @@ const submit = () => {
</div>

<div class="mt-4">
<InputLabel for="password" value="Password" />
<InputLabel for="password" :value="trans('auth.password')" />

<TextInput
id="password"
Expand All @@ -77,7 +78,7 @@ const submit = () => {
<div class="mt-4">
<InputLabel
for="password_confirmation"
value="Confirm Password"
:value="trans('auth.password_confirmation')"
/>

<TextInput
Expand All @@ -97,17 +98,17 @@ const submit = () => {

<div class="mt-4 flex items-center justify-end">
<Link
:href="route('login')"
:href="route('login')"ait
class="rounded-md text-sm text-gray-600 underline hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:text-gray-400 dark:hover:text-gray-100 dark:focus:ring-offset-gray-800"
>
Already registered?
{{ trans('auth.already_registered') }}
</Link>

<Button
class="ms-4"
:isLoading="form.processing"
>
Register
{{ trans('auth.register') }}
</Button>
</div>
</form>
Expand Down
11 changes: 6 additions & 5 deletions resources/js/Pages/Auth/ResetPassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import InputLabel from '@/Components/Forms/InputLabel.vue';
import Button from '@/Components/Button.vue';
import TextInput from '@/Components/Forms/TextInput.vue';
import { Head, useForm } from '@inertiajs/vue3';
import { trans } from 'laravel-vue-i18n';
const props = defineProps({
email: {
Expand Down Expand Up @@ -33,11 +34,11 @@ const submit = () => {

<template>
<GuestLayout>
<Head title="Reset Password" />
<Head :title="trans('auth.reset_password')" />

<form @submit.prevent="submit">
<div>
<InputLabel for="email" value="Email" />
<InputLabel for="email" :value="trans('auth.email')" />

<TextInput
id="email"
Expand All @@ -53,7 +54,7 @@ const submit = () => {
</div>

<div class="mt-4">
<InputLabel for="password" value="Password" />
<InputLabel for="password" :value="trans('auth.password')" />

<TextInput
id="password"
Expand All @@ -70,7 +71,7 @@ const submit = () => {
<div class="mt-4">
<InputLabel
for="password_confirmation"
value="Confirm Password"
:value="trans('auth.password_confirmation')"
/>

<TextInput
Expand All @@ -92,7 +93,7 @@ const submit = () => {
<Button
:isLoading="form.processing"
>
Reset Password
{{ trans('auth.reset_password') }}
</Button>
</div>
</form>
Expand Down
Loading

0 comments on commit e7b7dc9

Please sign in to comment.