Skip to content

Remove multilang #1060

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

Merged
merged 5 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion app/Concerns/SendsAlerts.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ protected function error(?string $id = null, $parameters = [])

private function sendAlert(string $type, ?string $id = null, $parameters = [])
{
session([$type => trans($id, (array) $parameters)]);
session([$type => __($id, (array) $parameters)]);
}
}
6 changes: 3 additions & 3 deletions app/Http/Controllers/Admin/ArticlesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function approve(Article $article): RedirectResponse

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

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

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

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

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

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

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

return redirect()->route('articles.show', $article->slug());
}
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/Admin/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function ban(BanRequest $request, User $user): RedirectResponse

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

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

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

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

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

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

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

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

return redirect()->route('admin.users');
}
Expand Down
12 changes: 8 additions & 4 deletions app/Http/Controllers/Articles/ArticlesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ public function store(ArticleRequest $request)

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

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

return $request->wantsJson()
? ArticleResource::make($article)
Expand Down Expand Up @@ -150,9 +154,9 @@ public function update(ArticleRequest $request, Article $article)
$article = $article->fresh();

if ($wasNotPreviouslySubmitted && $request->shouldBeSubmitted()) {
$this->success('articles.submitted');
$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.');
} else {
$this->success('articles.updated');
$this->success('Article successfully updated!');
}

return $request->wantsJson()
Expand All @@ -166,7 +170,7 @@ public function delete(Request $request, Article $article)

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

$this->success('articles.deleted');
$this->success('Article successfully deleted!');

return $request->wantsJson()
? response()->json([], Response::HTTP_NO_CONTENT)
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/Auth/GitHubController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function handleProviderCallback()
try {
$socialiteUser = $this->getSocialiteUser();
} catch (InvalidStateException $exception) {
$this->error('errors.github_invalid_state');
$this->error('The request timed out. Please try again.');

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

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

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

return redirect()->route('home');
}
Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/Auth/VerificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public function verify(Request $request)
$response = $this->traitVerify($request);

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

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

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

return $response;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/BlockUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __invoke(Request $request, User $user): RedirectResponse

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

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

return redirect()->route('profile', $user->username());
}
Expand Down
10 changes: 5 additions & 5 deletions app/Http/Controllers/Forum/ThreadsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function store(ThreadRequest $request): RedirectResponse

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

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

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

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

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

return redirect()->route('thread', $thread->fresh()->slug());
}
Expand All @@ -132,7 +132,7 @@ public function delete(Request $request, Thread $thread): RedirectResponse
);
});

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

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

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

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

return redirect()->route('thread', $thread->slug());
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/ReplyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function store(CreateReplyRequest $request)

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

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

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

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

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

return $this->redirectToReplyAble($reply->replyAble());
}
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Settings/ApiTokenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function store(CreateApiTokenRequest $request): RedirectResponse
{
$plainTextToken = $this->dispatchSync(new CreateApiToken($request->user(), $request->name()));

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

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

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

return redirect()->route('settings.profile');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function store(NotificationSettingsRequest $request)
(array) $request->validated('allowed_notifications')
));

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

return redirect()->route('settings.profile');
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Settings/PasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function update(UpdatePasswordRequest $request): RedirectResponse
{
$this->dispatchSync(new UpdatePassword($request->user(), $request->newPassword()));

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

return redirect()->route('settings.profile');
}
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Settings/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function update(UpdateProfileRequest $request): RedirectResponse
{
$this->dispatchSync(UpdateProfile::fromRequest($request->user(), $request));

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

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

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

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

return redirect()->route('home');
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Settings/UnblockUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __invoke(Request $request, User $user): RedirectResponse

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

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

return redirect()->route('settings.profile');
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/UnblockUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __invoke(Request $request, User $user): RedirectResponse

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

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

return redirect()->route('profile', $user->username());
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/RedirectIfBanned.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class RedirectIfBanned
public function handle(Request $request, Closure $next, ?string $guard = null): Response
{
if (Auth::check() && Auth::user()->isBanned()) {
$this->error('errors.banned');
$this->error('This account is banned.');

Auth::logout();

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Requests/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ abstract class Request extends FormRequest

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

parent::failedValidation($validator);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Rules/UniqueGitHubUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function passes($attribute, $value): bool

public function message()
{
$this->error('errors.github_account_exists', [
$this->error('We already found a user with the given GitHub account (:username). Would you like to <a href=":login">login</a> instead?', [
'username' => '@'.$this->user->githubUsername(),
'login' => route('login'),
]);
Expand Down
14 changes: 0 additions & 14 deletions lang/en/admin.php

This file was deleted.

10 changes: 0 additions & 10 deletions lang/en/articles.php

This file was deleted.

27 changes: 0 additions & 27 deletions lang/en/auth.php

This file was deleted.

10 changes: 0 additions & 10 deletions lang/en/errors.php

This file was deleted.

11 changes: 0 additions & 11 deletions lang/en/forum.php

This file was deleted.

Loading