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

fix: localize attributes properly #2016

Merged
merged 24 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
613f789
fix: localize attributes properly
chosww Nov 28, 2023
7812dfc
fix: decapitalize localization message keys
chosww Nov 28, 2023
9a8db06
fix: update error messages
chosww Nov 28, 2023
e67e5cc
fix: add attributes method to all requests
chosww Nov 29, 2023
8d023c5
fix: analyze issues
chosww Nov 29, 2023
501dc17
fix: update tests
chosww Nov 29, 2023
389f03b
Merge branch 'dev' of https://github.com/accessibility-exchange/platf…
chosww Nov 29, 2023
c35464c
fix: update validation errors
chosww Nov 29, 2023
c7db448
fix: run localize
chosww Nov 30, 2023
1bdee8a
Merge branch 'dev' of https://github.com/accessibility-exchange/platf…
chosww Nov 30, 2023
08b6b78
fix: update based on PR feedback
chosww Nov 30, 2023
e5f47a5
fix: update based on PR feedback
chosww Dec 1, 2023
46a82ed
fix: analyze issue
chosww Dec 1, 2023
ec40713
fix: update validation errors
chosww Dec 1, 2023
ebfe295
fix: update validation errors
chosww Dec 1, 2023
50e0363
fix: add email attribute to AcceptInvitationRequest
chosww Dec 4, 2023
3d4c31c
fix: update attribute message
chosww Dec 4, 2023
2ceac1e
fix: add update attributes for StoreDefinedTermRequest
chosww Dec 4, 2023
4bd5052
Merge branch 'dev' of https://github.com/accessibility-exchange/platf…
chosww Dec 4, 2023
eab5bab
fix: update based on PR feedback
chosww Dec 5, 2023
212be19
Merge branch 'dev' of https://github.com/accessibility-exchange/platf…
chosww Dec 5, 2023
7bb3abf
fix: update DestroyUserRequest attribute
chosww Dec 5, 2023
ca830d5
fix: update attributes of StoreEngagementLanguagesRequest
chosww Dec 5, 2023
6dd8016
fix: run composer localize
chosww Dec 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/Http/Requests/AcceptInvitationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ public function rules(): array
return [];
}

public function attributes(): array
{
return [
'email' => __('email address'),
Copy link
Collaborator

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?

];
}

public function withValidator(Validator $validator)
{
$validator
Expand Down
8 changes: 8 additions & 0 deletions app/Http/Requests/AddNotificationableRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ public function rules(): array
'notificationable_id' => 'required|integer|exists:'.$this->input('notificationable_type').',id',
];
}

public function attributes(): array
{
return [
'notificationable_type' => __('notificationable type'),
'notificationable_id' => __('notificationable id'),
];
}
}
9 changes: 9 additions & 0 deletions app/Http/Requests/AddTranslationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ public function rules(): array
];
}

public function attributes(): array
{
return [
'translatable_type' => __('translatable type'),
'translatable_id' => __('translatable id'),
'new_language' => __('new language'),
];
}

/**
* Get the error messages for the defined validation rules.
*/
Expand Down
8 changes: 8 additions & 0 deletions app/Http/Requests/BlockRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@ public function rules(): array
'blockable_id' => 'required|integer|exists:'.$this->input('blockable_type').',id',
];
}

public function attributes(): array
{
return [
'blockable_type' => __('blockable type'),
'blockable_id' => __('blockable id'),
];
}
}
7 changes: 7 additions & 0 deletions app/Http/Requests/DestroyIndividualRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ public function rules()
];
}

public function attributes(): array
{
return [
'current_password' => __('current password'),
];
}

/**
* Configure the validator instance.
*
Expand Down
7 changes: 7 additions & 0 deletions app/Http/Requests/DestroyOrganizationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ public function rules()
];
}

public function attributes(): array
{
return [
'current_password' => __('current password'),
];
}

/**
* Configure the validator instance.
*
Expand Down
7 changes: 7 additions & 0 deletions app/Http/Requests/DestroyProjectRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ public function rules()
];
}

public function attributes(): array
{
return [
'current_password' => __('current password'),
];
}

/**
* Configure the validator instance.
*
Expand Down
7 changes: 7 additions & 0 deletions app/Http/Requests/DestroyRegulatedOrganizationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ public function rules()
];
}

public function attributes(): array
{
return [
'current_password' => __('current password'),
];
}

/**
* Configure the validator instance.
*
Expand Down
9 changes: 9 additions & 0 deletions app/Http/Requests/DestroyTranslationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ public function rules(): array
];
}

public function attributes(): array
{
return [
'translatable_type' => __('translatable type'),
'translatable_id' => __('translatable id'),
'language' => __('language'),
];
}

/**
* Get the error messages for the defined validation rules.
*/
Expand Down
7 changes: 7 additions & 0 deletions app/Http/Requests/DestroyUserRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ public function rules(): array
];
}

public function attributes(): array
{
return [
'current_password' => __('current password'),
jobara marked this conversation as resolved.
Show resolved Hide resolved
];
}

