-
Notifications
You must be signed in to change notification settings - Fork 10
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
fix: localize attributes properly #2016
Conversation
@jobara I think the meeting types error is the one like UpdateProjectRequest; the ones don't use :attribute explicitly. I didn't find any use cases of :attribute for meeting_types, could you tell me in which workflow you got that error message please? |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## dev #2016 +/- ##
============================================
- Coverage 97.65% 97.62% -0.03%
- Complexity 2055 2103 +48
============================================
Files 314 314
Lines 8991 9481 +490
============================================
+ Hits 8780 9256 +476
- Misses 211 225 +14 ☔ View full report in Codecov by Sentry. |
I believe it's coming from the validation.required text. It's likely the case that a required meeting_types field is empty. An example would be from UpdateIndividualCommunicationAndConsultationPreferencesRequest validation. My feeling at the moment is that any validated field should have a localized attribute name specified. This would prevent errors if we removed an overridden message, or didn't override one that became needed later (e.g. changed the validation rules). |
Tests will be expanded with #1813 |
@chosww could you please run |
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.
It looks like you missed doing AcceptInvitationRequest. It looks like the only attribute there is email
.
public function attributes(): array | ||
{ | ||
return [ | ||
'roles' => __('roles'), | ||
]; | ||
} |
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.
public function attributes(): array | |
{ | |
return [ | |
'roles' => __('roles'), | |
]; | |
} | |
public function attributes(): array | |
{ | |
return [ | |
'roles' => __('roles'), | |
'roles.*' => __('roles'), | |
]; | |
} |
public function attributes(): array | ||
{ | ||
return [ | ||
'locale' => __('locale'), |
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.
'locale' => __('locale'), | |
'locale' => __('website language'), |
public function attributes(): array | ||
{ | ||
return [ | ||
'roles' => __('You must select what you would like to do on the website.'), | ||
]; | ||
} |
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.
It looks like you copied the message here instead of adding the attribute value.
public function attributes(): array | |
{ | |
return [ | |
'roles' => __('You must select what you would like to do on the website.'), | |
]; | |
} | |
public function attributes(): array | |
{ | |
return [ | |
'roles' => __('roles'), | |
'roles.*' => __('roles'), | |
]; | |
} |
app/Http/Requests/MeetingRequest.php
Outdated
'start_time' => __('meeting start time'), | ||
'end_time' => __('meeting end time'), | ||
'date' => __('meeting date'), | ||
'directions' => __('directions'), | ||
'timezone' => __('meeting time zone'), | ||
'locality' => __('city or town'), | ||
'region' => __('province or territory'), | ||
'meeting_url' => __('link to join the meeting'), | ||
'meeting_phone' => __('phone number to join the meeting'), | ||
'meeting_software' => __('meeting software'), | ||
'alternative_meeting_software' => __('alternative meeting software'), | ||
'additional_video_information' => __('additional video information'), | ||
'additional_phone_information' => __('additional phone information'), | ||
'meeting_types' => __('meeting types'), | ||
'street_address' => __('Street address'), | ||
'postal_code' => __('Postal code'), | ||
'unit_suite_floor' => __('Unit, suite, or floor'), |
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.
'start_time' => __('meeting start time'), | |
'end_time' => __('meeting end time'), | |
'date' => __('meeting date'), | |
'directions' => __('directions'), | |
'timezone' => __('meeting time zone'), | |
'locality' => __('city or town'), | |
'region' => __('province or territory'), | |
'meeting_url' => __('link to join the meeting'), | |
'meeting_phone' => __('phone number to join the meeting'), | |
'meeting_software' => __('meeting software'), | |
'alternative_meeting_software' => __('alternative meeting software'), | |
'additional_video_information' => __('additional video information'), | |
'additional_phone_information' => __('additional phone information'), | |
'meeting_types' => __('meeting types'), | |
'street_address' => __('Street address'), | |
'postal_code' => __('Postal code'), | |
'unit_suite_floor' => __('Unit, suite, or floor'), | |
'title.en' => __('meeting title (English)'), | |
'title.fr' => __('meeting title (French)'), | |
'title.*' => __('meeting title'), | |
'start_time' => __('meeting start time'), | |
'end_time' => __('meeting end time'), | |
'date' => __('meeting date'), | |
'directions' => __('directions'), | |
'timezone' => __('meeting time zone'), | |
'locality' => __('city or town'), | |
'region' => __('province or territory'), | |
'meeting_url' => __('link to join the meeting'), | |
'meeting_phone' => __('phone number to join the meeting'), | |
'meeting_software' => __('meeting software'), | |
'alternative_meeting_software' => __('alternative meeting software'), | |
'additional_video_information' => __('additional video information'), | |
'additional_phone_information' => __('additional phone information'), | |
'meeting_types' => __('ways to attend'), | |
'meeting_types.*' => __('ways to attend'), | |
'street_address' => __('Street address'), | |
'postal_code' => __('Postal code'), | |
'unit_suite_floor' => __('Unit, suite, or floor'), |
@@ -28,4 +28,12 @@ public function rules() | |||
'definition.*' => 'nullable|string', | |||
]; | |||
} | |||
|
|||
public function attributes(): array |
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.
I don't think this file is used anymore. I think we can delete it. Can you confirm?
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.
It doesn't seems like it, though I think this may be used later? We should confirm with @greatislander
'service_areas' => __('Service areas'), | ||
'sectors' => __('Sectors'), |
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.
'service_areas' => __('Service areas'), | |
'sectors' => __('Sectors'), | |
'service_areas' => __('Service areas'), | |
'service_areas.*' => __('Service areas'), | |
'sectors' => __('type of Regulated Organization'), |
'about.fr' => __('"About your organization" (French)'), | ||
'about.en' => __('"About your organization" (English)'), | ||
'accessibility_and_inclusion_links.*.title' => __('accessibility and inclusion link title'), | ||
'accessibility_and_inclusion_links.*.url' => __('accessibility and inclusion link'), | ||
'social_links.*.active_url' => __(''), | ||
'social_links' => __('Social media links'), |
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.
'social_links' => __('Social media links'), | |
'social_links.*' => __('Social media links'), |
'contact_person_name' => __('Contact person'), | ||
'contact_person_email' => __('Contact person’s email'), | ||
'contact_person_phone' => __('Contact person’s phone number'), | ||
'contact_person_vrs' => __('Contact person’s vrs'), |
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.
'contact_person_vrs' => __('Contact person’s vrs'), | |
'contact_person_vrs' => __('Contact person requires Video Relay Service (VRS) for phone calls'), |
public function attributes(): array | ||
{ | ||
return [ | ||
'theme' => __('Theme'), |
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.
'theme' => __('Theme'), | |
'theme' => __('Contrast adjustment'), |
I think this one is still missing. It's being done through |
@jobara this PR is ready for another review, thanks! |
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.
@chosww could you also re-run composer localize
?
public function attributes(): array | ||
{ | ||
return [ | ||
'email' => __('email address'), |
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.
I notice in at least one other location that we've used __('email')
instead. If it makes sense, can we make these consistent?
'name.en' => __('organization name (English)'), | ||
'name.fr' => __('organization name (French)'), |
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.
These don't appear to be required here. Perhaps they were added to the wrong file.
'term' => __('term'), | ||
'definition' => __('definition'), |
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.
Missing 'term.*'
and 'definition.*'
.
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.
@chosww could you please run composer localize
again. I think that's all that's left.
Resolves #2011.
Prerequisites
If this PR changes PHP code or dependencies:
composer format
and fixed any code formatting issues.composer analyze
and addressed any static analysis issues.php artisan test
and ensured that all tests pass.composer localize
to update localization source files and committed any changes.If this PR changes CSS or JavaScript code or dependencies:
npm run lint
and fixed any linting issues.npm run build
and ensured that CSS and JavaScript assets can be compiled.