From 468eba80bdd4d8931280a229f7db3e4a162c058a Mon Sep 17 00:00:00 2001
From: lalka2018 <99399973+lalka2016@users.noreply.github.com>
Date: Sun, 17 Sep 2023 16:22:59 +0300
Subject: [PATCH] Locales: Make more strings translatable (#961)
---
Web/Models/Entities/Club.php | 6 +-
Web/Presenters/AdminPresenter.php | 8 +-
Web/Presenters/CommentPresenter.php | 18 +-
Web/Presenters/GiftsPresenter.php | 10 +-
Web/Presenters/GroupPresenter.php | 30 +--
Web/Presenters/NotesPresenter.php | 6 +-
Web/Presenters/PhotosPresenter.php | 28 +--
Web/Presenters/ReportPresenter.php | 12 +-
Web/Presenters/TopicsPresenter.php | 4 +-
Web/Presenters/UserPresenter.php | 10 +-
Web/Presenters/VideosPresenter.php | 16 +-
Web/Presenters/WallPresenter.php | 2 +-
Web/Presenters/templates/@layout.xml | 5 +-
Web/Presenters/templates/About/BB.xml | 8 +-
Web/Presenters/templates/About/Help.xml | 2 +-
Web/Presenters/templates/About/Sandbox.xml | 2 +-
.../templates/Admin/BansHistory.xml | 18 +-
Web/Presenters/templates/Admin/Logs.xml | 36 +--
Web/Presenters/templates/Apps/Play.xml | 14 +-
Web/Presenters/templates/Away/View.xml | 4 +-
Web/Presenters/templates/Group/Followers.xml | 4 +-
Web/Presenters/templates/Group/Statistics.xml | 8 +-
Web/Presenters/templates/Group/View.xml | 16 +-
Web/Presenters/templates/NoSpam/Index.xml | 50 ++--
Web/Presenters/templates/NoSpam/Tabs.xml | 6 +-
Web/Presenters/templates/NoSpam/Templates.xml | 20 +-
Web/Presenters/templates/Notes/Create.xml | 2 +-
Web/Presenters/templates/Notes/Edit.xml | 2 +-
Web/Presenters/templates/Photos/Album.xml | 5 +-
Web/Presenters/templates/Photos/AlbumList.xml | 2 +-
Web/Presenters/templates/Photos/EditAlbum.xml | 2 +-
Web/Presenters/templates/Photos/EditPhoto.xml | 2 +-
Web/Presenters/templates/Photos/Photo.xml | 13 +-
.../templates/Photos/UnlinkPhoto.xml | 10 +-
Web/Presenters/templates/User/Edit.xml | 4 +-
Web/Presenters/templates/User/Settings.xml | 8 +-
Web/Presenters/templates/User/VerifyPhone.xml | 6 +-
Web/Presenters/templates/User/View.xml | 16 +-
Web/Presenters/templates/User/banned.xml | 6 +-
Web/Presenters/templates/Videos/Edit.xml | 6 +-
Web/Presenters/templates/Videos/View.xml | 14 +-
Web/Presenters/templates/Wall/Post.xml | 12 +-
.../templates/components/comment.xml | 14 +-
.../components/notifications/9601/_20_18_.xml | 2 +-
.../components/post/microblogpost.xml | 2 +-
.../templates/components/post/oldpost.xml | 2 +-
locales/en.strings | 228 ++++++++++++++++++
locales/ru.strings | 226 +++++++++++++++++
48 files changed, 688 insertions(+), 239 deletions(-)
diff --git a/Web/Models/Entities/Club.php b/Web/Models/Entities/Club.php
index 31485129..fbdc503b 100644
--- a/Web/Models/Entities/Club.php
+++ b/Web/Models/Entities/Club.php
@@ -224,7 +224,7 @@ class Club extends RowModel
"shape" => "spline",
"color" => "#597da3",
],
- "name" => $unique ? "Полный охват" : "Все просмотры",
+ "name" => $unique ? tr("full_coverage") : tr("all_views"),
],
"subs" => [
"x" => array_reverse(range(1, 7)),
@@ -235,7 +235,7 @@ class Club extends RowModel
"color" => "#b05c91",
],
"fill" => "tozeroy",
- "name" => $unique ? "Охват подписчиков" : "Просмотры подписчиков",
+ "name" => $unique ? tr("subs_coverage") : tr("subs_views"),
],
"viral" => [
"x" => array_reverse(range(1, 7)),
@@ -246,7 +246,7 @@ class Club extends RowModel
"color" => "#4d9fab",
],
"fill" => "tozeroy",
- "name" => $unique ? "Виральный охват" : "Виральные просмотры",
+ "name" => $unique ? tr("viral_coverage") : tr("viral_views"),
],
];
}
diff --git a/Web/Presenters/AdminPresenter.php b/Web/Presenters/AdminPresenter.php
index 37fb50e8..14fbbc74 100644
--- a/Web/Presenters/AdminPresenter.php
+++ b/Web/Presenters/AdminPresenter.php
@@ -283,7 +283,7 @@ final class AdminPresenter extends OpenVKPresenter
$this->notFound();
$gift->delete();
- $this->flashFail("succ", "Gift moved successfully", "This gift will now be in Recycle Bin.");
+ $this->flashFail("succ", tr("admin_gift_moved_successfully"), tr("admin_gift_moved_to_recycle"));
break;
case "copy":
case "move":
@@ -302,7 +302,7 @@ final class AdminPresenter extends OpenVKPresenter
$catTo->addGift($gift);
$name = $catTo->getName();
- $this->flash("succ", "Gift moved successfully", "This gift will now be in $name.");
+ $this->flash("succ", tr("admin_gift_moved_successfully"), "This gift will now be in $name.");
$this->redirect("/admin/gifts/" . $catTo->getSlug() . "." . $catTo->getId() . "/");
break;
default:
@@ -333,10 +333,10 @@ final class AdminPresenter extends OpenVKPresenter
$gift->setUsages((int) $this->postParam("usages"));
if(isset($_FILES["pic"]) && $_FILES["pic"]["error"] === UPLOAD_ERR_OK) {
if(!$gift->setImage($_FILES["pic"]["tmp_name"]))
- $this->flashFail("err", "Не удалось сохранить подарок", "Изображение подарка кривое.");
+ $this->flashFail("err", tr("error_when_saving_gift"), tr("error_when_saving_gift_bad_image"));
} else if($gen) {
# If there's no gift pic but it's newly created
- $this->flashFail("err", "Не удалось сохранить подарок", "Пожалуйста, загрузите изображение подарка.");
+ $this->flashFail("err", tr("error_when_saving_gift"), tr("error_when_saving_gift_no_image"));
}
$gift->save();
diff --git a/Web/Presenters/CommentPresenter.php b/Web/Presenters/CommentPresenter.php
index cb0efd0d..29c54c78 100644
--- a/Web/Presenters/CommentPresenter.php
+++ b/Web/Presenters/CommentPresenter.php
@@ -55,7 +55,7 @@ final class CommentPresenter extends OpenVKPresenter
$this->flashFail("err", tr("error"), tr("forbidden"));
if($_FILES["_vid_attachment"] && OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading'])
- $this->flashFail("err", tr("error"), "Video uploads are disabled by the system administrator.");
+ $this->flashFail("err", tr("error"), tr("video_uploads_disabled"));
$flags = 0;
if($this->postParam("as_group") === "on" && !is_null($club) && $club->canBeModifiedBy($this->user->identity))
@@ -66,7 +66,7 @@ final class CommentPresenter extends OpenVKPresenter
try {
$photo = Photo::fastMake($this->user->id, $this->postParam("text"), $_FILES["_pic_attachment"]);
} catch(ISE $ex) {
- $this->flashFail("err", "Не удалось опубликовать пост", "Файл изображения повреждён, слишком велик или одна сторона изображения в разы больше другой.");
+ $this->flashFail("err", tr("error_when_publishing_comment"), tr("error_when_publishing_comment_description"));
}
}
@@ -86,11 +86,11 @@ final class CommentPresenter extends OpenVKPresenter
$video = Video::fastMake($this->user->id, $_FILES["_vid_attachment"]["name"], $this->postParam("text"), $_FILES["_vid_attachment"]);
}
} catch(ISE $ex) {
- $this->flashFail("err", "Не удалось опубликовать комментарий", "Файл медиаконтента повреждён или слишком велик.");
+ $this->flashFail("err", tr("error_when_publishing_comment"), tr("error_comment_file_too_big"));
}
if(empty($this->postParam("text")) && !$photo && !$video)
- $this->flashFail("err", "Не удалось опубликовать комментарий", "Комментарий пустой или слишком большой.");
+ $this->flashFail("err", tr("error_when_publishing_comment"), tr("error_comment_empty"));
try {
$comment = new Comment;
@@ -102,7 +102,7 @@ final class CommentPresenter extends OpenVKPresenter
$comment->setFlags($flags);
$comment->save();
} catch (\LengthException $ex) {
- $this->flashFail("err", "Не удалось опубликовать комментарий", "Комментарий слишком большой.");
+ $this->flashFail("err", tr("error_when_publishing_comment"), tr("error_comment_too_big"));
}
if(!is_null($photo))
@@ -124,7 +124,7 @@ final class CommentPresenter extends OpenVKPresenter
if($mentionee instanceof User)
(new MentionNotification($mentionee, $entity, $comment->getOwner(), strip_tags($comment->getText())))->emit();
- $this->flashFail("succ", "Комментарий добавлен", "Ваш комментарий появится на странице.");
+ $this->flashFail("succ", tr("comment_is_added"), tr("comment_is_added_desc"));
}
function renderDeleteComment(int $id): void
@@ -135,15 +135,15 @@ final class CommentPresenter extends OpenVKPresenter
$comment = (new Comments)->get($id);
if(!$comment) $this->notFound();
if(!$comment->canBeDeletedBy($this->user->identity))
- $this->throwError(403, "Forbidden", "У вас недостаточно прав чтобы редактировать этот ресурс.");
+ $this->throwError(403, "Forbidden", tr("error_access_denied"));
if ($comment->getTarget() instanceof Post && $comment->getTarget()->getWallOwner()->isBanned())
$this->flashFail("err", tr("error"), tr("forbidden"));
$comment->delete();
$this->flashFail(
"succ",
- "Успешно",
- "Этот комментарий больше не будет показыватся.
Отметить как спам?"
+ tr("success"),
+ tr("comment_will_not_appear")
);
}
}
diff --git a/Web/Presenters/GiftsPresenter.php b/Web/Presenters/GiftsPresenter.php
index 8f59bdcb..71480540 100644
--- a/Web/Presenters/GiftsPresenter.php
+++ b/Web/Presenters/GiftsPresenter.php
@@ -49,7 +49,7 @@ final class GiftsPresenter extends OpenVKPresenter
$user = $this->users->get((int) ($this->queryParam("user") ?? 0));
$cat = $this->gifts->getCat((int) ($this->queryParam("pack") ?? 0));
if(!$user || !$cat)
- $this->flashFail("err", "Не удалось подарить", "Пользователь или набор не существуют.");
+ $this->flashFail("err", tr("error_when_gifting"), tr("error_user_not_exists"));
$this->template->page = $page = (int) ($this->queryParam("p") ?? 1);
$gifts = $cat->getGifts($page, null, $this->template->count);
@@ -66,14 +66,14 @@ final class GiftsPresenter extends OpenVKPresenter
$gift = $this->gifts->get((int) ($this->queryParam("elid") ?? 0));
$cat = $this->gifts->getCat((int) ($this->queryParam("pack") ?? 0));
if(!$user || !$cat || !$gift || !$cat->hasGift($gift))
- $this->flashFail("err", "Не удалось подарить", "Не удалось подтвердить права на подарок.");
+ $this->flashFail("err", tr("error_when_gifting"), tr("error_no_rights_gifts"));
if(!$gift->canUse($this->user->identity))
- $this->flashFail("err", "Не удалось подарить", "У вас больше не осталось таких подарков.");
+ $this->flashFail("err", tr("error_when_gifting"), tr("error_no_more_gifts"));
$coinsLeft = $this->user->identity->getCoins() - $gift->getPrice();
if($coinsLeft < 0)
- $this->flashFail("err", "Не удалось подарить", "Ору нищ не пук.");
+ $this->flashFail("err", tr("error_when_gifting"), tr("error_no_money"));
$this->template->_template = "Gifts/Confirm.xml";
if($_SERVER["REQUEST_METHOD"] !== "POST") {
@@ -91,7 +91,7 @@ final class GiftsPresenter extends OpenVKPresenter
$user->gift($this->user->identity, $gift, $comment, !is_null($this->postParam("anonymous")));
$gift->used();
- $this->flash("succ", "Подарок отправлен", "Вы отправили подарок " . $user->getFirstName() . " за " . $gift->getPrice() . " голосов.");
+ $this->flash("succ", tr("gift_sent"), tr("gift_sent_desc", $user->getFirstName(), $gift->getPrice()));
$this->redirect($user->getURL());
}
diff --git a/Web/Presenters/GroupPresenter.php b/Web/Presenters/GroupPresenter.php
index d8fbcb79..d3a46fd5 100644
--- a/Web/Presenters/GroupPresenter.php
+++ b/Web/Presenters/GroupPresenter.php
@@ -54,7 +54,7 @@ final class GroupPresenter extends OpenVKPresenter
$club->save();
} catch(\PDOException $ex) {
if($ex->getCode() == 23000)
- $this->flashFail("err", "Ошибка", "Произошла ошибка на стороне сервера. Обратитесь к системному администратору.");
+ $this->flashFail("err", tr("error"), tr("error_on_server_side"));
else
throw $ex;
}
@@ -62,7 +62,7 @@ final class GroupPresenter extends OpenVKPresenter
$club->toggleSubscription($this->user->identity);
$this->redirect("/club" . $club->getId());
}else{
- $this->flashFail("err", "Ошибка", "Вы не ввели название группы.");
+ $this->flashFail("err", tr("error"), tr("error_no_group_name"));
}
}
}
@@ -132,7 +132,7 @@ final class GroupPresenter extends OpenVKPresenter
$this->notFound();
if(!$club->canBeModifiedBy($this->user->identity ?? NULL))
- $this->flashFail("err", "Ошибка доступа", "У вас недостаточно прав, чтобы изменять этот ресурс.");
+ $this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"));
if(!is_null($hidden)) {
if($club->getOwner()->getId() == $user->getId()) {
@@ -150,9 +150,9 @@ final class GroupPresenter extends OpenVKPresenter
}
if($hidden) {
- $this->flashFail("succ", "Операция успешна", "Теперь " . $user->getCanonicalName() . " будет показываться как обычный подписчик всем кроме других администраторов");
+ $this->flashFail("succ", tr("success_action"), tr("x_is_now_hidden", $user->getCanonicalName()));
} else {
- $this->flashFail("succ", "Операция успешна", "Теперь все будут знать про то что " . $user->getCanonicalName() . " - администратор");
+ $this->flashFail("succ", tr("success_action"), tr("x_is_now_showed", $user->getCanonicalName()));
}
} elseif($removeComment) {
if($club->getOwner()->getId() == $user->getId()) {
@@ -164,11 +164,11 @@ final class GroupPresenter extends OpenVKPresenter
$manager->save();
}
- $this->flashFail("succ", "Операция успешна", "Комментарий к администратору удален");
+ $this->flashFail("succ", tr("success_action"), tr("comment_is_deleted"));
} elseif($comment) {
if(mb_strlen($comment) > 36) {
$commentLength = (string) mb_strlen($comment);
- $this->flashFail("err", "Ошибка", "Комментарий слишком длинный ($commentLength символов вместо 36 символов)");
+ $this->flashFail("err", tr("error"), tr("comment_is_too_long", $commentLength));
}
if($club->getOwner()->getId() == $user->getId()) {
@@ -180,16 +180,16 @@ final class GroupPresenter extends OpenVKPresenter
$manager->save();
}
- $this->flashFail("succ", "Операция успешна", "Комментарий к администратору изменён");
+ $this->flashFail("succ", tr("success_action"), tr("comment_is_changed"));
}else{
if($club->canBeModifiedBy($user)) {
$club->removeManager($user);
- $this->flashFail("succ", "Операция успешна", $user->getCanonicalName() . " более не администратор.");
+ $this->flashFail("succ", tr("success_action"), tr("x_no_more_admin", $user->getCanonicalName()));
} else {
$club->addManager($user);
(new ClubModeratorNotification($user, $club, $this->user->identity))->emit();
- $this->flashFail("succ", "Операция успешна", $user->getCanonicalName() . " назначен(а) администратором.");
+ $this->flashFail("succ", tr("success_action"), tr("x_is_admin", $user->getCanonicalName()));
}
}
@@ -245,7 +245,7 @@ final class GroupPresenter extends OpenVKPresenter
(new Albums)->getClubAvatarAlbum($club)->addPhoto($photo);
} catch(ISE $ex) {
$name = $album->getName();
- $this->flashFail("err", "Неизвестная ошибка", "Не удалось сохранить фотографию.");
+ $this->flashFail("err", tr("error"), tr("error_when_uploading_photo"));
}
}
@@ -253,12 +253,12 @@ final class GroupPresenter extends OpenVKPresenter
$club->save();
} catch(\PDOException $ex) {
if($ex->getCode() == 23000)
- $this->flashFail("err", "Ошибка", "Произошла ошибка на стороне сервера. Обратитесь к системному администратору.");
+ $this->flashFail("err", tr("error"), tr("error_on_server_side"));
else
throw $ex;
}
- $this->flash("succ", "Изменения сохранены", "Новые данные появятся в вашей группе.");
+ $this->flash("succ", tr("changes_saved"), tr("new_changes_desc"));
}
}
@@ -298,7 +298,7 @@ final class GroupPresenter extends OpenVKPresenter
} catch(ISE $ex) {
$name = $album->getName();
- $this->flashFail("err", "Неизвестная ошибка", "Не удалось сохранить фотографию.");
+ $this->flashFail("err", tr("error"), tr("error_when_uploading_photo"));
}
}
$this->returnJson([
@@ -350,7 +350,7 @@ final class GroupPresenter extends OpenVKPresenter
$this->assertUserLoggedIn();
if(!eventdb())
- $this->flashFail("err", "Ошибка подключения", "Не удалось подключится к службе телеметрии.");
+ $this->flashFail("err", tr("connection_error"), tr("connection_error_desc"));
$club = $this->clubs->get($id);
if(!$club->canBeModifiedBy($this->user->identity))
diff --git a/Web/Presenters/NotesPresenter.php b/Web/Presenters/NotesPresenter.php
index 50437ad7..4b71c8b1 100644
--- a/Web/Presenters/NotesPresenter.php
+++ b/Web/Presenters/NotesPresenter.php
@@ -107,7 +107,7 @@ final class NotesPresenter extends OpenVKPresenter
if(!$note || $note->getOwner()->getId() !== $owner || $note->isDeleted())
$this->notFound();
if(is_null($this->user) || !$note->canBeModifiedBy($this->user->identity))
- $this->flashFail("err", "Ошибка доступа", "Недостаточно прав для модификации данного ресурса.");
+ $this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"));
$this->template->note = $note;
if($_SERVER["REQUEST_METHOD"] === "POST") {
@@ -135,11 +135,11 @@ final class NotesPresenter extends OpenVKPresenter
if(!$note) $this->notFound();
if($note->getOwner()->getId() . "_" . $note->getId() !== $owner . "_" . $id || $note->isDeleted()) $this->notFound();
if(is_null($this->user) || !$note->canBeModifiedBy($this->user->identity))
- $this->flashFail("err", "Ошибка доступа", "Недостаточно прав для модификации данного ресурса.");
+ $this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"));
$name = $note->getName();
$note->delete();
- $this->flash("succ", "Заметка удалена", "Заметка \"$name\" была успешно удалена.");
+ $this->flash("succ", tr("note_is_deleted"), tr("note_x_is_now_deleted", $name));
$this->redirect("/notes" . $this->user->id);
}
}
diff --git a/Web/Presenters/PhotosPresenter.php b/Web/Presenters/PhotosPresenter.php
index 11026d00..bef984b7 100644
--- a/Web/Presenters/PhotosPresenter.php
+++ b/Web/Presenters/PhotosPresenter.php
@@ -94,7 +94,7 @@ final class PhotosPresenter extends OpenVKPresenter
if(!$album) $this->notFound();
if($album->getPrettyId() !== $owner . "_" . $id || $album->isDeleted()) $this->notFound();
if(is_null($this->user) || !$album->canBeModifiedBy($this->user->identity) || $album->isDeleted())
- $this->flashFail("err", "Ошибка доступа", "Недостаточно прав для модификации данного ресурса.");
+ $this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"));
$this->template->album = $album;
if($_SERVER["REQUEST_METHOD"] === "POST") {
@@ -106,7 +106,7 @@ final class PhotosPresenter extends OpenVKPresenter
$album->setEdited(time());
$album->save();
- $this->flash("succ", "Изменения сохранены", "Новые данные приняты.");
+ $this->flash("succ", tr("changes_saved"), tr("new_data_accepted"));
}
}
@@ -120,13 +120,13 @@ final class PhotosPresenter extends OpenVKPresenter
if(!$album) $this->notFound();
if($album->getPrettyId() !== $owner . "_" . $id || $album->isDeleted()) $this->notFound();
if(is_null($this->user) || !$album->canBeModifiedBy($this->user->identity))
- $this->flashFail("err", "Ошибка доступа", "Недостаточно прав для модификации данного ресурса.");
+ $this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"));
$name = $album->getName();
$owner = $album->getOwner();
$album->delete();
- $this->flash("succ", "Альбом удалён", "Альбом $name был успешно удалён.");
+ $this->flash("succ", tr("album_is_deleted"), tr("album_x_is_deleted", $name));
$this->redirect("/albums" . ($owner instanceof Club ? "-" : "") . $owner->getId());
}
@@ -205,13 +205,13 @@ final class PhotosPresenter extends OpenVKPresenter
$photo = $this->photos->getByOwnerAndVID($ownerId, $photoId);
if(!$photo) $this->notFound();
if(is_null($this->user) || $this->user->id != $ownerId)
- $this->flashFail("err", "Ошибка доступа", "Недостаточно прав для модификации данного ресурса.");
+ $this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"));
if($_SERVER["REQUEST_METHOD"] === "POST") {
$photo->setDescription(empty($this->postParam("desc")) ? NULL : $this->postParam("desc"));
$photo->save();
- $this->flash("succ", "Изменения сохранены", "Обновлённое описание появится на странице с фоткой.");
+ $this->flash("succ", tr("changes_saved"), tr("new_description_will_appear"));
$this->redirect("/photo" . $photo->getPrettyId());
}
@@ -224,14 +224,14 @@ final class PhotosPresenter extends OpenVKPresenter
$this->willExecuteWriteAction(true);
if(is_null($this->queryParam("album")))
- $this->flashFail("err", "Неизвестная ошибка", "Не удалось сохранить фотографию в DELETED.", 500, true);
+ $this->flashFail("err", tr("error"), tr("error_adding_to_deleted"), 500, true);
[$owner, $id] = explode("_", $this->queryParam("album"));
$album = $this->albums->get((int) $id);
if(!$album)
- $this->flashFail("err", "Неизвестная ошибка", "Не удалось сохранить фотографию в DELETED.", 500, true);
+ $this->flashFail("err", tr("error"), tr("error_adding_to_deleted"), 500, true);
if(is_null($this->user) || !$album->canBeModifiedBy($this->user->identity))
- $this->flashFail("err", "Ошибка доступа", "Недостаточно прав для модификации данного ресурса.", 500, true);
+ $this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"), 500, true);
if($_SERVER["REQUEST_METHOD"] === "POST") {
if($this->queryParam("act") == "finish") {
@@ -258,7 +258,7 @@ final class PhotosPresenter extends OpenVKPresenter
}
if(!isset($_FILES))
- $this->flashFail("err", "Нету фотографии", "Выберите файл.", 500, true);
+ $this->flashFail("err", tr("no_photo"), tr("select_file"), 500, true);
$photos = [];
for($i = 0; $i < $this->postParam("count"); $i++) {
@@ -304,7 +304,7 @@ final class PhotosPresenter extends OpenVKPresenter
if(!$album || !$photo) $this->notFound();
if(!$album->hasPhoto($photo)) $this->notFound();
if(is_null($this->user) || !$album->canBeModifiedBy($this->user->identity))
- $this->flashFail("err", "Ошибка доступа", "Недостаточно прав для модификации данного ресурса.");
+ $this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"));
if($_SERVER["REQUEST_METHOD"] === "POST") {
$this->assertNoCSRF();
@@ -312,7 +312,7 @@ final class PhotosPresenter extends OpenVKPresenter
$album->setEdited(time());
$album->save();
- $this->flash("succ", "Фотография удалена", "Эта фотография была успешно удалена.");
+ $this->flash("succ", tr("photo_is_deleted"), tr("photo_is_deleted_desc"));
$this->redirect("/album" . $album->getPrettyId());
}
}
@@ -326,7 +326,7 @@ final class PhotosPresenter extends OpenVKPresenter
$photo = $this->photos->getByOwnerAndVID($ownerId, $photoId);
if(!$photo) $this->notFound();
if(is_null($this->user) || $this->user->id != $ownerId)
- $this->flashFail("err", "Ошибка доступа", "Недостаточно прав для модификации данного ресурса.");
+ $this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"));
$redirect = $photo->getAlbum()->getOwner() instanceof User ? "/id0" : "/club" . $ownerId;
@@ -336,7 +336,7 @@ final class PhotosPresenter extends OpenVKPresenter
if($_SERVER["REQUEST_METHOD"] === "POST")
$this->returnJson(["success" => true]);
- $this->flash("succ", "Фотография удалена", "Эта фотография была успешно удалена.");
+ $this->flash("succ", tr("photo_is_deleted"), tr("photo_is_deleted_desc"));
$this->redirect($redirect);
}
}
diff --git a/Web/Presenters/ReportPresenter.php b/Web/Presenters/ReportPresenter.php
index 68d27861..a87154c8 100644
--- a/Web/Presenters/ReportPresenter.php
+++ b/Web/Presenters/ReportPresenter.php
@@ -118,22 +118,22 @@ final class ReportPresenter extends OpenVKPresenter
$report->deleteContent();
$report->banUser($this->user->identity->getId());
- $this->flash("suc", "Смэрть...", "Пользователь успешно забанен.");
+ $this->flash("suc", tr("death"), tr("user_successfully_banned"));
} else if ($this->postParam("delete")) {
$report->deleteContent();
- $this->flash("suc", "Нехай живе!", "Контент удалён, а пользователю прилетело предупреждение.");
+ $this->flash("suc", tr("nehay"), tr("content_is_deleted"));
} else if ($this->postParam("ignore")) {
$report->delete();
- $this->flash("suc", "Нехай живе!", "Жалоба проигнорирована.");
+ $this->flash("suc", tr("nehay"), tr("report_is_ignored"));
} else if ($this->postParam("banClubOwner") || $this->postParam("banClub")) {
if ($report->getContentType() !== "group")
- $this->flashFail("err", "Ошибка доступа", "Недостаточно прав для модификации данного ресурса.");
+ $this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"));
$club = $report->getContentObject();
if (!$club || $club->isBanned())
- $this->flashFail("err", "Ошибка доступа", "Недостаточно прав для модификации данного ресурса.");
+ $this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"));
if ($this->postParam("banClubOwner")) {
$club->getOwner()->ban("**content-" . $report->getContentType() . "-" . $report->getContentId() . "**", false, $club->getOwner()->getNewBanTime(), $this->user->identity->getId());
@@ -143,7 +143,7 @@ final class ReportPresenter extends OpenVKPresenter
$report->delete();
- $this->flash("suc", "Смэрть...", ($this->postParam("banClubOwner") ? "Создатель сообщества успешно забанен." : "Сообщество успешно забанено"));
+ $this->flash("suc", tr("death"), ($this->postParam("banClubOwner") ? tr("group_owner_is_banned") : tr("group_is_banned")));
}
$this->redirect("/scumfeed");
diff --git a/Web/Presenters/TopicsPresenter.php b/Web/Presenters/TopicsPresenter.php
index e7b08ac3..92d67e84 100644
--- a/Web/Presenters/TopicsPresenter.php
+++ b/Web/Presenters/TopicsPresenter.php
@@ -111,7 +111,7 @@ final class TopicsPresenter extends OpenVKPresenter
$video = Video::fastMake($this->user->id, $_FILES["_vid_attachment"]["name"], $this->postParam("text"), $_FILES["_vid_attachment"]);
}
} catch(ISE $ex) {
- $this->flash("err", "Не удалось опубликовать комментарий", "Файл медиаконтента повреждён или слишком велик.");
+ $this->flash("err", tr("error_when_publishing_comment"), tr("error_comment_file_too_big"));
$this->redirect("/topic" . $topic->getPrettyId());
}
@@ -126,7 +126,7 @@ final class TopicsPresenter extends OpenVKPresenter
$comment->setFlags($flags);
$comment->save();
} catch (\LengthException $ex) {
- $this->flash("err", "Не удалось опубликовать комментарий", "Комментарий слишком большой.");
+ $this->flash("err", tr("error_when_publishing_comment"), tr("error_comment_too_big"));
$this->redirect("/topic" . $topic->getPrettyId());
}
diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php
index 46aa7e92..51ddc6aa 100644
--- a/Web/Presenters/UserPresenter.php
+++ b/Web/Presenters/UserPresenter.php
@@ -72,7 +72,7 @@ final class UserPresenter extends OpenVKPresenter
if(!is_null($this->user)) {
if($this->template->mode !== "friends" && $this->user->id !== $id) {
$name = $user->getFullName();
- $this->flash("err", "Ошибка доступа", "Вы не можете просматривать полный список подписок $name.");
+ $this->flash("err", tr("error_access_denied_short"), tr("error_viewing_subs", $name));
$this->redirect($user->getURL());
}
@@ -107,11 +107,11 @@ final class UserPresenter extends OpenVKPresenter
$this->notFound();
if(!$club->canBeModifiedBy($this->user->identity ?? NULL))
- $this->flashFail("err", "Ошибка доступа", "У вас недостаточно прав, чтобы изменять этот ресурс.", NULL, true);
+ $this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"), NULL, true);
$isClubPinned = $this->user->identity->isClubPinned($club);
if(!$isClubPinned && $this->user->identity->getPinnedClubCount() > 10)
- $this->flashFail("err", "Ошибка", "Находится в левом меню могут максимум 10 групп", NULL, true);
+ $this->flashFail("err", tr("error"), tr("error_max_pinned_clubs"), NULL, true);
if($club->getOwner()->getId() === $this->user->identity->getId()) {
$club->setOwner_Club_Pinned(!$isClubPinned);
@@ -237,7 +237,7 @@ final class UserPresenter extends OpenVKPresenter
} elseif($_GET['act'] === "status") {
if(mb_strlen($this->postParam("status")) > 255) {
$statusLength = (string) mb_strlen($this->postParam("status"));
- $this->flashFail("err", "Ошибка", "Статус слишком длинный ($statusLength символов вместо 255 символов)", NULL, true);
+ $this->flashFail("err", tr("error"), tr("error_status_too_long", $statusLength), NULL, true);
}
$user->setStatus(empty($this->postParam("status")) ? NULL : $this->postParam("status"));
@@ -281,7 +281,7 @@ final class UserPresenter extends OpenVKPresenter
if($_SERVER["REQUEST_METHOD"] === "POST") {
if(!$user->verifyNumber($this->postParam("code") ?? 0))
- $this->flashFail("err", "Ошибка", "Не удалось подтвердить номер телефона: неверный код.");
+ $this->flashFail("err", tr("error"), tr("invalid_code"));
$this->flash("succ", tr("changes_saved"), tr("changes_saved_comment"));
}
diff --git a/Web/Presenters/VideosPresenter.php b/Web/Presenters/VideosPresenter.php
index 4e4d484a..9d2fddc6 100644
--- a/Web/Presenters/VideosPresenter.php
+++ b/Web/Presenters/VideosPresenter.php
@@ -58,7 +58,7 @@ final class VideosPresenter extends OpenVKPresenter
$this->willExecuteWriteAction();
if(OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading'])
- $this->flashFail("err", tr("error"), "Video uploads are disabled by the system administrator.");
+ $this->flashFail("err", tr("error"), tr("video_uploads_disabled"));
if($_SERVER["REQUEST_METHOD"] === "POST") {
if(!empty($this->postParam("name"))) {
@@ -74,18 +74,18 @@ final class VideosPresenter extends OpenVKPresenter
else if(!empty($this->postParam("link")))
$video->setLink($this->postParam("link"));
else
- $this->flashFail("err", "Нету видеозаписи", "Выберите файл или укажите ссылку.");
+ $this->flashFail("err", tr("no_video"), tr("no_video_desc"));
} catch(\DomainException $ex) {
- $this->flashFail("err", "Произошла ошибка", "Файл повреждён или не содержит видео." );
+ $this->flashFail("err", tr("error_occured"), tr("error_video_damaged_file"));
} catch(ISE $ex) {
- $this->flashFail("err", "Произошла ошибка", "Возможно, ссылка некорректна.");
+ $this->flashFail("err", tr("error_occured"), tr("error_video_incorrect_link"));
}
$video->save();
$this->redirect("/video" . $video->getPrettyId());
} else {
- $this->flashFail("err", "Произошла ошибка", "Видео не может быть опубликовано без названия.");
+ $this->flashFail("err", tr("error_occured"), tr("error_video_no_title"));
}
}
}
@@ -99,14 +99,14 @@ final class VideosPresenter extends OpenVKPresenter
if(!$video)
$this->notFound();
if(is_null($this->user) || $this->user->id !== $owner)
- $this->flashFail("err", "Ошибка доступа", "Вы не имеете права редактировать этот ресурс.");
+ $this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"));
if($_SERVER["REQUEST_METHOD"] === "POST") {
$video->setName(empty($this->postParam("name")) ? NULL : $this->postParam("name"));
$video->setDescription(empty($this->postParam("desc")) ? NULL : $this->postParam("desc"));
$video->save();
- $this->flash("succ", "Изменения сохранены", "Обновлённое описание появится на странице с видосиком.");
+ $this->flash("succ", tr("changes_saved"), tr("new_data_video"));
$this->redirect("/video" . $video->getPrettyId());
}
@@ -128,7 +128,7 @@ final class VideosPresenter extends OpenVKPresenter
$video->deleteVideo($owner, $vid);
}
} else {
- $this->flashFail("err", "Не удалось удалить пост", "Вы не вошли в аккаунт.");
+ $this->flashFail("err", tr("error_deleting_video"), tr("login_please"));
}
$this->redirect("/videos" . $owner);
diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php
index 96b61b48..32ac421e 100644
--- a/Web/Presenters/WallPresenter.php
+++ b/Web/Presenters/WallPresenter.php
@@ -233,7 +233,7 @@ final class WallPresenter extends OpenVKPresenter
$this->flashFail("err", tr("not_enough_permissions"), tr("not_enough_permissions_comment"));
if($_FILES["_vid_attachment"] && OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading'])
- $this->flashFail("err", tr("error"), "Video uploads are disabled by the system administrator.");
+ $this->flashFail("err", tr("error"), tr("video_uploads_disabled"));
$anon = OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["anonymousPosting"]["enable"];
if($wallOwner instanceof Club && $this->postParam("as_group") === "on" && $this->postParam("force_sign") !== "on" && $anon) {
diff --git a/Web/Presenters/templates/@layout.xml b/Web/Presenters/templates/@layout.xml
index f37532a7..f8a975e0 100644
--- a/Web/Presenters/templates/@layout.xml
+++ b/Web/Presenters/templates/@layout.xml
@@ -38,9 +38,8 @@