/**
* Configure the validator instance.
*
Expand Down
13 changes: 13 additions & 0 deletions app/Http/Requests/MeetingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,27 @@ public function rules(): array
public function attributes(): array
{
return [
'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'),
];
}

Expand Down
8 changes: 8 additions & 0 deletions app/Http/Requests/RemoveNotificationableRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ public function rules(): array
];
}

public function attributes(): array
{
return [
'notificationable_type' => __('notificationable type'),
'notificationable_id' => __('notificationable id'),
];
}

public function withValidator(Validator $validator)
{
$validator->sometimes('notificationable_id', 'exists:'.$this->input('notificationable_type').',id', function ($input) {
Expand Down
8 changes: 8 additions & 0 deletions app/Http/Requests/SaveIndividualRolesRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ public function prepareForValidation()
request()->mergeIfMissing($fallbacks);
}

public function attributes(): array
{
return [
'roles' => __('roles'),
'roles.*' => __('roles'),
];
}

/**
* Get the error messages for the defined validation rules.
*/
Expand Down
8 changes: 8 additions & 0 deletions app/Http/Requests/SaveOrganizationRolesRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ public function rules(): array
];
}

public function attributes(): array
{
return [
'roles' => __('roles'),
'roles.*' => __('roles'),
];
}

public function prepareForValidation()
{
$fallbacks = [
Expand Down
7 changes: 7 additions & 0 deletions app/Http/Requests/SaveUserContextRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ public function rules(): array
];
}

public function attributes(): array
{
return [
'context' => __('context'),
];
}

public function messages(): array
{
return [
Expand Down
1 change: 1 addition & 0 deletions app/Http/Requests/SaveUserDetailsRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function attributes(): array
{
return [
'name' => __('full name'),
'email' => __('email'),
];
}
}
11 changes: 11 additions & 0 deletions app/Http/Requests/SaveUserLanguagesRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ public function rules(): array
];
}

public function attributes(): array
{
return [
'locale' => __('Website language'),
'invitation' => __('invitation'),
'context' => __('context'),
'role' => __('role'),
'email' => __('email'),
];
}

public function authorize(): bool
{
return true;
Expand Down
10 changes: 10 additions & 0 deletions app/Http/Requests/StoreDefinedTermRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,14 @@ public function rules()
'definition.*' => 'nullable|string',
];
}

public function attributes(): array
Copy link
Collaborator

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?

Copy link
Collaborator Author

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

{
return [
'term' => __('term'),
'term.*' => __('term'),
'definition' => __('definition'),
'definition.*' => __('definition'),
];
}
}
7 changes: 7 additions & 0 deletions app/Http/Requests/StoreEngagementFormatRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,11 @@ public function rules(): array
],
];
}

public function attributes(): array
{
return [
'format' => __('engagement format'),
];
}
}
7 changes: 7 additions & 0 deletions app/Http/Requests/StoreEngagementLanguagesRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,11 @@ public function rules(): array
],
];
}

public function attributes(): array
{
return [
'languages' => __('languages'),
jobara marked this conversation as resolved.
Show resolved Hide resolved
];
}
}
7 changes: 7 additions & 0 deletions app/Http/Requests/StoreEngagementRecruitmentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,11 @@ public function rules(): array
],
];
}

public function attributes(): array
{
return [
'recruitment' => __('recruitment method'),
];
}
}
11 changes: 11 additions & 0 deletions app/Http/Requests/StoreEngagementRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ public function rules(): array
];
}

public function attributes(): array
{
return [
'project_id' => __('project id'),
'name.en' => __('engagement name (English)'),
'name.fr' => __('engagement name (French)'),
'name.*' => __('engagement name'),
'who' => __('who'),
];
}

public function messages(): array
{
return [
Expand Down
8 changes: 8 additions & 0 deletions app/Http/Requests/StoreInvitationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ public function rules(): array
];
}

public function attributes(): array
{
return [
'email' => __('email'),
'role' => __('role'),
];
}

public function messages(): array
{
return [
Expand Down
7 changes: 7 additions & 0 deletions app/Http/Requests/StoreOrganizationLanguagesRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,11 @@ public function rules(): array
'languages' => 'required|array|min:1',
];
}

public function attributes(): array
{
return [
'languages' => __('languages'),
];
}
}
7 changes: 7 additions & 0 deletions app/Http/Requests/StoreOrganizationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ public function rules(): array
];
}

public function attributes(): array
{
return [
'type' => __('organization type'),
jobara marked this conversation as resolved.
Show resolved Hide resolved
];
}

public function messages(): array
{
return [
Expand Down
9 changes: 9 additions & 0 deletions app/Http/Requests/StoreOrganizationTypeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ public function rules(): array
];
}

public function attributes(): array
{
return [
'type' => __('organization type'),
'name.en' => __('organization name (English)'),
'name.fr' => __('organization name (French)'),
Copy link
Collaborator

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.

];
}

/**
* Get the error messages for the defined validation rules.
*/
Expand Down
8 changes: 8 additions & 0 deletions app/Http/Requests/StoreProjectContextRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ public function rules(): array
];
}

public function attributes(): array
{
return [
'context' => __('project context'),
'ancestor' => __('previous project'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's another idea, although I don't know which is better really.

Suggested change
'ancestor' => __('previous project'),
'ancestor' => __('original project'),

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently use both terms previous project and original project in other messages, and there are 2 usages of previous project, and one usage of original project. I think we should always be consistent throughout the messages.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they are used for the same purpose, I'd agree that they should be consistent.

];
}

public function messages(): array
{
return [
Expand Down
Loading
Loading