-
-
Notifications
You must be signed in to change notification settings - Fork 254
Use recipient language for database notifications #2008
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
Conversation
📝 WalkthroughWalkthroughThree server event listeners now compute the recipient user's locale (defaulting to 'en') and pass that locale into translation calls for notification titles, bodies, and action labels so translations use the receiving user's language. Changes
Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
app/Listeners/Server/SubUserAddedListener.php (1)
21-22: Standardize locale parameter style for consistency.The translation calls mix named parameter syntax (
locale: $localeon lines 21 and 26) with positional parameter syntax ($localeas the third argument on line 22). While both are valid, using a consistent style improves readability.Apply this diff to standardize on named parameters:
- ->body(trans('notifications.user_added.body', ['server' => $event->subuser->server->name], $locale)) + ->body(trans('notifications.user_added.body', ['server' => $event->subuser->server->name], locale: $locale))Also applies to: 26-26
app/Listeners/Server/SubUserRemovedListener.php (1)
16-17: Standardize locale parameter style for consistency.The translation calls mix named parameter syntax (line 16) with positional parameter syntax (line 17). Using a consistent style improves readability.
Apply this diff to standardize on named parameters:
- ->body(trans('notifications.user_removed.body', ['server' => $event->server->name], $locale)) + ->body(trans('notifications.user_removed.body', ['server' => $event->server->name], locale: $locale))app/Listeners/Server/ServerInstalledListener.php (1)
21-22: Standardize locale parameter style for consistency.The translation calls mix named parameter syntax (
locale: $localeon lines 21 and 26) with positional parameter syntax ($localeas the third argument on line 22). Using a consistent style improves readability.Apply this diff to standardize on named parameters:
- ->body(trans('server/setting.server_info.server_name', ['name' => $event->server->name], $locale)) + ->body(trans('server/setting.server_info.server_name', ['name' => $event->server->name], locale: $locale))Also applies to: 26-26
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
app/Listeners/Server/ServerInstalledListener.php(1 hunks)app/Listeners/Server/SubUserAddedListener.php(1 hunks)app/Listeners/Server/SubUserRemovedListener.php(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: notAreYouScared
Repo: pelican-dev/panel PR: 1671
File: lang/en/server/database.php:22-25
Timestamp: 2025-09-06T20:20:48.706Z
Learning: In the pelican-dev/panel project, translation workflows for non-English languages are handled in separate PRs and processes, so missing translations in other locales should be ignored during code reviews.
🔇 Additional comments (3)
app/Listeners/Server/SubUserAddedListener.php (1)
18-19: LGTM!The locale extraction correctly retrieves the recipient user's language preference and provides a sensible default fallback.
app/Listeners/Server/SubUserRemovedListener.php (1)
13-14: LGTM!The locale extraction correctly retrieves the recipient user's language preference with an appropriate default.
app/Listeners/Server/ServerInstalledListener.php (1)
17-18: LGTM!The locale extraction correctly retrieves the recipient user's language preference with an appropriate default.
Closes #2007