diff --git a/CHANGELOG.md b/CHANGELOG.md index 3949cc81..34cbc8f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning. +## [Unreleased] + +### Added +- The `comments.added` and `comments.deleted` texts, in English and Spanish, for the flash messages of the framework's `DemoWeb` comment controller. They were called but never defined, so the page showed the key names (#216). + +### Changed +- The translations in `shared/resources/lang/{en,es}` are split by topic, as the `DemoWeb` and `DemoApi` module templates of quantum/framework 3.1.2 expect: `pages`, `auth`, `account`, `posts`, `comments`, `actions` and `lang`. The texts are unchanged. `common` keeps the keys the framework reads by name: `activate_account`, `reset_password`, `otp`, `pagination` and the field labels the validator reads as `common.`. The email views in `shared/views/email` use the new keys, for example `auth.activate` instead of `common.activate`. A module generated by framework 3.1.2 or newer needs these files; modules generated earlier call the old `common` keys (#216). + ## [3.1.1] - 2026-11-03 ### Added diff --git a/composer.json b/composer.json index d50bf56a..3e02b8cd 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "type": "project", "require": { "php": "^8.1", - "quantum/framework": "^3.1", + "quantum/framework": "3.1.*@dev", "fakerphp/faker": "^1.15", "bluemmb/faker-picsum-photos-provider": "^2.0", "ottaviano/faker-gravatar": "^0.3.0", diff --git a/shared/resources/lang/en/account.php b/shared/resources/lang/en/account.php new file mode 100644 index 00000000..aa3e08c8 --- /dev/null +++ b/shared/resources/lang/en/account.php @@ -0,0 +1,6 @@ + 'Account Settings', + 'profile' => 'Profile', +]; diff --git a/shared/resources/lang/en/actions.php b/shared/resources/lang/en/actions.php new file mode 100644 index 00000000..7e41f83b --- /dev/null +++ b/shared/resources/lang/en/actions.php @@ -0,0 +1,14 @@ + 'Send', + 'reset' => 'Reset', + 'cancel' => 'Cancel', + 'save' => 'Save', + 'delete' => 'Delete', + 'edit' => 'Edit', + 'yes' => 'Yes', + 'created_successfully' => 'Created successfully', + 'updated_successfully' => 'Updated successfully', + 'deleted_successfully' => 'Deleted successfully', +]; diff --git a/shared/resources/lang/en/auth.php b/shared/resources/lang/en/auth.php new file mode 100644 index 00000000..7a38e58e --- /dev/null +++ b/shared/resources/lang/en/auth.php @@ -0,0 +1,19 @@ + 'Sign In', + 'signup' => 'Sign Up', + 'signout' => 'Sign Out', + 'activate' => 'Activate', + 'activation_email_content' => 'Activate your account by clicking the button below', + 'account_activated' => 'Account is activated', + 'remember_me' => 'Remember Me', + 'forget_password' => 'Forgot password?', + 'reset_password_email_content' => 'Reset your password by clicking the button below', + 'check_email' => 'Check your email to reset your password', + 'check_email_signup' => 'Registration was successful, please check your email', + 'successfully_signed_up' => 'Successfully signed up', + 'verification_code' => 'Verification Code', + 'two_fa' => '2 Factor Authentication', + 'resend_otp' => 'Resend otp', +]; diff --git a/shared/resources/lang/en/comments.php b/shared/resources/lang/en/comments.php new file mode 100644 index 00000000..87968dca --- /dev/null +++ b/shared/resources/lang/en/comments.php @@ -0,0 +1,11 @@ + 'Comment', + 'title' => 'Comments', + 'login_to_comment' => 'Login to comment', + 'leave_a_comment' => 'Leave a comment', + 'no_comments' => 'No comments', + 'added' => 'Comment added', + 'deleted' => 'Comment deleted', +]; diff --git a/shared/resources/lang/en/common.php b/shared/resources/lang/en/common.php index 3bcbaff5..3898f2d1 100644 --- a/shared/resources/lang/en/common.php +++ b/shared/resources/lang/en/common.php @@ -1,112 +1,24 @@ 'Very fast and extremely simple, next generation PHP MVC framework with modular structure.', - 'about_framework' => 'Quantum is a free, open-source PHP web framework under MIT license, specially designed to develop very fast web applications with modular structure. With Quantum it’s easy to start any kind of project immediately, whether it\'s regular websites or complex API based service, at the same time it allows to keep the code clean, organized through all the development process.', - 'version' => 'Version', - 'current_version' => 'Current version is: {%1}', - 'cli_commands' => 'Quantum CLI Commands', - - // ───── Star on GitHub ───────────────────────────────────── - 'star' => [ - 'message' => 'Would you like to show some love by starring Quantum on GitHub?', - 'button' => 'Star on GitHub', - 'badge_alt' => 'GitHub stars', - ], - - // ───── Navigation ───────────────────────────────────────── - 'home' => 'Home', - 'about' => 'About', - 'installation' => 'Installation', - 'learn_more' => 'Learn More', - - // ───── Project creation / commands ─────────────────────── - 'create_project' => 'Create new project', - 'run_server' => 'Run the project', - - // ───── Auth / User Management ───────────────────────────── 'captcha' => 'Captcha', - 'signin' => 'Sign In', - 'signup' => 'Sign Up', - 'activate' => 'Activate', - 'activation_email_content' => 'Activate your account by clicking the button below', 'activate_account' => 'Activate account', - 'account_activated' => 'Account is activated', - 'signout' => 'Sign Out', - 'remember_me' => 'Remember Me', - 'forget_password' => 'Forgot password?', 'reset_password' => 'Reset password', - 'reset_password_email_content' => 'Reset your password by clicking the button below', 'repeat_password' => 'Repeat password', - 'check_email_signup' => 'Registration was successful, please check your email', - 'check_email' => 'Check your email to reset your password', - 'successfully_signed_up' => 'Successfully signed up', - - // ───── User fields ───────────────────────────────────────── 'email' => 'Email', 'token' => 'Token', 'password' => 'Password', - 'verification_code' => 'Verification Code', 'new_password' => 'New password', 'firstname' => 'First name', 'lastname' => 'Last name', - - // ───── Buttons ──────────────────────────────────────────── - 'send' => 'Send', - 'reset' => 'Reset', - 'cancel' => 'Cancel', - 'save' => 'Save', - 'delete' => 'Delete', - 'edit' => 'Edit', - 'yes' => 'Yes', - - // ───── Account settings ─────────────────────────────────── - 'account_settings' => 'Account Settings', - 'profile' => 'Profile', 'current_password' => 'Current Password', 'confirm_password' => 'Confirm Password', - - // ───── Posts ────────────────────────────────────────────── - 'posts' => 'Posts', - 'my_posts' => 'My Posts', - 'new_post' => 'New Post', 'title' => 'Title', 'content' => 'Content', 'image' => 'image', - 'post' => 'post', - - 'created_successfully' => 'Created successfully', - 'updated_successfully' => 'Updated successfully', - 'deleted_successfully' => 'Deleted successfully', - 'update_post' => 'Update Post', - 'confirm_delete' => 'Are you sure you want to delete the {%1} ?', - 'post_not_found' => 'Post not found', - 'no_posts' => 'No posts found', - 'try_creating' => 'Try creating a new one', - - // ───── Pagination ───────────────────────────────────────── 'pagination' => [ 'next' => 'Next »', 'prev' => '« Prev', ], - - // ───── Comments ─────────────────────────────────────────── - 'comments' => [ - 'submit_comment' => 'Comment', - 'title' => 'Comments', - 'login_to_comment' => 'Login to comment', - 'leave_a_comment' => 'Leave a comment', - 'no_comments' => 'No comments', - ], - - // ───── 2FA / OTP ────────────────────────────────────────── 'otp' => 'One Time Password', - 'two_fa' => '2 Factor Authentication', - 'resend_otp' => 'Resend otp', - - // ───── Languages ────────────────────────────────────────── - 'en' => 'English', - 'es' => 'Spanish', ]; diff --git a/shared/resources/lang/en/lang.php b/shared/resources/lang/en/lang.php new file mode 100644 index 00000000..1dd80e16 --- /dev/null +++ b/shared/resources/lang/en/lang.php @@ -0,0 +1,6 @@ + 'English', + 'es' => 'Spanish', +]; diff --git a/shared/resources/lang/en/pages.php b/shared/resources/lang/en/pages.php new file mode 100644 index 00000000..ed2d359a --- /dev/null +++ b/shared/resources/lang/en/pages.php @@ -0,0 +1,20 @@ + 'Very fast and extremely simple, next generation PHP MVC framework with modular structure.', + 'about_framework' => 'Quantum is a free, open-source PHP web framework under MIT license, specially designed to develop very fast web applications with modular structure. With Quantum it’s easy to start any kind of project immediately, whether it\'s regular websites or complex API based service, at the same time it allows to keep the code clean, organized through all the development process.', + 'version' => 'Version', + 'current_version' => 'Current version is: {%1}', + 'cli_commands' => 'Quantum CLI Commands', + 'star' => [ + 'message' => 'Would you like to show some love by starring Quantum on GitHub?', + 'button' => 'Star on GitHub', + 'badge_alt' => 'GitHub stars', + ], + 'home' => 'Home', + 'about' => 'About', + 'installation' => 'Installation', + 'learn_more' => 'Learn More', + 'create_project' => 'Create new project', + 'run_server' => 'Run the project', +]; diff --git a/shared/resources/lang/en/posts.php b/shared/resources/lang/en/posts.php new file mode 100644 index 00000000..9043f405 --- /dev/null +++ b/shared/resources/lang/en/posts.php @@ -0,0 +1,13 @@ + 'Posts', + 'my_posts' => 'My Posts', + 'new_post' => 'New Post', + 'update_post' => 'Update Post', + 'post' => 'post', + 'post_not_found' => 'Post not found', + 'no_posts' => 'No posts found', + 'try_creating' => 'Try creating a new one', + 'confirm_delete' => 'Are you sure you want to delete the {%1} ?', +]; diff --git a/shared/resources/lang/es/account.php b/shared/resources/lang/es/account.php new file mode 100644 index 00000000..640acec6 --- /dev/null +++ b/shared/resources/lang/es/account.php @@ -0,0 +1,6 @@ + 'Configuración de la cuenta', + 'profile' => 'Perfil', +]; diff --git a/shared/resources/lang/es/actions.php b/shared/resources/lang/es/actions.php new file mode 100644 index 00000000..9ee0ba9b --- /dev/null +++ b/shared/resources/lang/es/actions.php @@ -0,0 +1,14 @@ + 'Enviar', + 'reset' => 'Restablecer', + 'cancel' => 'Cancelar', + 'save' => 'Guardar', + 'delete' => 'Eliminar', + 'edit' => 'Editar', + 'yes' => 'Sí', + 'created_successfully' => 'Creado exitosamente', + 'updated_successfully' => 'Actualizado exitosamente', + 'deleted_successfully' => 'Eliminado exitosamente', +]; diff --git a/shared/resources/lang/es/auth.php b/shared/resources/lang/es/auth.php new file mode 100644 index 00000000..98d3b0e2 --- /dev/null +++ b/shared/resources/lang/es/auth.php @@ -0,0 +1,19 @@ + 'Iniciar sesión', + 'signup' => 'Registrarse', + 'signout' => 'Cerrar sesión', + 'activate' => 'Activar', + 'activation_email_content' => 'Activa tu cuenta haciendo clic en el botón de abajo', + 'account_activated' => 'La cuenta ha sido activada', + 'remember_me' => 'Recuérdame', + 'forget_password' => '¿Olvidaste tu contraseña?', + 'reset_password_email_content' => 'Restablece tu contraseña haciendo clic en el botón de abajo', + 'check_email' => 'Revisa tu correo electrónico para restablecer tu contraseña', + 'check_email_signup' => 'Registro exitoso, por favor revisa tu correo electrónico', + 'successfully_signed_up' => 'Registrado con éxito', + 'verification_code' => 'Código de verificación', + 'two_fa' => 'Autenticación de dos factores', + 'resend_otp' => 'Reenviar OTP', +]; diff --git a/shared/resources/lang/es/comments.php b/shared/resources/lang/es/comments.php new file mode 100644 index 00000000..56e09c61 --- /dev/null +++ b/shared/resources/lang/es/comments.php @@ -0,0 +1,11 @@ + 'Comentar', + 'title' => 'Comentarios', + 'login_to_comment' => 'Inicia sesión para comentar', + 'leave_a_comment' => 'Deja un comentario', + 'no_comments' => 'Sin comentarios', + 'added' => 'Comentario añadido', + 'deleted' => 'Comentario eliminado', +]; diff --git a/shared/resources/lang/es/common.php b/shared/resources/lang/es/common.php index 9477a17a..23de0a6d 100644 --- a/shared/resources/lang/es/common.php +++ b/shared/resources/lang/es/common.php @@ -1,112 +1,24 @@ 'Framework MVC en PHP de nueva generación, muy rápido y extremadamente simple, con una estructura modular.', - 'about_framework' => 'Quantum es un framework web PHP gratuito y de código abierto bajo la licencia MIT, diseñado especialmente para desarrollar aplicaciones web muy rápidas con una estructura modular. Con Quantum es fácil iniciar de inmediato cualquier tipo de proyecto, ya sean sitios web tradicionales o servicios complejos basados en API, y al mismo tiempo permite mantener el código limpio y organizado durante todo el proceso de desarrollo.', - 'version' => 'Versión', - 'current_version' => 'La versión actual es: {%1}', - 'cli_commands' => 'Comandos CLI de Quantum', - - // ───── Star on GitHub ───────────────────────────────────── - 'star' => [ - 'message' => '¿Te gustaría mostrar tu apoyo dando una estrella a Quantum en GitHub?', - 'button' => 'Dar una estrella en GitHub', - 'badge_alt' => 'Estrellas en GitHub', - ], - - // ───── Navigation ───────────────────────────────────────── - 'home' => 'Inicio', - 'about' => 'Acerca de', - 'installation' => 'Instalación', - 'learn_more' => 'Aprender más', - - // ───── Project creation / commands ─────────────────────── - 'create_project' => 'Crear nuevo proyecto', - 'run_server' => 'Ejecutar el proyecto', - - // ───── Auth / User Management ───────────────────────────── 'captcha' => 'Captcha', - 'signin' => 'Iniciar sesión', - 'signup' => 'Registrarse', - 'activate' => 'Activar', - 'activation_email_content' => 'Activa tu cuenta haciendo clic en el botón de abajo', 'activate_account' => 'Activar cuenta', - 'account_activated' => 'La cuenta ha sido activada', - 'signout' => 'Cerrar sesión', - 'remember_me' => 'Recuérdame', - 'forget_password' => '¿Olvidaste tu contraseña?', 'reset_password' => 'Restablecer contraseña', - 'reset_password_email_content' => 'Restablece tu contraseña haciendo clic en el botón de abajo', 'repeat_password' => 'Repetir contraseña', - 'check_email_signup' => 'Registro exitoso, por favor revisa tu correo electrónico', - 'check_email' => 'Revisa tu correo electrónico para restablecer tu contraseña', - 'successfully_signed_up' => 'Registrado con éxito', - - // ───── User fields ───────────────────────────────────────── 'email' => 'Correo electrónico', 'token' => 'Token', 'password' => 'Contraseña', - 'verification_code' => 'Código de verificación', 'new_password' => 'Nueva contraseña', 'firstname' => 'Nombre', 'lastname' => 'Apellido', - - // ───── Buttons ──────────────────────────────────────────── - 'send' => 'Enviar', - 'reset' => 'Restablecer', - 'cancel' => 'Cancelar', - 'save' => 'Guardar', - 'delete' => 'Eliminar', - 'edit' => 'Editar', - 'yes' => 'Sí', - - // ───── Account settings ─────────────────────────────────── - 'account_settings' => 'Configuración de la cuenta', - 'profile' => 'Perfil', 'current_password' => 'Contraseña actual', 'confirm_password' => 'Confirmar contraseña', - - // ───── Posts ────────────────────────────────────────────── - 'posts' => 'Publicaciones', - 'my_posts' => 'Mis publicaciones', - 'new_post' => 'Nueva publicación', 'title' => 'Título', 'content' => 'Contenido', 'image' => 'Imagen', - 'post' => 'Publicación', - - 'created_successfully' => 'Creado exitosamente', - 'updated_successfully' => 'Actualizado exitosamente', - 'deleted_successfully' => 'Eliminado exitosamente', - 'update_post' => 'Actualizar publicación', - 'confirm_delete' => '¿Estás seguro de que deseas eliminar el {%1} ?', - 'post_not_found' => 'Publicación no encontrada', - 'no_posts' => 'No se encontraron publicaciones', - 'try_creating' => 'Intenta crear una nueva', - - // ───── Pagination ───────────────────────────────────────── 'pagination' => [ 'next' => 'Siguiente »', 'prev' => '« Anterior', ], - - // ───── Comments ─────────────────────────────────────────── - 'comments' => [ - 'submit_comment' => 'Comentar', - 'title' => 'Comentarios', - 'login_to_comment' => 'Inicia sesión para comentar', - 'leave_a_comment' => 'Deja un comentario', - 'no_comments' => 'Sin comentarios', - ], - - // ───── 2FA / OTP ────────────────────────────────────────── 'otp' => 'Contraseña de un solo uso', - 'two_fa' => 'Autenticación de dos factores', - 'resend_otp' => 'Reenviar OTP', - - // ───── Languages ────────────────────────────────────────── - 'en' => 'Inglés', - 'es' => 'Español', ]; diff --git a/shared/resources/lang/es/lang.php b/shared/resources/lang/es/lang.php new file mode 100644 index 00000000..edc34c3c --- /dev/null +++ b/shared/resources/lang/es/lang.php @@ -0,0 +1,6 @@ + 'Inglés', + 'es' => 'Español', +]; diff --git a/shared/resources/lang/es/pages.php b/shared/resources/lang/es/pages.php new file mode 100644 index 00000000..09895881 --- /dev/null +++ b/shared/resources/lang/es/pages.php @@ -0,0 +1,20 @@ + 'Framework MVC en PHP de nueva generación, muy rápido y extremadamente simple, con una estructura modular.', + 'about_framework' => 'Quantum es un framework web PHP gratuito y de código abierto bajo la licencia MIT, diseñado especialmente para desarrollar aplicaciones web muy rápidas con una estructura modular. Con Quantum es fácil iniciar de inmediato cualquier tipo de proyecto, ya sean sitios web tradicionales o servicios complejos basados en API, y al mismo tiempo permite mantener el código limpio y organizado durante todo el proceso de desarrollo.', + 'version' => 'Versión', + 'current_version' => 'La versión actual es: {%1}', + 'cli_commands' => 'Comandos CLI de Quantum', + 'star' => [ + 'message' => '¿Te gustaría mostrar tu apoyo dando una estrella a Quantum en GitHub?', + 'button' => 'Dar una estrella en GitHub', + 'badge_alt' => 'Estrellas en GitHub', + ], + 'home' => 'Inicio', + 'about' => 'Acerca de', + 'installation' => 'Instalación', + 'learn_more' => 'Aprender más', + 'create_project' => 'Crear nuevo proyecto', + 'run_server' => 'Ejecutar el proyecto', +]; diff --git a/shared/resources/lang/es/posts.php b/shared/resources/lang/es/posts.php new file mode 100644 index 00000000..b0cad2e4 --- /dev/null +++ b/shared/resources/lang/es/posts.php @@ -0,0 +1,13 @@ + 'Publicaciones', + 'my_posts' => 'Mis publicaciones', + 'new_post' => 'Nueva publicación', + 'update_post' => 'Actualizar publicación', + 'post' => 'Publicación', + 'post_not_found' => 'Publicación no encontrada', + 'no_posts' => 'No se encontraron publicaciones', + 'try_creating' => 'Intenta crear una nueva', + 'confirm_delete' => '¿Estás seguro de que deseas eliminar el {%1} ?', +]; diff --git a/shared/views/email/activate.php b/shared/views/email/activate.php index 6814db88..2b2ec13a 100644 --- a/shared/views/email/activate.php +++ b/shared/views/email/activate.php @@ -163,7 +163,7 @@

