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

Custom translation for unique_user_value not working #10819

Open
bellevue7k-user opened this issue Sep 20, 2024 · 0 comments
Open

Custom translation for unique_user_value not working #10819

bellevue7k-user opened this issue Sep 20, 2024 · 0 comments
Labels

Comments

@bellevue7k-user
Copy link

bellevue7k-user commented Sep 20, 2024

Bug description

We are using a frontend registration form for users on one of our sites, and we wanted to change some of the translated form validation error messages to be a bit more informative/clear. However, it seems that the translation string for the validation error 'unique_user_value', which is displayed when an e-mail address is already in use, cannot be overwritten.

How to reproduce

We created a validation.php file inside lang/de_CH with the following content for testing:
`<?php

return [

'unique' => 'Diese E-Mail ist bereits vergeben.',
'unique_entry_value' => '1 Dieser Wert wurde bereits vergeben.',
'unique_form_handle' => '2 Dieser Wert wurde bereits vergeben.',
'unique_term_value' => '3 Dieser Wert wurde bereits vergeben.',
'unique_user_value' => '4 Dieser Wert wurde bereits vergeben.',
'confirmed' => 'Die Passwörter stimmen nicht überein.'

];`

In config/app.php, there's the following settings (APP_FALLBACK_LOCALE is set to de_CH in the .env):
` 'locale' => 'de_CH',

'fallback_locale' => env('APP_FALLBACK_LOCALE', 'de'),

'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),`

Inside the control panel's sites settings, both locale and lang are set to de_CH as well. This is a single site installation.

When trying to register a user with an e-mail address that is already in use, the expected validation error message would be "4 Dieser Wert wurde bereits vergeben." from the unique_user_value translation. Instead, what is actually displayed is the de_CH translation string from inside the vendor folder, which we could test and confirm by editing that string directly.
This issue seems to only affect 'unique_user_value'. The 'confirmed' validation error message, which is shown when the password confirmation field does not match with the password field, is correctly translated using our custom translation.

Logs

No response

Environment

Environment
Application Name: Babysitter-Plattform
Laravel Version: 11.20.0
PHP Version: 8.3.10
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: babysitter-plattform.test
Maintenance Mode: OFF
Timezone: Europe/Zurich
Locale: de_CH

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file

Statamic
Addons: 1
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.25.0 PRO

Statamic Addons
mitydigital/statamic-two-factor: 2.2.1

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants