Skip to content

Add multilanguage support for Team name reserved validation message.#71

Merged
WendellAdriel merged 2 commits intolaravel:mainfrom
luisprmat:main
Apr 7, 2026
Merged

Add multilanguage support for Team name reserved validation message.#71
WendellAdriel merged 2 commits intolaravel:mainfrom
luisprmat:main

Conversation

@luisprmat
Copy link
Copy Markdown
Contributor

When we create a team and the team's name belongs to reserved list the validation doesn't pass and we see a message that had hardcoded English strings, making it impossible to translate for non-English users.

Solutions

  1. Wraps the validation message with Laravel's __() helper so they can be translated via language files: $fail(__('This team name is reserved and cannot be used.')),
  2. Since this translation is an argument of the Closure $fail within a ValidationRule class which returns an instance of the Illuminate\Translation\PotentiallyTranslatedString class we can chain the ->translate() method: $fail('This team name is reserved and cannot be used.')->translate().

I have chosen the first option for consistency with the other translation strings.

@WendellAdriel WendellAdriel merged commit 2863424 into laravel:main Apr 7, 2026
78 of 79 checks passed
@WendellAdriel
Copy link
Copy Markdown
Member

Thanks for your contribution @luisprmat! 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants