Skip to content

Commit 3805150

Browse files
authored
Remove multilang (#1060)
* trans() -> __() * remove lang directory and all multilang strings * Fix code styling * restore validation lang file * password reset link session status --------- Co-authored-by: faissaloux <[email protected]>
1 parent ade3957 commit 3805150

30 files changed

+45
-177
lines changed

app/Concerns/SendsAlerts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ protected function error(?string $id = null, $parameters = [])
1616

1717
private function sendAlert(string $type, ?string $id = null, $parameters = [])
1818
{
19-
session([$type => trans($id, (array) $parameters)]);
19+
session([$type => __($id, (array) $parameters)]);
2020
}
2121
}

app/Http/Controllers/Admin/ArticlesController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function approve(Article $article): RedirectResponse
4040

4141
$this->dispatchSync(new ApproveArticle($article));
4242

43-
$this->success('admin.articles.approved', $article->title());
43+
$this->success('The article has been approved and is live on the site.', $article->title());
4444

4545
return redirect()->route('articles.show', $article->slug());
4646
}
@@ -51,7 +51,7 @@ public function disapprove(Article $article): RedirectResponse
5151

5252
$this->dispatchSync(new DisapproveArticle($article));
5353

54-
$this->success('admin.articles.disapproved', $article->title());
54+
$this->success('The article has been disapproved and removed from the site.', $article->title());
5555

5656
return redirect()->route('articles.show', $article->slug());
5757
}
@@ -72,7 +72,7 @@ public function togglePinnedStatus(Article $article): RedirectResponse
7272
$article->is_pinned = ! $article->isPinned();
7373
$article->save();
7474

75-
$this->success($article->isPinned() ? 'admin.articles.pinned' : 'admin.articles.unpinned');
75+
$this->success($article->isPinned() ? 'Article successfully pinned!' : 'Article successfully unpinned!');
7676

7777
return redirect()->route('articles.show', $article->slug());
7878
}

app/Http/Controllers/Admin/UsersController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function ban(BanRequest $request, User $user): RedirectResponse
3939

4040
$this->dispatchSync(new BanUser($user, $request->get('reason')));
4141

42-
$this->success('admin.users.banned', $user->name());
42+
$this->success($user->name().' was banned!');
4343

4444
return redirect()->route('profile', $user->username());
4545
}
@@ -50,7 +50,7 @@ public function unban(User $user): RedirectResponse
5050

5151
$this->dispatchSync(new UnbanUser($user));
5252

53-
$this->success('admin.users.unbanned', $user->name());
53+
$this->success($user->name().' was unbanned!');
5454

5555
return redirect()->route('profile', $user->username());
5656
}
@@ -61,7 +61,7 @@ public function delete(User $user): RedirectResponse
6161

6262
$this->dispatchSync(new DeleteUser($user));
6363

64-
$this->success('admin.users.deleted', $user->name());
64+
$this->success($user->name().' was deleted and all of their content was removed!');
6565

6666
return redirect()->route('admin.users');
6767
}

app/Http/Controllers/Articles/ArticlesController.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ public function store(ArticleRequest $request)
116116

117117
$article = Article::findByUuidOrFail($uuid);
118118

119-
$this->success($request->shouldBeSubmitted() ? 'articles.submitted' : 'articles.created');
119+
$this->success(
120+
$request->shouldBeSubmitted()
121+
? 'Thank you for submitting, unfortunately we can\'t accept every submission. You\'ll only hear back from us when we accept your article.'
122+
: 'Article successfully created!'
123+
);
120124

121125
return $request->wantsJson()
122126
? ArticleResource::make($article)
@@ -151,9 +155,9 @@ public function update(ArticleRequest $request, Article $article)
151155
$article = $article->fresh();
152156

153157
if ($wasNotPreviouslySubmitted && $request->shouldBeSubmitted()) {
154-
$this->success('articles.submitted');
158+
$this->success('Thank you for submitting, unfortunately we can\'t accept every submission. You\'ll only hear back from us when we accept your article.');
155159
} else {
156-
$this->success('articles.updated');
160+
$this->success('Article successfully updated!');
157161
}
158162

159163
return $request->wantsJson()
@@ -167,7 +171,7 @@ public function delete(Request $request, Article $article)
167171

168172
$this->dispatchSync(new DeleteArticle($article));
169173

170-
$this->success('articles.deleted');
174+
$this->success('Article successfully deleted!');
171175

172176
return $request->wantsJson()
173177
? response()->json([], Response::HTTP_NO_CONTENT)

app/Http/Controllers/Auth/GitHubController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function handleProviderCallback()
3131
try {
3232
$socialiteUser = $this->getSocialiteUser();
3333
} catch (InvalidStateException $exception) {
34-
$this->error('errors.github_invalid_state');
34+
$this->error('The request timed out. Please try again.');
3535

3636
return redirect()->route('login');
3737
}
@@ -62,13 +62,13 @@ private function userFound(User $user, SocialiteUser $socialiteUser): RedirectRe
6262
private function userNotFound(GitHubUser $user): RedirectResponse
6363
{
6464
if ($user->isTooYoung()) {
65-
$this->error('errors.github_account_too_young');
65+
$this->error('Your GitHub account needs to be older than 2 weeks in order to register.');
6666

6767
return redirect()->route('home');
6868
}
6969

7070
if (! $user->hasPublicRepositories()) {
71-
$this->error('errors.github_account_no_repositories');
71+
$this->error('Your GitHub account needs to have at least 1 public repository in order to register.');
7272

7373
return redirect()->route('home');
7474
}

app/Http/Controllers/Auth/VerificationController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ public function verify(Request $request)
5050
$response = $this->traitVerify($request);
5151

5252
if ($response->getSession()->has('verified')) {
53-
$this->success('auth.verification.success');
53+
$this->success('Your email address was successfully verified.');
5454
} else {
55-
$this->error('auth.verification.no_match');
55+
$this->error('We could not verify your email address. The given email address and code did not match.');
5656
}
5757

5858
return $response;
@@ -64,9 +64,9 @@ public function resend(Request $request)
6464
$response = $this->traitResend($request);
6565

6666
if ($response->getSession()->has('resent')) {
67-
$this->success('auth.verification.sent', $request->user()->emailAddress());
67+
$this->success('Email verification sent to :0. You can change your email address in your profile settings.', $request->user()->emailAddress());
6868
} else {
69-
$this->error('auth.verification.already_verified');
69+
$this->error('Your email address is already verified.');
7070
}
7171

7272
return $response;

app/Http/Controllers/BlockUserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __invoke(Request $request, User $user): RedirectResponse
2222

2323
$this->dispatchSync(new BlockUser($request->user(), $user));
2424

25-
$this->success('settings.user.blocked');
25+
$this->success('User successfully blocked.');
2626

2727
return redirect()->route('profile', $user->username());
2828
}

app/Http/Controllers/Forum/ThreadsController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function store(ThreadRequest $request): RedirectResponse
9595

9696
$thread = Thread::findByUuidOrFail($uuid);
9797

98-
$this->success('forum.threads.created');
98+
$this->success('Thread successfully created!');
9999

100100
return redirect()->route('thread', $thread->slug());
101101
}
@@ -115,7 +115,7 @@ public function update(ThreadRequest $request, Thread $thread): RedirectResponse
115115

116116
$this->dispatchSync(UpdateThread::fromRequest($thread, $request));
117117

118-
$this->success('forum.threads.updated');
118+
$this->success('Thread successfully updated!');
119119

120120
return redirect()->route('thread', $thread->fresh()->slug());
121121
}
@@ -132,7 +132,7 @@ public function delete(Request $request, Thread $thread): RedirectResponse
132132
);
133133
});
134134

135-
$this->success('forum.threads.deleted');
135+
$this->success('Thread successfully deleted!');
136136

137137
return redirect()->route('forum');
138138
}
@@ -144,11 +144,11 @@ public function lock(Request $request, Thread $thread): RedirectResponse
144144
if ($thread->isLocked()) {
145145
$this->dispatchSync(new UnlockThread($thread));
146146

147-
$this->success('forum.threads.unlocked');
147+
$this->success('Thread successfully unlocked!');
148148
} else {
149149
$this->dispatchSync(new LockThread($request->user(), $thread));
150150

151-
$this->success('forum.threads.locked');
151+
$this->success('Thread successfully locked!');
152152
}
153153

154154
return redirect()->route('thread', $thread->slug());

app/Http/Controllers/ReplyController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function store(CreateReplyRequest $request)
3131

3232
$reply = Reply::findByUuidOrFail($uuid);
3333

34-
$this->success('replies.created');
34+
$this->success('Reply successfully added!');
3535

3636
return $this->redirectToReplyAble($reply->replyAble());
3737
}
@@ -42,7 +42,7 @@ public function delete(Request $request, Reply $reply)
4242

4343
$this->dispatchSync(new DeleteReply($reply, $request->delete_reason));
4444

45-
$this->success('replies.deleted');
45+
$this->success('Reply successfully deleted!');
4646

4747
return $this->redirectToReplyAble($reply->replyAble());
4848
}

app/Http/Controllers/Settings/ApiTokenController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function store(CreateApiTokenRequest $request): RedirectResponse
2121
{
2222
$plainTextToken = $this->dispatchSync(new CreateApiToken($request->user(), $request->name()));
2323

24-
$this->success('settings.api_token.created');
24+
$this->success('API token created! Please copy the following token as it will not be shown again:');
2525

2626
return redirect()->route('settings.profile')->with('api_token', $plainTextToken);
2727
}
@@ -30,7 +30,7 @@ public function destroy(DeleteApiTokenRequest $request): RedirectResponse
3030
{
3131
$this->dispatchSync(new DeleteApiToken($request->user(), $request->id()));
3232

33-
$this->success('settings.api_token.deleted');
33+
$this->success('API token successfully removed.');
3434

3535
return redirect()->route('settings.profile');
3636
}

app/Http/Controllers/Settings/NotificationSettingsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function store(NotificationSettingsRequest $request)
2121
(array) $request->validated('allowed_notifications')
2222
));
2323

24-
$this->success('settings.notifications.updated');
24+
$this->success('Notification settings were successfully updated.');
2525

2626
return redirect()->route('settings.profile');
2727
}

app/Http/Controllers/Settings/PasswordController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function update(UpdatePasswordRequest $request): RedirectResponse
1919
{
2020
$this->dispatchSync(new UpdatePassword($request->user(), $request->newPassword()));
2121

22-
$this->success('settings.password.updated');
22+
$this->success('Password successfully changed!');
2323

2424
return redirect()->route('settings.profile');
2525
}

app/Http/Controllers/Settings/ProfileController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function update(UpdateProfileRequest $request): RedirectResponse
2828
{
2929
$this->dispatchSync(UpdateProfile::fromRequest($request->user(), $request));
3030

31-
$this->success('settings.updated');
31+
$this->success('Settings successfully saved! If you changed your email address you\'ll receive an email address to re-confirm it.');
3232

3333
return redirect()->route('settings.profile');
3434
}
@@ -39,7 +39,7 @@ public function destroy(Request $request): RedirectResponse
3939

4040
$this->dispatchSync(new DeleteUser($user));
4141

42-
$this->success('settings.deleted');
42+
$this->success('Account was successfully removed.');
4343

4444
return redirect()->route('home');
4545
}

app/Http/Controllers/Settings/UnblockUserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function __invoke(Request $request, User $user): RedirectResponse
2323

2424
$this->dispatchSync(new UnblockUser($request->user(), $user));
2525

26-
$this->success('settings.user.unblocked');
26+
$this->success('User successfully unblocked.');
2727

2828
return redirect()->route('settings.profile');
2929
}

app/Http/Controllers/UnblockUserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __invoke(Request $request, User $user): RedirectResponse
2222

2323
$this->dispatchSync(new UnblockUser($request->user(), $user));
2424

25-
$this->success('settings.user.unblocked');
25+
$this->success('User successfully unblocked.');
2626

2727
return redirect()->route('profile', $user->username());
2828
}

app/Http/Middleware/RedirectIfBanned.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class RedirectIfBanned
1515
public function handle(Request $request, Closure $next, ?string $guard = null): Response
1616
{
1717
if (Auth::check() && Auth::user()->isBanned()) {
18-
$this->error('errors.banned');
18+
$this->error('This account is banned.');
1919

2020
Auth::logout();
2121

app/Http/Requests/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ abstract class Request extends FormRequest
1212

1313
protected function failedValidation(Validator $validator)
1414
{
15-
$this->error('errors.fields');
15+
$this->error('Something went wrong. Please review the fields below.');
1616

1717
parent::failedValidation($validator);
1818
}

app/Rules/UniqueGitHubUser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function passes($attribute, $value): bool
2626

2727
public function message()
2828
{
29-
$this->error('errors.github_account_exists', [
29+
$this->error('We already found a user with the given GitHub account (:username). Would you like to <a href=":login">login</a> instead?', [
3030
'username' => '@'.$this->user->githubUsername(),
3131
'login' => route('login'),
3232
]);

lang/en/admin.php

Lines changed: 0 additions & 14 deletions
This file was deleted.

lang/en/articles.php

Lines changed: 0 additions & 10 deletions
This file was deleted.

lang/en/auth.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

lang/en/errors.php

Lines changed: 0 additions & 10 deletions
This file was deleted.

lang/en/forum.php

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)