diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php index 62be0b852..e61a488ce 100644 --- a/app/Http/Controllers/AttachmentController.php +++ b/app/Http/Controllers/AttachmentController.php @@ -77,7 +77,7 @@ class AttachmentController extends Controller $this->checkOwnablePermission('attachment-create', $attachment); if (intval($pageId) !== intval($attachment->uploaded_to)) { - return $this->jsonError('Page mismatch during attached file update'); + return $this->jsonError(trans('errors.attachment_page_mismatch')); } $uploadedFile = $request->file('file'); @@ -113,7 +113,7 @@ class AttachmentController extends Controller $this->checkOwnablePermission('attachment-create', $attachment); if (intval($pageId) !== intval($attachment->uploaded_to)) { - return $this->jsonError('Page mismatch during attachment update'); + return $this->jsonError(trans('errors.attachment_page_mismatch')); } $attachment = $this->attachmentService->updateFile($attachment, $request->all()); @@ -175,7 +175,7 @@ class AttachmentController extends Controller $attachments = $request->get('files'); $this->attachmentService->updateFileOrderWithinPage($attachments, $pageId); - return response()->json(['message' => 'Attachment order updated']); + return response()->json(['message' => trans('entities.attachments_order_updated')]); } /** @@ -210,6 +210,6 @@ class AttachmentController extends Controller $attachment = $this->attachment->findOrFail($attachmentId); $this->checkOwnablePermission('attachment-delete', $attachment); $this->attachmentService->deleteFile($attachment); - return response()->json(['message' => 'Attachment deleted']); + return response()->json(['message' => trans('entities.attachments_deleted')]); } } diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index 45e40e6fe..d1fbddc50 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -52,7 +52,7 @@ class ForgotPasswordController extends Controller ); if ($response === Password::RESET_LINK_SENT) { - $message = 'A password reset link has been sent to ' . $request->get('email') . '.'; + $message = trans('auth.reset_password_sent_success', ['email' => $request->get('email')]); session()->flash('success', $message); return back()->with('status', trans($response)); } diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 0de4a8282..e7eeb9bc1 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -2,6 +2,7 @@ namespace BookStack\Http\Controllers\Auth; +use BookStack\Exceptions\AuthException; use BookStack\Http\Controllers\Controller; use BookStack\Repos\UserRepo; use BookStack\Services\SocialAuthService; @@ -86,7 +87,7 @@ class LoginController extends Controller // Check for users with same email already $alreadyUser = $user->newQuery()->where('email', '=', $user->email)->count() > 0; if ($alreadyUser) { - throw new AuthException('A user with the email ' . $user->email . ' already exists but with different credentials.'); + throw new AuthException(trans('errors.error_user_exists_different_creds', ['email' => $user->email])); } $user->save(); diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 6bba6de04..4bf4c0178 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -3,6 +3,7 @@ namespace BookStack\Http\Controllers\Auth; use BookStack\Exceptions\ConfirmationEmailException; +use BookStack\Exceptions\SocialSignInException; use BookStack\Exceptions\UserRegistrationException; use BookStack\Repos\UserRepo; use BookStack\Services\EmailConfirmationService; @@ -82,7 +83,7 @@ class RegisterController extends Controller protected function checkRegistrationAllowed() { if (!setting('registration-enabled')) { - throw new UserRegistrationException('Registrations are currently disabled.', '/login'); + throw new UserRegistrationException(trans('auth.registrations_disabled'), '/login'); } } @@ -147,7 +148,7 @@ class RegisterController extends Controller $restrictedEmailDomains = explode(',', str_replace(' ', '', setting('registration-restrict'))); $userEmailDomain = $domain = substr(strrchr($userData['email'], "@"), 1); if (!in_array($userEmailDomain, $restrictedEmailDomains)) { - throw new UserRegistrationException('That email domain does not have access to this application', '/register'); + throw new UserRegistrationException(trans('auth.registration_email_domain_invalid'), '/register'); } } @@ -169,7 +170,7 @@ class RegisterController extends Controller } auth()->login($newUser); - session()->flash('success', 'Thanks for signing up! You are now registered and signed in.'); + session()->flash('success', trans('auth.register_success')); return redirect($this->redirectPath()); } @@ -262,7 +263,7 @@ class RegisterController extends Controller return $this->socialRegisterCallback($socialDriver); } } else { - throw new SocialSignInException('No action defined', '/login'); + throw new SocialSignInException(trans('errors.social_no_action_defined'), '/login'); } return redirect()->back(); } diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index bd64793f9..eb678503d 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -41,7 +41,7 @@ class ResetPasswordController extends Controller */ protected function sendResetResponse($response) { - $message = 'Your password has been successfully reset.'; + $message = trans('auth.reset_password_success'); session()->flash('success', $message); return redirect($this->redirectPath()) ->with('status', trans($response)); diff --git a/app/Http/Controllers/BookController.php b/app/Http/Controllers/BookController.php index 8ada59433..80a6c24b3 100644 --- a/app/Http/Controllers/BookController.php +++ b/app/Http/Controllers/BookController.php @@ -7,6 +7,7 @@ use BookStack\Http\Requests; use BookStack\Repos\BookRepo; use BookStack\Repos\ChapterRepo; use BookStack\Repos\PageRepo; +use Illuminate\Http\Response; use Views; class BookController extends Controller @@ -53,7 +54,7 @@ class BookController extends Controller public function create() { $this->checkPermission('book-create-all'); - $this->setPageTitle('Create New Book'); + $this->setPageTitle(trans('entities.books_create')); return view('books/create'); } @@ -99,7 +100,7 @@ class BookController extends Controller { $book = $this->bookRepo->getBySlug($slug); $this->checkOwnablePermission('book-update', $book); - $this->setPageTitle('Edit Book ' . $book->getShortName()); + $this->setPageTitle(trans('entities.books_edit_named',['bookName'=>$book->getShortName()])); return view('books/edit', ['book' => $book, 'current' => $book]); } @@ -131,7 +132,7 @@ class BookController extends Controller { $book = $this->bookRepo->getBySlug($bookSlug); $this->checkOwnablePermission('book-delete', $book); - $this->setPageTitle('Delete Book ' . $book->getShortName()); + $this->setPageTitle(trans('entities.books_delete_named', ['bookName'=>$book->getShortName()])); return view('books/delete', ['book' => $book, 'current' => $book]); } @@ -146,7 +147,7 @@ class BookController extends Controller $this->checkOwnablePermission('book-update', $book); $bookChildren = $this->bookRepo->getChildren($book, true); $books = $this->bookRepo->getAll(false); - $this->setPageTitle('Sort Book ' . $book->getShortName()); + $this->setPageTitle(trans('entities.books_sort_named', ['bookName'=>$book->getShortName()])); return view('books/sort', ['book' => $book, 'current' => $book, 'books' => $books, 'bookChildren' => $bookChildren]); } @@ -264,7 +265,7 @@ class BookController extends Controller $book = $this->bookRepo->getBySlug($bookSlug); $this->checkOwnablePermission('restrictions-manage', $book); $this->bookRepo->updateEntityPermissionsFromRequest($request, $book); - session()->flash('success', 'Book Restrictions Updated'); + session()->flash('success', trans('entities.books_permissions_updated')); return redirect($book->getUrl()); } } diff --git a/app/Http/Controllers/ChapterController.php b/app/Http/Controllers/ChapterController.php index a3fb600fd..849835185 100644 --- a/app/Http/Controllers/ChapterController.php +++ b/app/Http/Controllers/ChapterController.php @@ -3,9 +3,9 @@ use Activity; use BookStack\Repos\UserRepo; use Illuminate\Http\Request; -use BookStack\Http\Requests; use BookStack\Repos\BookRepo; use BookStack\Repos\ChapterRepo; +use Illuminate\Http\Response; use Views; class ChapterController extends Controller @@ -38,7 +38,7 @@ class ChapterController extends Controller { $book = $this->bookRepo->getBySlug($bookSlug); $this->checkOwnablePermission('chapter-create', $book); - $this->setPageTitle('Create New Chapter'); + $this->setPageTitle(trans('entities.chapters_create')); return view('chapters/create', ['book' => $book, 'current' => $book]); } @@ -99,7 +99,7 @@ class ChapterController extends Controller $book = $this->bookRepo->getBySlug($bookSlug); $chapter = $this->chapterRepo->getBySlug($chapterSlug, $book->id); $this->checkOwnablePermission('chapter-update', $chapter); - $this->setPageTitle('Edit Chapter' . $chapter->getShortName()); + $this->setPageTitle(trans('entities.chapters_edit_named', ['chapterName' => $chapter->getShortName()])); return view('chapters/edit', ['book' => $book, 'chapter' => $chapter, 'current' => $chapter]); } @@ -136,7 +136,7 @@ class ChapterController extends Controller $book = $this->bookRepo->getBySlug($bookSlug); $chapter = $this->chapterRepo->getBySlug($chapterSlug, $book->id); $this->checkOwnablePermission('chapter-delete', $chapter); - $this->setPageTitle('Delete Chapter' . $chapter->getShortName()); + $this->setPageTitle(trans('entities.chapters_delete_named', ['chapterName' => $chapter->getShortName()])); return view('chapters/delete', ['book' => $book, 'chapter' => $chapter, 'current' => $chapter]); } @@ -166,6 +166,7 @@ class ChapterController extends Controller public function showMove($bookSlug, $chapterSlug) { $book = $this->bookRepo->getBySlug($bookSlug); $chapter = $this->chapterRepo->getBySlug($chapterSlug, $book->id); + $this->setPageTitle(trans('entities.chapters_move_named', ['chapterName' => $chapter->getShortName()])); $this->checkOwnablePermission('chapter-update', $chapter); return view('chapters/move', [ 'chapter' => $chapter, @@ -202,13 +203,13 @@ class ChapterController extends Controller } if ($parent === false || $parent === null) { - session()->flash('The selected Book was not found'); + session()->flash('error', trans('errors.selected_book_not_found')); return redirect()->back(); } $this->chapterRepo->changeBook($parent->id, $chapter, true); Activity::add($chapter, 'chapter_move', $chapter->book->id); - session()->flash('success', sprintf('Chapter moved to "%s"', $parent->name)); + session()->flash('success', trans('entities.chapter_move_success', ['bookName' => $parent->name])); return redirect($chapter->getUrl()); } @@ -244,7 +245,7 @@ class ChapterController extends Controller $chapter = $this->chapterRepo->getBySlug($chapterSlug, $book->id); $this->checkOwnablePermission('restrictions-manage', $chapter); $this->chapterRepo->updateEntityPermissionsFromRequest($request, $chapter); - session()->flash('success', 'Chapter Restrictions Updated'); + session()->flash('success', trans('entities.chapters_permissions_success')); return redirect($chapter->getUrl()); } } diff --git a/app/Http/Controllers/ImageController.php b/app/Http/Controllers/ImageController.php index 621c23e85..f073bea0a 100644 --- a/app/Http/Controllers/ImageController.php +++ b/app/Http/Controllers/ImageController.php @@ -73,6 +73,7 @@ class ImageController extends Controller * @param $filter * @param int $page * @param Request $request + * @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\JsonResponse|\Symfony\Component\HttpFoundation\Response */ public function getGalleryFiltered($filter, $page = 0, Request $request) { @@ -169,7 +170,7 @@ class ImageController extends Controller } $this->imageRepo->destroyImage($image); - return response()->json('Image Deleted'); + return response()->json(trans('components.images_deleted')); } diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php index c2d8e257c..e40d7668a 100644 --- a/app/Http/Controllers/PageController.php +++ b/app/Http/Controllers/PageController.php @@ -10,6 +10,7 @@ use BookStack\Http\Requests; use BookStack\Repos\BookRepo; use BookStack\Repos\ChapterRepo; use BookStack\Repos\PageRepo; +use Illuminate\Http\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Views; use GatherContent\Htmldiff\Htmldiff; @@ -62,7 +63,7 @@ class PageController extends Controller } // Otherwise show edit view - $this->setPageTitle('Create New Page'); + $this->setPageTitle(trans('entities.pages_new')); return view('pages/guest-create', ['parent' => $parent]); } @@ -104,7 +105,7 @@ class PageController extends Controller $book = $this->bookRepo->getBySlug($bookSlug); $draft = $this->pageRepo->getById($pageId, true); $this->checkOwnablePermission('page-create', $book); - $this->setPageTitle('Edit Page Draft'); + $this->setPageTitle(trans('entities.pages_edit_draft')); $draftsEnabled = $this->signedIn; return view('pages/edit', [ @@ -119,6 +120,7 @@ class PageController extends Controller * Store a new page by changing a draft into a page. * @param Request $request * @param string $bookSlug + * @param int $pageId * @return Response */ public function store(Request $request, $bookSlug, $pageId) @@ -201,7 +203,7 @@ class PageController extends Controller $book = $this->bookRepo->getBySlug($bookSlug); $page = $this->pageRepo->getBySlug($pageSlug, $book->id); $this->checkOwnablePermission('page-update', $page); - $this->setPageTitle('Editing Page ' . $page->getShortName()); + $this->setPageTitle(trans('entities.pages_editing_named', ['pageName'=>$page->getShortName()])); $page->isDraft = false; // Check for active editing @@ -265,7 +267,7 @@ class PageController extends Controller if (!$this->signedIn) { return response()->json([ 'status' => 'error', - 'message' => 'Guests cannot save drafts', + 'message' => trans('errors.guests_cannot_save_drafts'), ], 500); } @@ -279,7 +281,7 @@ class PageController extends Controller $utcUpdateTimestamp = $updateTime + Carbon::createFromTimestamp(0)->offset; return response()->json([ 'status' => 'success', - 'message' => 'Draft saved at ', + 'message' => trans('entities.pages_edit_draft_save_at'), 'timestamp' => $utcUpdateTimestamp ]); } @@ -307,7 +309,7 @@ class PageController extends Controller $book = $this->bookRepo->getBySlug($bookSlug); $page = $this->pageRepo->getBySlug($pageSlug, $book->id); $this->checkOwnablePermission('page-delete', $page); - $this->setPageTitle('Delete Page ' . $page->getShortName()); + $this->setPageTitle(trans('entities.pages_delete_named', ['pageName'=>$page->getShortName()])); return view('pages/delete', ['book' => $book, 'page' => $page, 'current' => $page]); } @@ -324,7 +326,7 @@ class PageController extends Controller $book = $this->bookRepo->getBySlug($bookSlug); $page = $this->pageRepo->getById($pageId, true); $this->checkOwnablePermission('page-update', $page); - $this->setPageTitle('Delete Draft Page ' . $page->getShortName()); + $this->setPageTitle(trans('entities.pages_delete_draft_named', ['pageName'=>$page->getShortName()])); return view('pages/delete', ['book' => $book, 'page' => $page, 'current' => $page]); } @@ -341,7 +343,7 @@ class PageController extends Controller $page = $this->pageRepo->getBySlug($pageSlug, $book->id); $this->checkOwnablePermission('page-delete', $page); Activity::addMessage('page_delete', $book->id, $page->name); - session()->flash('success', 'Page deleted'); + session()->flash('success', trans('entities.pages_delete_success')); $this->pageRepo->destroy($page); return redirect($book->getUrl()); } @@ -358,7 +360,7 @@ class PageController extends Controller $book = $this->bookRepo->getBySlug($bookSlug); $page = $this->pageRepo->getById($pageId, true); $this->checkOwnablePermission('page-update', $page); - session()->flash('success', 'Draft deleted'); + session()->flash('success', trans('entities.pages_delete_draft_success')); $this->pageRepo->destroy($page); return redirect($book->getUrl()); } @@ -373,7 +375,7 @@ class PageController extends Controller { $book = $this->bookRepo->getBySlug($bookSlug); $page = $this->pageRepo->getBySlug($pageSlug, $book->id); - $this->setPageTitle('Revisions For ' . $page->getShortName()); + $this->setPageTitle(trans('entities.pages_revisions_named', ['pageName'=>$page->getShortName()])); return view('pages/revisions', ['page' => $page, 'book' => $book, 'current' => $page]); } @@ -391,7 +393,7 @@ class PageController extends Controller $revision = $this->pageRepo->getRevisionById($revisionId); $page->fill($revision->toArray()); - $this->setPageTitle('Page Revision For ' . $page->getShortName()); + $this->setPageTitle(trans('entities.pages_revision_named', ['pageName'=>$page->getShortName()])); return view('pages/revision', [ 'page' => $page, @@ -417,7 +419,7 @@ class PageController extends Controller $diff = (new Htmldiff)->diff($prevContent, $revision->html); $page->fill($revision->toArray()); - $this->setPageTitle('Page Revision For ' . $page->getShortName()); + $this->setPageTitle(trans('entities.pages_revision_named', ['pageName'=>$page->getShortName()])); return view('pages/revision', [ 'page' => $page, @@ -503,7 +505,7 @@ class PageController extends Controller { $pages = $this->pageRepo->getRecentlyCreatedPaginated(20)->setPath(baseUrl('/pages/recently-created')); return view('pages/detailed-listing', [ - 'title' => 'Recently Created Pages', + 'title' => trans('entities.recently_created_pages'), 'pages' => $pages ]); } @@ -516,7 +518,7 @@ class PageController extends Controller { $pages = $this->pageRepo->getRecentlyUpdatedPaginated(20)->setPath(baseUrl('/pages/recently-updated')); return view('pages/detailed-listing', [ - 'title' => 'Recently Updated Pages', + 'title' => trans('entities.recently_updated_pages'), 'pages' => $pages ]); } @@ -589,13 +591,13 @@ class PageController extends Controller } if ($parent === false || $parent === null) { - session()->flash('The selected Book or Chapter was not found'); + session()->flash(trans('entities.selected_book_chapter_not_found')); return redirect()->back(); } $this->pageRepo->changePageParent($page, $parent); Activity::add($page, 'page_move', $page->book->id); - session()->flash('success', sprintf('Page moved to "%s"', $parent->name)); + session()->flash('success', trans('entities.pages_move_success', ['parentName' => $parent->name])); return redirect($page->getUrl()); } @@ -613,7 +615,7 @@ class PageController extends Controller $page = $this->pageRepo->getBySlug($pageSlug, $book->id); $this->checkOwnablePermission('restrictions-manage', $page); $this->pageRepo->updateEntityPermissionsFromRequest($request, $page); - session()->flash('success', 'Page Permissions Updated'); + session()->flash('success', trans('entities.pages_permissions_success')); return redirect($page->getUrl()); } diff --git a/app/Http/Controllers/PermissionController.php b/app/Http/Controllers/PermissionController.php index ed430c0b7..cd064e7e8 100644 --- a/app/Http/Controllers/PermissionController.php +++ b/app/Http/Controllers/PermissionController.php @@ -2,9 +2,7 @@ use BookStack\Exceptions\PermissionsException; use BookStack\Repos\PermissionsRepo; -use BookStack\Services\PermissionService; use Illuminate\Http\Request; -use BookStack\Http\Requests; class PermissionController extends Controller { @@ -55,7 +53,7 @@ class PermissionController extends Controller ]); $this->permissionsRepo->saveNewRole($request->all()); - session()->flash('success', 'Role successfully created'); + session()->flash('success', trans('settings.role_create_success')); return redirect('/settings/roles'); } @@ -69,7 +67,7 @@ class PermissionController extends Controller { $this->checkPermission('user-roles-manage'); $role = $this->permissionsRepo->getRoleById($id); - if ($role->hidden) throw new PermissionsException('This role cannot be edited'); + if ($role->hidden) throw new PermissionsException(trans('errors.role_cannot_be_edited')); return view('settings/roles/edit', ['role' => $role]); } @@ -88,7 +86,7 @@ class PermissionController extends Controller ]); $this->permissionsRepo->updateRole($id, $request->all()); - session()->flash('success', 'Role successfully updated'); + session()->flash('success', trans('settings.role_update_success')); return redirect('/settings/roles'); } @@ -103,7 +101,7 @@ class PermissionController extends Controller $this->checkPermission('user-roles-manage'); $role = $this->permissionsRepo->getRoleById($id); $roles = $this->permissionsRepo->getAllRolesExcept($role); - $blankRole = $role->newInstance(['display_name' => 'Don\'t migrate users']); + $blankRole = $role->newInstance(['display_name' => trans('settings.role_delete_no_migration')]); $roles->prepend($blankRole); return view('settings/roles/delete', ['role' => $role, 'roles' => $roles]); } @@ -126,7 +124,7 @@ class PermissionController extends Controller return redirect()->back(); } - session()->flash('success', 'Role successfully deleted'); + session()->flash('success', trans('settings.role_delete_success')); return redirect('/settings/roles'); } } diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index 58ad737c4..bb70b0f88 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -1,11 +1,7 @@ -pageRepo->getBySearch($searchTerm, [], 20, $paginationAppends); $books = $this->bookRepo->getBySearch($searchTerm, 10, $paginationAppends); $chapters = $this->chapterRepo->getBySearch($searchTerm, [], 10, $paginationAppends); - $this->setPageTitle('Search For ' . $searchTerm); + $this->setPageTitle(trans('entities.search_for_term', ['term' => $searchTerm])); return view('search/all', [ 'pages' => $pages, 'books' => $books, @@ -70,10 +66,10 @@ class SearchController extends Controller $searchTerm = $request->get('term'); $paginationAppends = $request->only('term'); $pages = $this->pageRepo->getBySearch($searchTerm, [], 20, $paginationAppends); - $this->setPageTitle('Page Search For ' . $searchTerm); + $this->setPageTitle(trans('entities.search_page_for_term', ['term' => $searchTerm])); return view('search/entity-search-list', [ 'entities' => $pages, - 'title' => 'Page Search Results', + 'title' => trans('entities.search_results_page'), 'searchTerm' => $searchTerm ]); } @@ -90,10 +86,10 @@ class SearchController extends Controller $searchTerm = $request->get('term'); $paginationAppends = $request->only('term'); $chapters = $this->chapterRepo->getBySearch($searchTerm, [], 20, $paginationAppends); - $this->setPageTitle('Chapter Search For ' . $searchTerm); + $this->setPageTitle(trans('entities.search_chapter_for_term', ['term' => $searchTerm])); return view('search/entity-search-list', [ 'entities' => $chapters, - 'title' => 'Chapter Search Results', + 'title' => trans('entities.search_results_chapter'), 'searchTerm' => $searchTerm ]); } @@ -110,10 +106,10 @@ class SearchController extends Controller $searchTerm = $request->get('term'); $paginationAppends = $request->only('term'); $books = $this->bookRepo->getBySearch($searchTerm, 20, $paginationAppends); - $this->setPageTitle('Book Search For ' . $searchTerm); + $this->setPageTitle(trans('entities.search_book_for_term', ['term' => $searchTerm])); return view('search/entity-search-list', [ 'entities' => $books, - 'title' => 'Book Search Results', + 'title' => trans('entities.search_results_book'), 'searchTerm' => $searchTerm ]); } diff --git a/app/Http/Controllers/SettingController.php b/app/Http/Controllers/SettingController.php index 65135eda3..70a12631a 100644 --- a/app/Http/Controllers/SettingController.php +++ b/app/Http/Controllers/SettingController.php @@ -1,8 +1,7 @@ flash('success', 'Settings Saved'); + session()->flash('success', trans('settings.settings_save_success')); return redirect('/settings'); } diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index c8a356541..24bdcdb1c 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -2,7 +2,6 @@ use BookStack\Repos\TagRepo; use Illuminate\Http\Request; -use BookStack\Http\Requests; class TagController extends Controller { @@ -16,12 +15,14 @@ class TagController extends Controller public function __construct(TagRepo $tagRepo) { $this->tagRepo = $tagRepo; + parent::__construct(); } /** * Get all the Tags for a particular entity * @param $entityType * @param $entityId + * @return \Illuminate\Http\JsonResponse */ public function getForEntity($entityType, $entityId) { @@ -29,29 +30,10 @@ class TagController extends Controller return response()->json($tags); } - /** - * Update the tags for a particular entity. - * @param $entityType - * @param $entityId - * @param Request $request - * @return mixed - */ - public function updateForEntity($entityType, $entityId, Request $request) - { - $entity = $this->tagRepo->getEntity($entityType, $entityId, 'update'); - if ($entity === null) return $this->jsonError("Entity not found", 404); - - $inputTags = $request->input('tags'); - $tags = $this->tagRepo->saveTagsToEntity($entity, $inputTags); - return response()->json([ - 'tags' => $tags, - 'message' => 'Tags successfully updated' - ]); - } - /** * Get tag name suggestions from a given search term. * @param Request $request + * @return \Illuminate\Http\JsonResponse */ public function getNameSuggestions(Request $request) { @@ -63,6 +45,7 @@ class TagController extends Controller /** * Get tag value suggestions from a given search term. * @param Request $request + * @return \Illuminate\Http\JsonResponse */ public function getValueSuggestions(Request $request) { diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 18ef1a671..b5184c40a 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -44,7 +44,7 @@ class UserController extends Controller 'sort' => $request->has('sort') ? $request->get('sort') : 'name', ]; $users = $this->userRepo->getAllUsersPaginatedAndSorted(20, $listDetails); - $this->setPageTitle('Users'); + $this->setPageTitle(trans('settings.users')); $users->appends($listDetails); return view('users/index', ['users' => $users, 'listDetails' => $listDetails]); } @@ -83,7 +83,6 @@ class UserController extends Controller } $this->validate($request, $validationRules); - $user = $this->user->fill($request->all()); if ($authMethod === 'standard') { @@ -131,7 +130,7 @@ class UserController extends Controller $authMethod = ($user->system_name) ? 'system' : config('auth.method'); $activeSocialDrivers = $socialAuthService->getActiveDrivers(); - $this->setPageTitle('User Profile'); + $this->setPageTitle(trans('settings.user_profile')); $roles = $this->userRepo->getAllRoles(); return view('users/edit', ['user' => $user, 'activeSocialDrivers' => $activeSocialDrivers, 'authMethod' => $authMethod, 'roles' => $roles]); } @@ -154,8 +153,6 @@ class UserController extends Controller 'email' => 'min:2|email|unique:users,email,' . $id, 'password' => 'min:5|required_with:password_confirm', 'password-confirm' => 'same:password|required_with:password' - ], [ - 'password-confirm.required_with' => 'Password confirmation required' ]); $user = $this->user->findOrFail($id); @@ -179,7 +176,7 @@ class UserController extends Controller } $user->save(); - session()->flash('success', 'User successfully updated'); + session()->flash('success', trans('settings.users_edit_success')); $redirectUrl = userCan('users-manage') ? '/settings/users' : '/settings/users/' . $user->id; return redirect($redirectUrl); @@ -197,7 +194,7 @@ class UserController extends Controller }); $user = $this->user->findOrFail($id); - $this->setPageTitle('Delete User ' . $user->name); + $this->setPageTitle(trans('settings.users_delete_named', ['userName' => $user->name])); return view('users/delete', ['user' => $user]); } @@ -216,17 +213,17 @@ class UserController extends Controller $user = $this->userRepo->getById($id); if ($this->userRepo->isOnlyAdmin($user)) { - session()->flash('error', 'You cannot delete the only admin'); + session()->flash('error', trans('errors.users_cannot_delete_only_admin')); return redirect($user->getEditUrl()); } if ($user->system_name === 'public') { - session()->flash('error', 'You cannot delete the guest user'); + session()->flash('error', trans('errors.users_cannot_delete_guest')); return redirect($user->getEditUrl()); } $this->userRepo->destroy($user); - session()->flash('success', 'User successfully removed'); + session()->flash('success', trans('settings.users_delete_success')); return redirect('/settings/users'); } diff --git a/app/Repos/BookRepo.php b/app/Repos/BookRepo.php index 7bb91f472..b14cf0dab 100644 --- a/app/Repos/BookRepo.php +++ b/app/Repos/BookRepo.php @@ -109,7 +109,7 @@ class BookRepo extends EntityRepo public function getBySlug($slug) { $book = $this->bookQuery()->where('slug', '=', $slug)->first(); - if ($book === null) throw new NotFoundException('Book not found'); + if ($book === null) throw new NotFoundException(trans('errors.book_not_found')); return $book; } diff --git a/app/Repos/ChapterRepo.php b/app/Repos/ChapterRepo.php index 4c13b9aaf..4106f93ee 100644 --- a/app/Repos/ChapterRepo.php +++ b/app/Repos/ChapterRepo.php @@ -69,7 +69,7 @@ class ChapterRepo extends EntityRepo public function getBySlug($slug, $bookId) { $chapter = $this->chapterQuery()->where('slug', '=', $slug)->where('book_id', '=', $bookId)->first(); - if ($chapter === null) throw new NotFoundException('Chapter not found'); + if ($chapter === null) throw new NotFoundException(trans('errors.chapter_not_found')); return $chapter; } diff --git a/app/Repos/PageRepo.php b/app/Repos/PageRepo.php index e6d713f77..14463c12d 100644 --- a/app/Repos/PageRepo.php +++ b/app/Repos/PageRepo.php @@ -66,7 +66,7 @@ class PageRepo extends EntityRepo public function getBySlug($slug, $bookId) { $page = $this->pageQuery()->where('slug', '=', $slug)->where('book_id', '=', $bookId)->first(); - if ($page === null) throw new NotFoundException('Page not found'); + if ($page === null) throw new NotFoundException(trans('errors.page_not_found')); return $page; } @@ -134,7 +134,7 @@ class PageRepo extends EntityRepo $draftPage->draft = false; $draftPage->save(); - $this->saveRevision($draftPage, 'Initial Publish'); + $this->saveRevision($draftPage, trans('entities.pages_initial_revision')); return $draftPage; } @@ -143,12 +143,12 @@ class PageRepo extends EntityRepo * Get a new draft page instance. * @param Book $book * @param Chapter|bool $chapter - * @return static + * @return Page */ public function getDraftPage(Book $book, $chapter = false) { $page = $this->page->newInstance(); - $page->name = 'New Page'; + $page->name = trans('entities.pages_initial_name'); $page->created_by = user()->id; $page->updated_by = user()->id; $page->draft = true; @@ -487,11 +487,9 @@ class PageRepo extends EntityRepo */ public function getUserPageDraftMessage(PageRevision $draft) { - $message = 'You are currently editing a draft that was last saved ' . $draft->updated_at->diffForHumans() . '.'; - if ($draft->page->updated_at->timestamp > $draft->updated_at->timestamp) { - $message .= "\n This page has been updated by since that time. It is recommended that you discard this draft."; - } - return $message; + $message = trans('entities.pages_editing_draft_notification', ['timeDiff' => $draft->updated_at->diffForHumans()]); + if ($draft->page->updated_at->timestamp <= $draft->updated_at->timestamp) return $message; + return $message . "\n" . trans('entities.pages_draft_edited_notification'); } /** @@ -519,10 +517,10 @@ class PageRepo extends EntityRepo public function getPageEditingActiveMessage(Page $page, $minRange = null) { $pageDraftEdits = $this->activePageEditingQuery($page, $minRange)->get(); - $userMessage = $pageDraftEdits->count() > 1 ? $pageDraftEdits->count() . ' users have' : $pageDraftEdits->first()->createdBy->name . ' has'; - $timeMessage = $minRange === null ? 'since the page was last updated' : 'in the last ' . $minRange . ' minutes'; - $message = '%s started editing this page %s. Take care not to overwrite each other\'s updates!'; - return sprintf($message, $userMessage, $timeMessage); + + $userMessage = $pageDraftEdits->count() > 1 ? trans('entities.pages_draft_edit_active.start_a', ['count' => $pageDraftEdits->count()]): trans('entities.pages_draft_edit_active.start_b', ['userName' => $pageDraftEdits->first()->createdBy->name]); + $timeMessage = $minRange === null ? trans('entities.pages_draft_edit_active.time_a') : trans('entities.pages_draft_edit_active.time_b', ['minCount'=>$minRange]); + return trans('entities.pages_draft_edit_active.message', ['start' => $userMessage, 'time' => $timeMessage]); } /** diff --git a/app/Repos/PermissionsRepo.php b/app/Repos/PermissionsRepo.php index 24497c911..e1c6d87b1 100644 --- a/app/Repos/PermissionsRepo.php +++ b/app/Repos/PermissionsRepo.php @@ -133,9 +133,9 @@ class PermissionsRepo // Prevent deleting admin role or default registration role. if ($role->system_name && in_array($role->system_name, $this->systemRoles)) { - throw new PermissionsException('This role is a system role and cannot be deleted'); + throw new PermissionsException(trans('errors.role_system_cannot_be_deleted')); } else if ($role->id == setting('registration-role')) { - throw new PermissionsException('This role cannot be deleted while set as the default registration role.'); + throw new PermissionsException(trans('errors.role_registration_default_cannot_delete')); } if ($migrateRoleId) { diff --git a/app/Repos/TagRepo.php b/app/Repos/TagRepo.php index 6d0857f8b..6e422c4f4 100644 --- a/app/Repos/TagRepo.php +++ b/app/Repos/TagRepo.php @@ -121,7 +121,7 @@ class TagRepo /** * Create a new Tag instance from user input. * @param $input - * @return static + * @return Tag */ protected function newInstanceFromInput($input) { diff --git a/app/Repos/UserRepo.php b/app/Repos/UserRepo.php index ab3716fca..22c92f3ce 100644 --- a/app/Repos/UserRepo.php +++ b/app/Repos/UserRepo.php @@ -3,7 +3,6 @@ use BookStack\Role; use BookStack\User; use Exception; -use Setting; class UserRepo { diff --git a/app/Services/AttachmentService.php b/app/Services/AttachmentService.php index e0ee3a04d..592d67e63 100644 --- a/app/Services/AttachmentService.php +++ b/app/Services/AttachmentService.php @@ -193,7 +193,7 @@ class AttachmentService extends UploadService try { $storage->put($attachmentStoragePath, $attachmentData); } catch (Exception $e) { - throw new FileUploadException('File path ' . $attachmentStoragePath . ' could not be uploaded to. Ensure it is writable to the server.'); + throw new FileUploadException(trans('errors.path_not_writable', ['filePath' => $attachmentStoragePath])); } return $attachmentPath; } diff --git a/app/Services/EmailConfirmationService.php b/app/Services/EmailConfirmationService.php index d4ec1e976..8eb52708c 100644 --- a/app/Services/EmailConfirmationService.php +++ b/app/Services/EmailConfirmationService.php @@ -33,7 +33,7 @@ class EmailConfirmationService public function sendConfirmation(User $user) { if ($user->email_confirmed) { - throw new ConfirmationEmailException('Email has already been confirmed, Try logging in.', '/login'); + throw new ConfirmationEmailException(trans('errors.email_already_confirmed'), '/login'); } $this->deleteConfirmationsByUser($user); @@ -63,7 +63,7 @@ class EmailConfirmationService * Gets an email confirmation by looking up the token, * Ensures the token has not expired. * @param string $token - * @return EmailConfirmation + * @return array|null|\stdClass * @throws UserRegistrationException */ public function getEmailConfirmationFromToken($token) @@ -72,14 +72,14 @@ class EmailConfirmationService // If not found show error if ($emailConfirmation === null) { - throw new UserRegistrationException('This confirmation token is not valid or has already been used, Please try registering again.', '/register'); + throw new UserRegistrationException(trans('errors.email_confirmation_invalid'), '/register'); } // If more than a day old if (Carbon::now()->subDay()->gt(new Carbon($emailConfirmation->created_at))) { $user = $this->users->getById($emailConfirmation->user_id); $this->sendConfirmation($user); - throw new UserRegistrationException('The confirmation token has expired, A new confirmation email has been sent.', '/register/confirm'); + throw new UserRegistrationException(trans('errors.email_confirmation_expired'), '/register/confirm'); } $emailConfirmation->user = $this->users->getById($emailConfirmation->user_id); diff --git a/app/Services/ImageService.php b/app/Services/ImageService.php index dfe2cf453..e34b3fb2b 100644 --- a/app/Services/ImageService.php +++ b/app/Services/ImageService.php @@ -59,7 +59,7 @@ class ImageService extends UploadService { $imageName = $imageName ? $imageName : basename($url); $imageData = file_get_contents($url); - if($imageData === false) throw new \Exception('Cannot get image from ' . $url); + if($imageData === false) throw new \Exception(trans('errors.cannot_get_image_from_url', ['url' => $url])); return $this->saveNew($imageName, $imageData, $type); } @@ -93,7 +93,7 @@ class ImageService extends UploadService $storage->put($fullPath, $imageData); $storage->setVisibility($fullPath, 'public'); } catch (Exception $e) { - throw new ImageUploadException('Image Path ' . $fullPath . ' is not writable by the server.'); + throw new ImageUploadException(trans('errors.path_not_writable', ['filePath' => $fullPath])); } if ($this->isLocal()) $fullPath = str_replace_first('/public', '', $fullPath); @@ -160,7 +160,7 @@ class ImageService extends UploadService $thumb = $this->imageTool->make($storage->get($imagePath)); } catch (Exception $e) { if ($e instanceof \ErrorException || $e instanceof NotSupportedException) { - throw new ImageUploadException('The server cannot create thumbnails. Please check you have the GD PHP extension installed.'); + throw new ImageUploadException(trans('errors.cannot_create_thumbs')); } else { throw $e; } diff --git a/app/Services/LdapService.php b/app/Services/LdapService.php index b7f101ad2..40b24f141 100644 --- a/app/Services/LdapService.php +++ b/app/Services/LdapService.php @@ -94,7 +94,7 @@ class LdapService $ldapBind = $this->ldap->bind($connection, $ldapDn, $ldapPass); } - if (!$ldapBind) throw new LdapException('LDAP access failed using ' . ($isAnonymous ? ' anonymous bind.' : ' given dn & pass details')); + if (!$ldapBind) throw new LdapException(($isAnonymous ? trans('errors.ldap_fail_anonymous') : trans('errors.ldap_fail_authed'))); } /** @@ -109,7 +109,7 @@ class LdapService // Check LDAP extension in installed if (!function_exists('ldap_connect') && config('app.env') !== 'testing') { - throw new LdapException('LDAP PHP extension not installed'); + throw new LdapException(trans('errors.ldap_extension_not_installed')); } // Get port from server string if specified. @@ -117,7 +117,7 @@ class LdapService $ldapConnection = $this->ldap->connect($ldapServer[0], count($ldapServer) > 1 ? $ldapServer[1] : 389); if ($ldapConnection === false) { - throw new LdapException('Cannot connect to ldap server, Initial connection failed'); + throw new LdapException(trans('errors.ldap_cannot_connect')); } // Set any required options diff --git a/app/Services/SocialAuthService.php b/app/Services/SocialAuthService.php index d76a7231b..fe554b8d7 100644 --- a/app/Services/SocialAuthService.php +++ b/app/Services/SocialAuthService.php @@ -70,12 +70,12 @@ class SocialAuthService // Check social account has not already been used if ($this->socialAccount->where('driver_id', '=', $socialUser->getId())->exists()) { - throw new UserRegistrationException('This ' . $socialDriver . ' account is already in use, Try logging in via the ' . $socialDriver . ' option.', '/login'); + throw new UserRegistrationException(trans('errors.social_account_in_use', ['socialAccount'=>$socialDriver]), '/login'); } if ($this->userRepo->getByEmail($socialUser->getEmail())) { $email = $socialUser->getEmail(); - throw new UserRegistrationException('The email ' . $email . ' is already in use. If you already have an account you can connect your ' . $socialDriver . ' account from your profile settings.', '/login'); + throw new UserRegistrationException(trans('errors.social_account_in_use', ['socialAccount'=>$socialDriver, 'email' => $email]), '/login'); } return $socialUser; @@ -113,27 +113,26 @@ class SocialAuthService if ($isLoggedIn && $socialAccount === null) { $this->fillSocialAccount($socialDriver, $socialUser); $currentUser->socialAccounts()->save($this->socialAccount); - session()->flash('success', title_case($socialDriver) . ' account was successfully attached to your profile.'); + session()->flash('success', trans('settings.users_social_connected', ['socialAccount' => title_case($socialDriver)])); return redirect($currentUser->getEditUrl()); } // When a user is logged in and the social account exists and is already linked to the current user. if ($isLoggedIn && $socialAccount !== null && $socialAccount->user->id === $currentUser->id) { - session()->flash('error', 'This ' . title_case($socialDriver) . ' account is already attached to your profile.'); + session()->flash('error', trans('errors.social_account_existing', ['socialAccount' => title_case($socialDriver)])); return redirect($currentUser->getEditUrl()); } // When a user is logged in, A social account exists but the users do not match. - // Change the user that the social account is assigned to. if ($isLoggedIn && $socialAccount !== null && $socialAccount->user->id != $currentUser->id) { - session()->flash('success', 'This ' . title_case($socialDriver) . ' account is already used by another user.'); + session()->flash('error', trans('errors.social_account_already_used_existing', ['socialAccount' => title_case($socialDriver)])); return redirect($currentUser->getEditUrl()); } // Otherwise let the user know this social account is not used by anyone. - $message = 'This ' . $socialDriver . ' account is not linked to any users. Please attach it in your profile settings'; + $message = trans('errors.social_account_not_used', ['socialAccount' => title_case($socialDriver)]); if (setting('registration-enabled')) { - $message .= ' or, If you do not yet have an account, You can register an account using the ' . $socialDriver . ' option'; + $message .= trans('errors.social_account_register_instructions', ['socialAccount' => title_case($socialDriver)]); } throw new SocialSignInException($message . '.', '/login'); @@ -157,8 +156,8 @@ class SocialAuthService { $driver = trim(strtolower($socialDriver)); - if (!in_array($driver, $this->validSocialDrivers)) abort(404, 'Social Driver Not Found'); - if (!$this->checkDriverConfigured($driver)) throw new SocialDriverNotConfigured("Your {$driver} social settings are not configured correctly."); + if (!in_array($driver, $this->validSocialDrivers)) abort(404, trans('errors.social_driver_not_found')); + if (!$this->checkDriverConfigured($driver)) throw new SocialDriverNotConfigured(trans('errors.social_driver_not_configured', ['socialAccount' => title_case($socialDriver)])); return $driver; } @@ -215,7 +214,7 @@ class SocialAuthService { session(); user()->socialAccounts()->where('driver', '=', $socialDriver)->delete(); - session()->flash('success', title_case($socialDriver) . ' account successfully detached'); + session()->flash('success', trans('settings.users_social_disconnected', ['socialAccount' => title_case($socialDriver)])); return redirect(user()->getEditUrl()); } diff --git a/resources/assets/js/controllers.js b/resources/assets/js/controllers.js index 9d7f7ad70..1b5bef797 100644 --- a/resources/assets/js/controllers.js +++ b/resources/assets/js/controllers.js @@ -505,20 +505,6 @@ export default function (ngApp, events) { } }; - /** - * Save the tags to the current page. - */ - $scope.saveTags = function() { - setTagOrder(); - let postData = {tags: $scope.tags}; - let url = window.baseUrl('/ajax/tags/update/page/' + pageId); - $http.post(url, postData).then((responseData) => { - $scope.tags = responseData.data.tags; - addEmptyTag(); - events.emit('success', responseData.data.message); - }) - }; - /** * Remove a tag from the current list. * @param tag diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php index 3762905b9..b734828fc 100644 --- a/resources/lang/en/auth.php +++ b/resources/lang/en/auth.php @@ -36,6 +36,10 @@ return [ 'register_thanks' => 'Thanks for registering!', 'register_confirm' => 'Please check your email and click the confirmation button to access :appName.', + 'registrations_disabled' => 'Registrations are currently disabled', + 'registration_email_domain_invalid' => 'That email domain does not have access to this application', + 'register_success' => 'Thanks for signing up! You are now registered and signed in.', + /** * Password Reset @@ -43,11 +47,14 @@ return [ 'reset_password' => 'Reset Password', 'reset_password_send_instructions' => 'Enter your email below and you will be sent an email with a password reset link.', 'reset_password_send_button' => 'Send Reset Link', + 'reset_password_sent_success' => 'A password reset link has been sent to :email.', + 'reset_password_success' => 'Your password has been successfully reset.', 'email_reset_subject' => 'Reset your :appName password', 'email_reset_text' => 'You are receiving this email because we received a password reset request for your account.', 'email_reset_not_requested' => 'If you did not request a password reset, no further action is required.', + /** * Email Confirmation */ diff --git a/resources/lang/en/common.php b/resources/lang/en/common.php index e6648fbcd..674ed32dc 100644 --- a/resources/lang/en/common.php +++ b/resources/lang/en/common.php @@ -26,6 +26,8 @@ return [ 'create' => 'Create', 'update' => 'Update', 'edit' => 'Edit', + 'sort' => 'Sort', + 'move' => 'Move', 'delete' => 'Delete', 'search' => 'Search', 'search_clear' => 'Clear Search', diff --git a/resources/lang/en/components.php b/resources/lang/en/components.php index 2b4796179..9fe277059 100644 --- a/resources/lang/en/components.php +++ b/resources/lang/en/components.php @@ -14,5 +14,6 @@ return [ 'imagem_load_more' => 'Load More', 'imagem_image_name' => 'Image Name', 'imagem_delete_confirm' => 'This image is used in the pages below, Click delete again to confirm you want to delete this image.', - 'imagem_select_image' => 'Select Image' + 'imagem_select_image' => 'Select Image', + 'images_deleted' => 'Images Deleted', ]; \ No newline at end of file diff --git a/resources/lang/en/entities.php b/resources/lang/en/entities.php index b2fb23d0e..855cea20c 100644 --- a/resources/lang/en/entities.php +++ b/resources/lang/en/entities.php @@ -13,10 +13,6 @@ return [ 'recently_viewed' => 'Recently Viewed', 'recent_activity' => 'Recent Activity', 'create_now' => 'Create one now', - 'edit' => 'Edit', - 'sort' => 'Sort', - 'move' => 'Move', - 'delete' => 'Delete', 'revisions' => 'Revisions', 'meta_created' => 'Created :timeLength', 'meta_created_name' => 'Created :timeLength by :user', @@ -43,11 +39,18 @@ return [ * Search */ 'search_results' => 'Search Results', + 'search_results_page' => 'Page Search Results', + 'search_results_chapter' => 'Chapter Search Results', + 'search_results_book' => 'Book Search Results', 'search_clear' => 'Clear Search', 'search_view_pages' => 'View all matches pages', 'search_view_chapters' => 'View all matches chapters', 'search_view_books' => 'View all matches books', 'search_no_pages' => 'No pages matched this search', + 'search_for_term' => 'Search for :term', + 'search_page_for_term' => 'Page search for :term', + 'search_chapter_for_term' => 'Chapter search for :term', + 'search_book_for_term' => 'Books search for :term', /** * Books @@ -60,12 +63,15 @@ return [ 'books_popular_empty' => 'The most popular books will appear here.', 'books_create' => 'Create New Book', 'books_delete' => 'Delete Book', + 'books_delete_named' => 'Delete Book :bookName', 'books_delete_explain' => 'This will delete the book with the name \':bookName\', All pages and chapters will be removed.', 'books_delete_confirmation' => 'Are you sure you want to delete this book?', 'books_edit' => 'Edit Book', + 'books_edit_named' => 'Edit Book :bookName', 'books_form_book_name' => 'Book Name', 'books_save' => 'Save Book', 'books_permissions' => 'Book Permissions', + 'books_permissions_updated' => 'Book Permissions Updated', 'books_empty_contents' => 'No pages or chapters have been created for this book.', 'books_empty_create_page' => 'Create a new page', 'books_empty_or' => 'or', @@ -75,6 +81,7 @@ return [ 'books_search_this' => 'Search this book', 'books_navigation' => 'Book Navigation', 'books_sort' => 'Sort Book Contents', + 'books_sort_named' => 'Sort Book :bookName', 'books_sort_show_other' => 'Show Other Books', 'books_sort_save' => 'Save New Order', @@ -86,15 +93,20 @@ return [ 'chapters_new' => 'New Chapter', 'chapters_create' => 'Create New Chapter', 'chapters_delete' => 'Delete Chapter', + 'chapters_delete_named' => 'Delete Chapter :chapterName', 'chapters_delete_explain' => 'This will delete the chapter with the name \':chapterName\', All pages will be removed and added directly to the parent book.', 'chapters_delete_confirm' => 'Are you sure you want to delete this chapter?', 'chapters_edit' => 'Edit Chapter', + 'chapters_edit_named' => 'Edit Chapter :chapterName', 'chapters_save' => 'Save Chapter', 'chapters_move' => 'Move Chapter', + 'chapters_move_named' => 'Move Chapter :chapterName', + 'chapter_move_success' => 'Chapter moved to :bookName', 'chapters_permissions' => 'Chapter Permissions', 'chapters_empty' => 'No pages are currently in this chapter.', 'chapters_permissions_active' => 'Chapter Permissions Active', + 'chapters_permissions_success' => 'Chapter Permissions Updated', /** * Pages @@ -106,11 +118,18 @@ return [ 'pages_attachments' => 'Attachments', 'pages_navigation' => 'Page Navigation', 'pages_delete' => 'Delete Page', + 'pages_delete_named' => 'Delete Page :pageName', + 'pages_delete_draft_named' => 'Delete Draft Page :pageName', 'pages_delete_draft' => 'Delete Draft Page', + 'pages_delete_success' => 'Page deleted', + 'pages_delete_draft_success' => 'Draft page deleted', 'pages_delete_confirm' => 'Are you sure you want to delete this page?', 'pages_delete_draft_confirm' => 'Are you sure you want to delete this draft page?', + 'pages_editing_named' => 'Editing Page :pageName', 'pages_edit_toggle_header' => 'Toggle header', 'pages_edit_save_draft' => 'Save Draft', + 'pages_edit_draft' => 'Edit Page Draft', + 'pages_edit_draft_save_at' => 'Draft saved at ', 'pages_edit_delete_draft' => 'Delete Draft', 'pages_edit_discard_draft' => 'Discard Draft', 'pages_edit_set_changelog' => 'Set Changelog', @@ -125,8 +144,12 @@ return [ 'pages_md_insert_link' => 'Insert Entity Link', 'pages_not_in_chapter' => 'Page is not in a chapter', 'pages_move' => 'Move Page', + 'pages_move_success' => 'Page moved to ":parentName"', 'pages_permissions' => 'Page Permissions', + 'pages_permissions_success' => 'Page permissions updated', 'pages_revisions' => 'Page Revisions', + 'pages_revisions_named' => 'Page Revisions for :pageName', + 'pages_revision_named' => 'Page Revision for :pageName', 'pages_revisions_created_by' => 'Created By', 'pages_revisions_date' => 'Revision Date', 'pages_revisions_changelog' => 'Changelog', @@ -141,12 +164,24 @@ return [ 'pages_export_text' => 'Plain Text File', 'pages_copy_link' => 'Copy Link', 'pages_permissions_active' => 'Page Permissions Active', + 'pages_initial_revision' => 'Initial publish', + 'pages_initial_name' => 'New Page', + 'pages_editing_draft_notification' => 'You are currently editing a draft that was last saved :timeDiff.', + 'pages_draft_edited_notification' => 'This page has been updated by since that time. It is recommended that you discard this draft.', + 'pages_draft_edit_active' => [ + 'start_a' => ':count users have started editing this page', + 'start_b' => ':userName has started editing this page', + 'time_a' => 'since the pages was last updated', + 'time_b' => 'in the last :minCount minutes', + 'message' => ':start :time. Take care not to overwrite each other\'s updates!', + ], /** * Editor sidebar */ 'page_tags' => 'Page Tags', 'tag' => 'Tag', + 'tags' => '', 'tag_value' => 'Tag Value (Optional)', 'tags_explain' => "Add some tags to better categorise your content. \n You can assign a value to a tag for more in-depth organisation.", 'tags_add' => 'Add another tag', @@ -168,6 +203,8 @@ return [ 'attachments_edit_file' => 'Edit File', 'attachments_edit_file_name' => 'File Name', 'attachments_edit_drop_upload' => 'Drop files or click here to upload and overwrite', + 'attachments_order_updated' => 'Attachment order updated', + 'attachments_deleted' => 'Attachment deleted', /** * Profile View diff --git a/resources/lang/en/errors.php b/resources/lang/en/errors.php index 32655c75a..d36f39932 100644 --- a/resources/lang/en/errors.php +++ b/resources/lang/en/errors.php @@ -10,8 +10,53 @@ return [ 'permission' => 'You do not have permission to access the requested page.', 'permissionJson' => 'You do not have permission to perform the requested action.', + // Auth + 'error_user_exists_different_creds' => 'A user with the email :email already exists but with different credentials.', + 'email_already_confirmed' => 'Email has already been confirmed, Try logging in.', + 'email_confirmation_invalid' => 'This confirmation token is not valid or has already been used, Please try registering again.', + 'email_confirmation_expired' => 'The confirmation token has expired, A new confirmation email has been sent.', + 'ldap_fail_anonymous' => 'LDAP access failed using anonymous bind', + 'ldap_fail_authed' => 'LDAP access failed using given dn & password details', + 'ldap_extension_not_installed' => 'LDAP PHP extension not installed', + 'ldap_cannot_connect' => 'Cannot connect to ldap server, Initial connection failed', + 'social_no_action_defined' => 'No action defined', + 'social_account_in_use' => 'This :socialAccount account is already in use, Try logging in via the :socialAccount option.', + 'social_account_email_in_use' => 'The email :email is already in use. If you already have an account you can connect your :socialAccount account from your profile settings.', + 'social_account_existing' => 'This :socialAccount is already attached to your profile.', + 'social_account_already_used_existing' => 'This :socialAccount account is already used by another user.', + 'social_account_not_used' => 'This :socialAccount account is not linked to any users. Please attach it in your profile settings. ', + 'social_account_register_instructions' => 'If you do not yet have an account, You can register an account using the :socialAccount option.', + 'social_driver_not_found' => 'Social driver not found', + 'social_driver_not_configured' => 'Your :socialAccount social settings are not configured correctly.', + + // System + 'path_not_writable' => 'File path :filePath could not be uploaded to. Ensure it is writable to the server.', + 'cannot_get_image_from_url' => 'Cannot get image from :url', + 'cannot_create_thumbs' => 'The server cannot create thumbnails. Please check you have the GD PHP extension installed.', + + // Attachments + 'attachment_page_mismatch' => 'Page mismatch during attachment update', + + // Entities + 'entity_not_found' => 'Entity not found', + 'book_not_found' => 'Book not found', + 'page_not_found' => 'Page not found', + 'chapter_not_found' => 'Chapter not found', + 'selected_book_not_found' => 'The selected book was not found', + 'selected_book_chapter_not_found' => 'The selected Book or Chapter was not found', + 'guests_cannot_save_drafts' => 'Guests cannot save drafts', + + // Users + 'users_cannot_delete_only_admin' => 'You cannot delete the only admin', + 'users_cannot_delete_guest' => 'You cannot delete the guest user', + + // Roles + 'role_cannot_be_edited' => 'This role cannot be edited', + 'role_system_cannot_be_deleted' => 'This role is a system role and cannot be deleted', + 'role_registration_default_cannot_delete' => 'This role cannot be deleted while set as the default registration role', + // Error pages - 'page_not_found' => 'Page Not Found', + '404_page_not_found' => 'Page Not Found', 'sorry_page_not_found' => 'Sorry, The page you were looking for could not be found.', 'return_home' => 'Return to home', 'error_occurred' => 'An Error Occurred', diff --git a/resources/lang/en/settings.php b/resources/lang/en/settings.php index dcbfe6dde..e61df19d9 100644 --- a/resources/lang/en/settings.php +++ b/resources/lang/en/settings.php @@ -10,6 +10,7 @@ return [ 'settings' => 'Settings', 'settings_save' => 'Save Settings', + 'settings_save_success' => 'Settings saved', /** * App settings @@ -51,10 +52,13 @@ return [ 'roles' => 'Roles', 'role_user_roles' => 'User Roles', 'role_create' => 'Create New Role', + 'role_create_success' => 'Role successfully created', 'role_delete' => 'Delete Role', 'role_delete_confirm' => 'This will delete the role with the name \':roleName\'.', 'role_delete_users_assigned' => 'This role has :userCount users assigned to it. If you would like to migrate the users from this role select a new role below.', + 'role_delete_no_migration' => "Don't migrate users", 'role_delete_sure' => 'Are you sure you want to delete this role?', + 'role_delete_success' => 'Role successfully deleted', 'role_edit' => 'Edit Role', 'role_details' => 'Role Details', 'role_name' => 'Role Name', @@ -71,6 +75,7 @@ return [ 'role_own' => 'Own', 'role_controlled_by_asset' => 'Controlled by the asset they are uploaded to', 'role_save' => 'Save Role', + 'role_update_success' => 'Role successfully updated', 'role_users' => 'Users in this role', 'role_users_none' => 'No users are currently assigned to this role', @@ -79,6 +84,7 @@ return [ */ 'users' => 'Users', + 'user_profile' => 'User Profile', 'users_add_new' => 'Add New User', 'users_search' => 'Search Users', 'users_role' => 'User Roles', @@ -86,16 +92,21 @@ return [ 'users_password_warning' => 'Only fill the below if you would like to change your password:', 'users_system_public' => 'This user represents any guest users that visit your instance. It cannot be used to log in but is assigned automatically.', 'users_delete' => 'Delete User', + 'users_delete_named' => 'Delete ser :userName', 'users_delete_warning' => 'This will fully delete this user with the name \':userName\' from the system.', 'users_delete_confirm' => 'Are you sure you want to delete this user?', + 'users_delete_success' => 'Users successfully removed', 'users_edit' => 'Edit User', 'users_edit_profile' => 'Edit Profile', + 'users_edit_success' => 'User successfully updated', 'users_avatar' => 'User Avatar', 'users_avatar_desc' => 'This image should be approx 256px square.', 'users_social_accounts' => 'Social Accounts', 'users_social_accounts_info' => 'Here you can connect your other accounts for quicker and easier login. Disconnecting an account here does not previously authorized access. Revoke access from your profile settings on the connected social account.', 'users_social_connect' => 'Connect Account', 'users_social_disconnect' => 'Disconnect Account', + 'users_social_connected' => ':socialAccount account was successfully attached to your profile.', + 'users_social_disconnected' => ':socialAccount account was successfully disconnected from your profile.', ]; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 20acc9a68..b75af7485 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -87,8 +87,8 @@ return [ */ 'custom' => [ - 'attribute-name' => [ - 'rule-name' => 'custom-message', + 'password-confirm' => [ + 'required_with' => 'Password confirmation required', ], ], diff --git a/resources/views/books/show.blade.php b/resources/views/books/show.blade.php index 2d1c21cdd..6a18302bc 100644 --- a/resources/views/books/show.blade.php +++ b/resources/views/books/show.blade.php @@ -17,20 +17,20 @@ {{ trans('entities.chapters_new') }} @endif @if(userCan('book-update', $book)) - {{ trans('entities.edit') }} + {{ trans('common.edit') }} @endif @if(userCan('book-update', $book) || userCan('restrictions-manage', $book) || userCan('book-delete', $book))
{{ trans('errors.sorry_page_not_found') }}
{{ trans('errors.return_home') }}
diff --git a/resources/views/pages/show.blade.php b/resources/views/pages/show.blade.php index ced311f94..e54dacb42 100644 --- a/resources/views/pages/show.blade.php +++ b/resources/views/pages/show.blade.php @@ -19,21 +19,21 @@ @if(userCan('page-update', $page)) - {{ trans('entities.edit') }} + {{ trans('common.edit') }} @endif @if(userCan('page-update', $page) || userCan('restrictions-manage', $page) || userCan('page-delete', $page))