-

+

@@ -183,7 +183,7 @@
' style='text-decoration:none;display:block;color:#ffffff;background-color:#007089;border-radius:25px;-webkit-border-radius:25px;-moz-border-radius:25px;width:35%; width:calc(35% - 2px);;border-top:1px solid #007089;border-right:1px solid #007089;border-bottom:1px solid #007089;border-left:1px solid #007089;padding-top:5px;padding-bottom:5px;font-family: Montserrat, Trebuchet MS , Lucida Grande , Lucida Sans Unicode , Lucida Sans , Tahoma, sans-serif;text-align:center;mso-border-alt:none;word-break:keep-all;'> - + diff --git a/shared/views/email/reset.php b/shared/views/email/reset.php index e516d80b..ee7457dd 100644 --- a/shared/views/email/reset.php +++ b/shared/views/email/reset.php @@ -168,7 +168,7 @@

-

+

@@ -196,7 +196,7 @@ data-mce-style="font-size: 16px; line-height: 32px;" style="font-size: 16px; line-height: 32px;"> + style="font-size: 18px; line-height: 36px;"> diff --git a/shared/views/email/verification.php b/shared/views/email/verification.php index bfbeeea1..b1524029 100644 --- a/shared/views/email/verification.php +++ b/shared/views/email/verification.php @@ -168,7 +168,7 @@

-

+

diff --git a/tests/Unit/shared/Lang/CommonLangTest.php b/tests/Unit/shared/Lang/CommonLangTest.php index 4013068a..ac6747c3 100644 --- a/tests/Unit/shared/Lang/CommonLangTest.php +++ b/tests/Unit/shared/Lang/CommonLangTest.php @@ -6,12 +6,37 @@ class CommonLangTest extends TestCase { + /** + * The keys the framework reads by name: the mail subjects, the pagination links + * and the field labels the validator reads as `common.`. + */ + private const COMMON_KEYS = [ + 'activate_account', + 'reset_password', + 'otp', + 'pagination.next', + 'pagination.prev', + 'captcha', + 'confirm_password', + 'content', + 'current_password', + 'email', + 'firstname', + 'image', + 'lastname', + 'new_password', + 'password', + 'repeat_password', + 'title', + 'token', + ]; + /** * @dataProvider languageProvider */ public function testEveryLanguageHasTheStarTexts(string $language): void { - $star = $this->common($language)['star'] ?? null; + $star = $this->texts($language, 'pages')['star'] ?? null; $this->assertIsArray($star); @@ -25,20 +50,63 @@ public function testEveryLanguageHasTheStarTexts(string $language): void public function testStarGroupHasTheSameKeysInEveryLanguage(): void { $this->assertSame( - array_keys($this->common('en')['star'] ?? []), - array_keys($this->common('es')['star'] ?? []) + array_keys($this->texts('en', 'pages')['star'] ?? []), + array_keys($this->texts('es', 'pages')['star'] ?? []) ); } public function testEnglishTextAsksForAStarOnGitHub(): void { - $star = $this->common('en')['star'] ?? []; + $star = $this->texts('en', 'pages')['star'] ?? []; $this->assertStringContainsString('starring Quantum on GitHub', (string) ($star['message'] ?? '')); $this->assertSame('Star on GitHub', $star['button'] ?? null); $this->assertSame('GitHub stars', $star['badge_alt'] ?? null); } + /** + * @dataProvider languageProvider + */ + public function testCommonKeepsTheKeysTheFrameworkReadsByName(string $language): void + { + $keys = $this->flatten($this->texts($language, 'common')); + + foreach (self::COMMON_KEYS as $key) { + $this->assertArrayHasKey($key, $keys, "common.$key is missing in $language"); + $this->assertNotSame('', trim((string) $keys[$key])); + } + + $this->assertSame([], array_values(array_diff(array_keys($keys), self::COMMON_KEYS))); + } + + /** + * @dataProvider languageProvider + */ + public function testCommentMessagesAreTranslated(string $language): void + { + $comments = $this->texts($language, 'comments'); + + foreach (['added', 'deleted'] as $key) { + $this->assertArrayHasKey($key, $comments); + $this->assertNotSame('', trim($comments[$key])); + } + } + + public function testEveryLanguageHasTheSameFilesAndKeys(): void + { + $english = $this->files('en'); + + $this->assertSame($english, $this->files('es')); + + foreach ($english as $file) { + $this->assertSame( + array_keys($this->flatten($this->texts('en', $file))), + array_keys($this->flatten($this->texts('es', $file))), + "The keys of $file differ between en and es" + ); + } + } + /** * @return array */ @@ -53,8 +121,49 @@ public static function languageProvider(): array /** * @return array */ - private function common(string $language): array + private function texts(string $language, string $file): array + { + return require $this->langDir($language) . '/' . $file . '.php'; + } + + /** + * @return array + */ + private function files(string $language): array { - return require dirname(__DIR__, 4) . '/shared/resources/lang/' . $language . '/common.php'; + $files = array_map( + fn (string $path): string => basename($path, '.php'), + glob($this->langDir($language) . '/*.php') ?: [] + ); + + sort($files); + + return $files; + } + + private function langDir(string $language): string + { + return dirname(__DIR__, 4) . '/shared/resources/lang/' . $language; + } + + /** + * @param array $texts + * @return array + */ + private function flatten(array $texts, string $prefix = ''): array + { + $flat = []; + + foreach ($texts as $key => $value) { + $path = $prefix === '' ? (string) $key : $prefix . '.' . $key; + + if (is_array($value)) { + $flat += $this->flatten($value, $path); + } else { + $flat[$path] = $value; + } + } + + return $flat; } } diff --git a/tests/_root/shared/resources/lang/en/account.php b/tests/_root/shared/resources/lang/en/account.php new file mode 100644 index 00000000..aa3e08c8 --- /dev/null +++ b/tests/_root/shared/resources/lang/en/account.php @@ -0,0 +1,6 @@ + 'Account Settings', + 'profile' => 'Profile', +]; diff --git a/tests/_root/shared/resources/lang/en/actions.php b/tests/_root/shared/resources/lang/en/actions.php new file mode 100644 index 00000000..7e41f83b --- /dev/null +++ b/tests/_root/shared/resources/lang/en/actions.php @@ -0,0 +1,14 @@ + 'Send', + 'reset' => 'Reset', + 'cancel' => 'Cancel', + 'save' => 'Save', + 'delete' => 'Delete', + 'edit' => 'Edit', + 'yes' => 'Yes', + 'created_successfully' => 'Created successfully', + 'updated_successfully' => 'Updated successfully', + 'deleted_successfully' => 'Deleted successfully', +]; diff --git a/tests/_root/shared/resources/lang/en/auth.php b/tests/_root/shared/resources/lang/en/auth.php new file mode 100644 index 00000000..7a38e58e --- /dev/null +++ b/tests/_root/shared/resources/lang/en/auth.php @@ -0,0 +1,19 @@ + 'Sign In', + 'signup' => 'Sign Up', + 'signout' => 'Sign Out', + 'activate' => 'Activate', + 'activation_email_content' => 'Activate your account by clicking the button below', + 'account_activated' => 'Account is activated', + 'remember_me' => 'Remember Me', + 'forget_password' => 'Forgot password?', + 'reset_password_email_content' => 'Reset your password by clicking the button below', + 'check_email' => 'Check your email to reset your password', + 'check_email_signup' => 'Registration was successful, please check your email', + 'successfully_signed_up' => 'Successfully signed up', + 'verification_code' => 'Verification Code', + 'two_fa' => '2 Factor Authentication', + 'resend_otp' => 'Resend otp', +]; diff --git a/tests/_root/shared/resources/lang/en/comments.php b/tests/_root/shared/resources/lang/en/comments.php new file mode 100644 index 00000000..87968dca --- /dev/null +++ b/tests/_root/shared/resources/lang/en/comments.php @@ -0,0 +1,11 @@ + 'Comment', + 'title' => 'Comments', + 'login_to_comment' => 'Login to comment', + 'leave_a_comment' => 'Leave a comment', + 'no_comments' => 'No comments', + 'added' => 'Comment added', + 'deleted' => 'Comment deleted', +]; diff --git a/tests/_root/shared/resources/lang/en/common.php b/tests/_root/shared/resources/lang/en/common.php index 725ef387..3898f2d1 100644 --- a/tests/_root/shared/resources/lang/en/common.php +++ b/tests/_root/shared/resources/lang/en/common.php @@ -1,104 +1,24 @@ 'Very fast and extremely simple, next generation PHP MVC framework with modular structure.', - 'about_framework' => 'Quantum is a free, open-source PHP web framework under MIT license...', - 'version' => 'Version', - 'current_version' => 'Current version is: {%1}', - - // ───── Navigation ───────────────────────────────────────── - 'home' => 'Home', - 'about' => 'About', - 'installation' => 'Installation', - 'learn_more' => 'Learn More', - - // ───── Project creation / commands ─────────────────────── - 'create_project' => 'Create new project', - 'run_server' => 'Run the project', - - // ───── Auth / User Management ───────────────────────────── 'captcha' => 'Captcha', - 'signin' => 'Sign In', - 'signup' => 'Sign Up', - 'activate' => 'Activate', - 'activation_email_content' => 'Activate your account by clicking the button below', 'activate_account' => 'Activate account', - 'account_activated' => 'Account is activated', - 'signout' => 'Sign Out', - 'remember_me' => 'Remember Me', - 'forget_password' => 'Forgot password?', 'reset_password' => 'Reset password', - 'reset_password_email_content' => 'Reset your password by clicking the button below', 'repeat_password' => 'Repeat password', - 'check_email_signup' => 'Registration was successful, please check your email', - 'check_email' => 'Check your email to reset your password', - 'successfully_signed_up' => 'Successfully signed up', - - // ───── User fields ───────────────────────────────────────── 'email' => 'Email', 'token' => 'Token', 'password' => 'Password', - 'verification_code' => 'Verification Code', 'new_password' => 'New password', 'firstname' => 'First name', 'lastname' => 'Last name', - - // ───── Buttons ──────────────────────────────────────────── - 'send' => 'Send', - 'reset' => 'Reset', - 'cancel' => 'Cancel', - 'save' => 'Save', - 'delete' => 'Delete', - 'edit' => 'Edit', - 'yes' => 'Yes', - - // ───── Account settings ─────────────────────────────────── - 'account_settings' => 'Account Settings', - 'profile' => 'Profile', 'current_password' => 'Current Password', 'confirm_password' => 'Confirm Password', - - // ───── Posts ────────────────────────────────────────────── - 'posts' => 'Posts', - 'my_posts' => 'My Posts', - 'new_post' => 'New Post', 'title' => 'Title', 'content' => 'Content', 'image' => 'image', - 'post' => 'post', - - 'created_successfully' => 'Created successfully', - 'updated_successfully' => 'Updated successfully', - 'deleted_successfully' => 'Deleted successfully', - 'update_post' => 'Update Post', - 'confirm_delete' => 'Are you sure you want to delete the {%1} ?', - 'post_not_found' => 'Post not found', - 'no_posts' => 'No posts found', - 'try_creating' => 'Try creating a new one', - - // ───── Pagination ───────────────────────────────────────── 'pagination' => [ 'next' => 'Next »', 'prev' => '« Prev', ], - - // ───── Comments ─────────────────────────────────────────── - 'comments' => [ - 'submit_comment' => 'Comment', - 'title' => 'Comments', - 'login_to_comment' => 'Login to comment', - 'leave_a_comment' => 'Leave a comment', - 'no_comments' => 'No comments', - ], - - // ───── 2FA / OTP ────────────────────────────────────────── 'otp' => 'One Time Password', - 'two_fa' => '2 Factor Authentication', - 'resend_otp' => 'Resend otp', - - // ───── Languages ────────────────────────────────────────── - 'en' => 'English', - 'es' => 'Spanish', ]; diff --git a/tests/_root/shared/resources/lang/en/lang.php b/tests/_root/shared/resources/lang/en/lang.php new file mode 100644 index 00000000..1dd80e16 --- /dev/null +++ b/tests/_root/shared/resources/lang/en/lang.php @@ -0,0 +1,6 @@ + 'English', + 'es' => 'Spanish', +]; diff --git a/tests/_root/shared/resources/lang/en/pages.php b/tests/_root/shared/resources/lang/en/pages.php new file mode 100644 index 00000000..9fad5508 --- /dev/null +++ b/tests/_root/shared/resources/lang/en/pages.php @@ -0,0 +1,14 @@ + 'Very fast and extremely simple, next generation PHP MVC framework with modular structure.', + 'about_framework' => 'Quantum is a free, open-source PHP web framework under MIT license...', + 'version' => 'Version', + 'current_version' => 'Current version is: {%1}', + 'home' => 'Home', + 'about' => 'About', + 'installation' => 'Installation', + 'learn_more' => 'Learn More', + 'create_project' => 'Create new project', + 'run_server' => 'Run the project', +]; diff --git a/tests/_root/shared/resources/lang/en/posts.php b/tests/_root/shared/resources/lang/en/posts.php new file mode 100644 index 00000000..9043f405 --- /dev/null +++ b/tests/_root/shared/resources/lang/en/posts.php @@ -0,0 +1,13 @@ + 'Posts', + 'my_posts' => 'My Posts', + 'new_post' => 'New Post', + 'update_post' => 'Update Post', + 'post' => 'post', + 'post_not_found' => 'Post not found', + 'no_posts' => 'No posts found', + 'try_creating' => 'Try creating a new one', + 'confirm_delete' => 'Are you sure you want to delete the {%1} ?', +]; diff --git a/tests/_root/shared/resources/lang/es/account.php b/tests/_root/shared/resources/lang/es/account.php new file mode 100644 index 00000000..640acec6 --- /dev/null +++ b/tests/_root/shared/resources/lang/es/account.php @@ -0,0 +1,6 @@ + 'Configuración de la cuenta', + 'profile' => 'Perfil', +]; diff --git a/tests/_root/shared/resources/lang/es/actions.php b/tests/_root/shared/resources/lang/es/actions.php new file mode 100644 index 00000000..9ee0ba9b --- /dev/null +++ b/tests/_root/shared/resources/lang/es/actions.php @@ -0,0 +1,14 @@ + 'Enviar', + 'reset' => 'Restablecer', + 'cancel' => 'Cancelar', + 'save' => 'Guardar', + 'delete' => 'Eliminar', + 'edit' => 'Editar', + 'yes' => 'Sí', + 'created_successfully' => 'Creado exitosamente', + 'updated_successfully' => 'Actualizado exitosamente', + 'deleted_successfully' => 'Eliminado exitosamente', +]; diff --git a/tests/_root/shared/resources/lang/es/auth.php b/tests/_root/shared/resources/lang/es/auth.php new file mode 100644 index 00000000..98d3b0e2 --- /dev/null +++ b/tests/_root/shared/resources/lang/es/auth.php @@ -0,0 +1,19 @@ + 'Iniciar sesión', + 'signup' => 'Registrarse', + 'signout' => 'Cerrar sesión', + 'activate' => 'Activar', + 'activation_email_content' => 'Activa tu cuenta haciendo clic en el botón de abajo', + 'account_activated' => 'La cuenta ha sido activada', + 'remember_me' => 'Recuérdame', + 'forget_password' => '¿Olvidaste tu contraseña?', + 'reset_password_email_content' => 'Restablece tu contraseña haciendo clic en el botón de abajo', + 'check_email' => 'Revisa tu correo electrónico para restablecer tu contraseña', + 'check_email_signup' => 'Registro exitoso, por favor revisa tu correo electrónico', + 'successfully_signed_up' => 'Registrado con éxito', + 'verification_code' => 'Código de verificación', + 'two_fa' => 'Autenticación de dos factores', + 'resend_otp' => 'Reenviar OTP', +]; diff --git a/tests/_root/shared/resources/lang/es/comments.php b/tests/_root/shared/resources/lang/es/comments.php new file mode 100644 index 00000000..56e09c61 --- /dev/null +++ b/tests/_root/shared/resources/lang/es/comments.php @@ -0,0 +1,11 @@ + 'Comentar', + 'title' => 'Comentarios', + 'login_to_comment' => 'Inicia sesión para comentar', + 'leave_a_comment' => 'Deja un comentario', + 'no_comments' => 'Sin comentarios', + 'added' => 'Comentario añadido', + 'deleted' => 'Comentario eliminado', +]; diff --git a/tests/_root/shared/resources/lang/es/common.php b/tests/_root/shared/resources/lang/es/common.php index 91c57ef9..23de0a6d 100644 --- a/tests/_root/shared/resources/lang/es/common.php +++ b/tests/_root/shared/resources/lang/es/common.php @@ -1,104 +1,24 @@ 'Framework MVC en PHP de nueva generación, muy rápido y extremadamente simple, con una estructura modular.', - 'about_framework' => 'Quantum es un framework web en PHP gratuito y de código abierto bajo la licencia MIT...', - 'version' => 'Versión', - 'current_version' => 'La versión actual es: {%1}', - - // ───── Navigation ───────────────────────────────────────── - 'home' => 'Inicio', - 'about' => 'Acerca de', - 'installation' => 'Instalación', - 'learn_more' => 'Aprender más', - - // ───── Project creation / commands ─────────────────────── - 'create_project' => 'Crear nuevo proyecto', - 'run_server' => 'Ejecutar el proyecto', - - // ───── Auth / User Management ───────────────────────────── 'captcha' => 'Captcha', - 'signin' => 'Iniciar sesión', - 'signup' => 'Registrarse', - 'activate' => 'Activar', - 'activation_email_content' => 'Activa tu cuenta haciendo clic en el botón de abajo', 'activate_account' => 'Activar cuenta', - 'account_activated' => 'La cuenta ha sido activada', - 'signout' => 'Cerrar sesión', - 'remember_me' => 'Recuérdame', - 'forget_password' => '¿Olvidaste tu contraseña?', 'reset_password' => 'Restablecer contraseña', - 'reset_password_email_content' => 'Restablece tu contraseña haciendo clic en el botón de abajo', 'repeat_password' => 'Repetir contraseña', - 'check_email_signup' => 'Registro exitoso, por favor revisa tu correo electrónico', - 'check_email' => 'Revisa tu correo electrónico para restablecer tu contraseña', - 'successfully_signed_up' => 'Registrado con éxito', - - // ───── User fields ───────────────────────────────────────── 'email' => 'Correo electrónico', 'token' => 'Token', 'password' => 'Contraseña', - 'verification_code' => 'Código de verificación', 'new_password' => 'Nueva contraseña', 'firstname' => 'Nombre', 'lastname' => 'Apellido', - - // ───── Buttons ──────────────────────────────────────────── - 'send' => 'Enviar', - 'reset' => 'Restablecer', - 'cancel' => 'Cancelar', - 'save' => 'Guardar', - 'delete' => 'Eliminar', - 'edit' => 'Editar', - 'yes' => 'Sí', - - // ───── Account settings ─────────────────────────────────── - 'account_settings' => 'Configuración de la cuenta', - 'profile' => 'Perfil', 'current_password' => 'Contraseña actual', 'confirm_password' => 'Confirmar contraseña', - - // ───── Posts ────────────────────────────────────────────── - 'posts' => 'Publicaciones', - 'my_posts' => 'Mis publicaciones', - 'new_post' => 'Nueva publicación', 'title' => 'Título', 'content' => 'Contenido', 'image' => 'Imagen', - 'post' => 'Publicación', - - 'created_successfully' => 'Creado exitosamente', - 'updated_successfully' => 'Actualizado exitosamente', - 'deleted_successfully' => 'Eliminado exitosamente', - 'update_post' => 'Actualizar publicación', - 'confirm_delete' => '¿Estás seguro de que deseas eliminar el {%1} ?', - 'post_not_found' => 'Publicación no encontrada', - 'no_posts' => 'No se encontraron publicaciones', - 'try_creating' => 'Intenta crear una nueva', - - // ───── Pagination ───────────────────────────────────────── 'pagination' => [ 'next' => 'Siguiente »', 'prev' => '« Anterior', ], - - // ───── Comments ─────────────────────────────────────────── - 'comments' => [ - 'submit_comment' => 'Comentar', - 'title' => 'Comentarios', - 'login_to_comment' => 'Inicia sesión para comentar', - 'leave_a_comment' => 'Deja un comentario', - 'no_comments' => 'Sin comentarios', - ], - - // ───── 2FA / OTP ────────────────────────────────────────── 'otp' => 'Contraseña de un solo uso', - 'two_fa' => 'Autenticación de dos factores', - 'resend_otp' => 'Reenviar OTP', - - // ───── Languages ────────────────────────────────────────── - 'en' => 'Inglés', - 'es' => 'Español', ]; diff --git a/tests/_root/shared/resources/lang/es/lang.php b/tests/_root/shared/resources/lang/es/lang.php new file mode 100644 index 00000000..edc34c3c --- /dev/null +++ b/tests/_root/shared/resources/lang/es/lang.php @@ -0,0 +1,6 @@ + 'Inglés', + 'es' => 'Español', +]; diff --git a/tests/_root/shared/resources/lang/es/pages.php b/tests/_root/shared/resources/lang/es/pages.php new file mode 100644 index 00000000..7f3249de --- /dev/null +++ b/tests/_root/shared/resources/lang/es/pages.php @@ -0,0 +1,14 @@ + 'Framework MVC en PHP de nueva generación, muy rápido y extremadamente simple, con una estructura modular.', + 'about_framework' => 'Quantum es un framework web en PHP gratuito y de código abierto bajo la licencia MIT...', + 'version' => 'Versión', + 'current_version' => 'La versión actual es: {%1}', + 'home' => 'Inicio', + 'about' => 'Acerca de', + 'installation' => 'Instalación', + 'learn_more' => 'Aprender más', + 'create_project' => 'Crear nuevo proyecto', + 'run_server' => 'Ejecutar el proyecto', +]; diff --git a/tests/_root/shared/resources/lang/es/posts.php b/tests/_root/shared/resources/lang/es/posts.php new file mode 100644 index 00000000..b0cad2e4 --- /dev/null +++ b/tests/_root/shared/resources/lang/es/posts.php @@ -0,0 +1,13 @@ + 'Publicaciones', + 'my_posts' => 'Mis publicaciones', + 'new_post' => 'Nueva publicación', + 'update_post' => 'Actualizar publicación', + 'post' => 'Publicación', + 'post_not_found' => 'Publicación no encontrada', + 'no_posts' => 'No se encontraron publicaciones', + 'try_creating' => 'Intenta crear una nueva', + 'confirm_delete' => '¿Estás seguro de que deseas eliminar el {%1} ?', +]; diff --git a/tests/_root/shared/views/email/activate.php b/tests/_root/shared/views/email/activate.php index 6814db88..2b2ec13a 100644 --- a/tests/_root/shared/views/email/activate.php +++ b/tests/_root/shared/views/email/activate.php @@ -163,7 +163,7 @@

-

+

@@ -183,7 +183,7 @@
' style='text-decoration:none;display:block;color:#ffffff;background-color:#007089;border-radius:25px;-webkit-border-radius:25px;-moz-border-radius:25px;width:35%; width:calc(35% - 2px);;border-top:1px solid #007089;border-right:1px solid #007089;border-bottom:1px solid #007089;border-left:1px solid #007089;padding-top:5px;padding-bottom:5px;font-family: Montserrat, Trebuchet MS , Lucida Grande , Lucida Sans Unicode , Lucida Sans , Tahoma, sans-serif;text-align:center;mso-border-alt:none;word-break:keep-all;'> - + diff --git a/tests/_root/shared/views/email/reset.php b/tests/_root/shared/views/email/reset.php index e516d80b..ee7457dd 100644 --- a/tests/_root/shared/views/email/reset.php +++ b/tests/_root/shared/views/email/reset.php @@ -168,7 +168,7 @@

-

+

@@ -196,7 +196,7 @@ data-mce-style="font-size: 16px; line-height: 32px;" style="font-size: 16px; line-height: 32px;"> + style="font-size: 18px; line-height: 36px;"> diff --git a/tests/_root/shared/views/email/verification.php b/tests/_root/shared/views/email/verification.php index bfbeeea1..b1524029 100644 --- a/tests/_root/shared/views/email/verification.php +++ b/tests/_root/shared/views/email/verification.php @@ -168,7 +168,7 @@

-

+