diff --git a/Web/Models/Entities/BugReport.php b/Web/Models/Entities/BugReport.php index d07011c7..65976261 100644 --- a/Web/Models/Entities/BugReport.php +++ b/Web/Models/Entities/BugReport.php @@ -42,7 +42,16 @@ class BugReport extends RowModel function getStatus(): string { - $list = ["Открыт", "На рассмотрении", "В работе", "Исправлен", "Закрыт", "Требует корректировки", "Заблокирован", "Отклонён"]; + $list = [ + tr("bug_tracker_status_open"), + tr("bug_tracker_status_under_review"), + tr("bug_tracker_status_in_progress"), + tr("bug_tracker_status_fixed"), + tr("bug_tracker_status_closed"), + tr("bug_tracker_status_requires_adjustment"), + tr("bug_tracker_status_locked"), + tr("bug_tracker_status_rejected") + ]; $status_id = $this->getRecord()->status; return $list[$status_id]; @@ -55,7 +64,14 @@ class BugReport extends RowModel function getPriority(): string { - $list = ["Пожелание", "Низкий", "Средний", "Высокий", "Критический", "Уязвимость"]; + $list = [ + tr("bug_tracker_priority_feature"), + tr("bug_tracker_priority_low"), + tr("bug_tracker_priority_medium"), + tr("bug_tracker_priority_high"), + tr("bug_tracker_priority_critical"), + tr("bug_tracker_priority_vulnerability") + ]; $priority_id = $this->getRecord()->priority; return $list[$priority_id]; @@ -80,4 +96,9 @@ class BugReport extends RowModel { return new DateTime($this->getRecord()->created); } + + function isDeleted(): bool + { + return (bool) $this->getRecord()->deleted; + } } \ No newline at end of file diff --git a/Web/Presenters/BugtrackerPresenter.php b/Web/Presenters/BugtrackerPresenter.php index 2350629e..c6c19f38 100644 --- a/Web/Presenters/BugtrackerPresenter.php +++ b/Web/Presenters/BugtrackerPresenter.php @@ -59,7 +59,7 @@ final class BugtrackerPresenter extends OpenVKPresenter $this->template->canAdminBugTracker = $this->user->identity->getChandlerUser()->can("admin")->model('openvk\Web\Models\Repositories\BugtrackerReports')->whichBelongsTo(NULL); } else { - $this->flashFail("err", "Отчёт не найден. Возможно, он был удалён."); + $this->flashFail("err", tr("bug_tracker_report_not_found")); } } @@ -71,7 +71,16 @@ final class BugtrackerPresenter extends OpenVKPresenter $status = $this->postParam("status"); $comment = $this->postParam("text"); $points = $this->postParam("points-count"); - $list = ["Открыт", "На рассмотрении", "В работе", "Исправлен", "Закрыт", "Требует корректировки", "Заблокирован", "Отклонён"]; + $list = [ + tr("bug_tracker_status_open"), + tr("bug_tracker_status_under_review"), + tr("bug_tracker_status_in_progress"), + tr("bug_tracker_status_fixed"), + tr("bug_tracker_status_closed"), + tr("bug_tracker_status_requires_adjustment"), + tr("bug_tracker_status_locked"), + tr("bug_tracker_status_rejected") + ]; $report = (new BugtrackerReports)->get($report_id); $report->setStatus($status); @@ -81,8 +90,8 @@ final class BugtrackerPresenter extends OpenVKPresenter $report->save(); - $this->createComment($report, $comment, "Новый статус отчёта — $list[$status]", TRUE); - $this->flashFail("succ", "Изменения сохранены", "Новый статус отчёта — $list[$status]"); + $this->createComment($report, $comment, tr("bug_tracker_new_report_status") . " — $list[$status]", TRUE); + $this->flashFail("succ", tr("changes_saved"), tr("bug_tracker_new_report_status") . " — $list[$status]"); } function renderChangePriority(int $report_id): void @@ -93,7 +102,14 @@ final class BugtrackerPresenter extends OpenVKPresenter $priority = $this->postParam("priority"); $comment = $this->postParam("text"); $points = $this->postParam("points-count"); - $list = ["Пожелание", "Низкий", "Средний", "Высокий", "Критический", "Уязвимость"]; + $list = [ + tr("bug_tracker_priority_feature"), + tr("bug_tracker_priority_low"), + tr("bug_tracker_priority_medium"), + tr("bug_tracker_priority_high"), + tr("bug_tracker_priority_critical"), + tr("bug_tracker_priority_vulnerability") + ]; $report = (new BugtrackerReports)->get($report_id); $report->setPriority($priority); @@ -103,8 +119,8 @@ final class BugtrackerPresenter extends OpenVKPresenter $report->save(); - $this->createComment($report, $comment, "Новый приоритет отчёта — $list[$priority]", TRUE); - $this->flashFail("succ", "Изменения сохранены", "Новый приоритет отчёта — $list[$priority]"); + $this->createComment($report, $comment, tr("bug_tracker_new_report_priority") . " — $list[$priority]", TRUE); + $this->flashFail("succ", tr("changes_saved"), tr("bug_tracker_new_report_priority") . " — $list[$priority]"); } function createComment(?BugReport $report, string $text, string $label = "", bool $is_moder = FALSE, bool $is_hidden = FALSE) @@ -112,10 +128,10 @@ final class BugtrackerPresenter extends OpenVKPresenter $moder = $this->user->identity->getChandlerUser()->can("admin")->model('openvk\Web\Models\Repositories\BugtrackerReports')->whichBelongsTo(NULL); if (!$text && !$label) - $this->flashFail("err", "Ошибка", "Комментарий не может быть пустым."); + $this->flashFail("err", tr("error"), tr("bug_tracker_empty_comment")); if ($report->getRawStatus() == 6 && !$moder) - $this->flashFail("err", "Ошибка доступа"); + $this->flashFail("err", tr("forbidden")); DB::i()->getContext()->table("bt_comments")->insert([ "report" => $report->getId(), @@ -126,7 +142,7 @@ final class BugtrackerPresenter extends OpenVKPresenter "label" => $label ]); - $this->flashFail("succ", "Успех", "Комментарий отправлен."); + $this->flashFail("succ", tr("bug_tracker_success"), tr("bug_tracker_comment_sent")); } function renderAddComment(int $report_id): void @@ -153,7 +169,7 @@ final class BugtrackerPresenter extends OpenVKPresenter $device = $this->postParam("device"); if (!$title || !$text || !$priority || !$product || !$device) - $this->flashFail("err", "Ошибка", "Заполнены не все поля"); + $this->flashFail("err", tr("error"), tr("bug_tracker_fields_error")); $id = DB::i()->getContext()->table("bugs")->insert([ "reporter" => $this->user->identity->getId(), @@ -176,7 +192,7 @@ final class BugtrackerPresenter extends OpenVKPresenter $moder = $this->user->identity->getChandlerUser()->can("admin")->model('openvk\Web\Models\Repositories\BugtrackerReports')->whichBelongsTo(NULL); if (!$moder) - $this->flashFail("err", "Ошибка доступа"); + $this->flashFail("err", tr("forbidden")); $title = $this->postParam("title"); $description = $this->postParam("description"); @@ -198,10 +214,10 @@ final class BugtrackerPresenter extends OpenVKPresenter $report = (new BugtrackerReports)->get($report_id); if ($report->getReporter()->getId() === $this->user->identity->getId()) - $this->flashFail("err", "Ошибка доступа"); + $this->flashFail("err", tr("forbidden")); DB::i()->getContext()->table("bugs")->where("id", $report_id)->update("reproduced", $report->getReproducedCount() + 1); - $this->flashFail("succ", "Успех", "Вы отметили, что у Вас получилось воспроизвести этот баг."); + $this->flashFail("succ", tr("bug_tracker_success"), tr("bug_tracker_reproduced_text")); } } \ No newline at end of file diff --git a/Web/Presenters/templates/Bugtracker/Index.xml b/Web/Presenters/templates/Bugtracker/Index.xml index faea620d..e58ad6b8 100644 --- a/Web/Presenters/templates/Bugtracker/Index.xml +++ b/Web/Presenters/templates/Bugtracker/Index.xml @@ -1,36 +1,36 @@ {extends "../@layout.xml"} -{block title}Баг-трекер{/block} +{block title}{_bug_tracker}{/block} {block header} -Баг-трекер + {_bug_tracker} {/block} {block content}
- Отчёты + {_bug_tracker_reports}
- Продукты + {_bug_tracker_products}
- Карточка тестировщика + {_bug_tracker_reporter_card}
- Создать + {_create}
- Создать + {_create}
@@ -59,25 +59,25 @@ - + - + - + - + - + @@ -101,44 +101,44 @@

- +



-

Приоритет

+

{_bug_tracker_priority}

Продукт:{_bug_tracker_product}: {$bug->getProduct()->getCanonicalName()}
Отправил: {_bug_tracker_sent_by}: {$bug->getReporter()->getCanonicalName()}
Воспроизвелось:{_bug_tracker_reproduced}: {tr("participants", $bug->getReproducedCount())}
Статус:{_status}: {$bug->getStatus()}
Приоритет:{_priority}: {$bug->getPriority()}
- + - + - + - + - + - +

- +

@@ -166,20 +166,20 @@ - + - + - + @@ -192,13 +192,13 @@ {elseif $mode === "new_product"} - +

- +

- +

@@ -212,7 +212,7 @@
{$reporter->getCanonicalName()} -
тестировщик отправил {$reporter_stats[0]} отчётов, из них {$reporter_stats[1]} имеют положительный статус
+
tr("bug_tracker_reporter_card_text", $reporter_stats[0], $reporter_stats[1])
Название:{_bug_tracker_name}: {$product->getCanonicalName()} - (закрыт) + ({_bug_tracker_product_is_closed})
Создал: {_bug_tracker_product_created_by}: {$product->getCreator()->getCanonicalName()}
Дата создания:{_bug_tracker_product_creation_date}: 123
@@ -234,25 +234,25 @@
- + - + - + - + - + @@ -273,7 +273,7 @@
-
Пользователь не найден.
+
{_profile_not_found}
{/if} {/block} \ No newline at end of file diff --git a/Web/Presenters/templates/Bugtracker/View.xml b/Web/Presenters/templates/Bugtracker/View.xml index f26a26d8..af49fd11 100644 --- a/Web/Presenters/templates/Bugtracker/View.xml +++ b/Web/Presenters/templates/Bugtracker/View.xml @@ -8,7 +8,7 @@ {/block} {block content} -{if $bug} +{if $bug AND !$bug->isDeleted()}

{$bug->getCanonicalName()}

@@ -19,7 +19,7 @@
{$reporter->getCanonicalName()} -
создано: {$bug->getCreationDate()}
+
{_created}: {$bug->getCreationDate()}

@@ -28,33 +28,36 @@
Продукт:{_bug_tracker_product}: {$bug->getProduct()->getCanonicalName()}
Отправил: {_bug_tracker_sent_by}: {$bug->getReporter()->getCanonicalName()}
Воспроизвелось:{_bug_tracker_reproduced}: {tr("participants", $bug->getReproducedCount())}
Статус:{_status}: {$bug->getStatus()}
Приоритет:{_bug_tracker_priority}: {$bug->getPriority()}
- + - + - + - + - +
Отправил: {_bug_tracker_sent_by}: {$bug->getReporter()->getCanonicalName()}
Воспроизвелось:{_bug_tracker_reproduced}: {tr("participants", $bug->getReproducedCount())}
Статус:{_status}: {$bug->getStatus()}
Приоритет:{_bug_tracker_priority}: {$bug->getPriority()}
Устройство:{_bug_tracker_device}: {$bug->getDevice()}

- - -Воспроизвелось + + + + {_bug_tracker_reproduced} + ({$bug->getReproducedCount()}) + {if sizeof($comments) > 0}
@@ -66,12 +69,12 @@
- {$comment->isModer() ? "Модератор" : $comment->getAuthor()->getCanonicalName()} + {$comment->isModer() ? "{_bug_tracker_moderator}" : $comment->getAuthor()->getCanonicalName()} ({$comment->getAuthor()->getCanonicalName()}) - (скрытый комментарий) + ({_bug_tracker_hidden_comment_span})
{$comment->getLabel()}
@@ -87,10 +90,10 @@
- + - +
@@ -100,7 +103,7 @@ {else}
- Отчёт не найден. Возможно, он был удалён. + {_bug_tracker_report_not_found}
{/if} diff --git a/locales/en.strings b/locales/en.strings index daa4e27b..c0e768ea 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -1046,3 +1046,49 @@ "cookies_popup_content" = "All kids love cookie, so this website uses Cookies to identify your session and nothing more. Check our privacy policy for more information."; "cookies_popup_agree" = "Accept"; + +/* Bugtracker */ + +"bug_tracker_reports" = "Reports"; +"bug_tracker_products" = "Products"; +"bug_tracker_reporter_card" = "Tester Card"; +"bug_tracker_product" = "Product"; +"bug_tracker_sent_by" = "Author"; +"bug_tracker_reproduced" = "Reproduced for"; +"bug_tracker_priority" = "Priority"; +"bug_tracker_bug_description" = "Bug description"; +"bug_tracker_priority_feature" = "Feature request"; +"bug_tracker_priority_low" = "Low"; +"bug_tracker_priority_medium" = "Medium"; +"bug_tracker_priority_high" = "High"; +"bug_tracker_priority_critical" = "Critical"; +"bug_tracker_priority_vulnerability" = "Vulnerability"; +"bug_tracker_device" = "Device"; +"bug_tracker_product_name" = "Title"; +"bug_tracker_product_is_closed" = "closed"; +"bug_tracker_product_created_by" = "Created by"; +"bug_tracker_product_creation_date" = "Creation date"; +"bug_tracker_product_description" = "Product description"; +"bug_tracker_reporter_card_text" = "the tester has sent $1 reports, of which $2 have a positive status"; +"bug_tracker_change_status" = "Change Status"; +"bug_tracker_change_priority" = "Change Priority"; +"bug_tracker_moderator" = "Moderator"; +"bug_tracker_hidden_comment_span" = "hidden comment"; +"bug_tracker_comment_as_moderator" = "On behalf of the moderator"; +"bug_tracker_hidden_comment" = "Hidden comment"; +"bug_tracker_report_not_found" = "The report was not found. It may have been deleted."; +"bug_tracker_status_open" = "Open"; +"bug_tracker_status_under_review" = "Under review": +"bug_tracker_status_in_progress" = "In progress"; +"bug_tracker_status_fixed" = "Fixed"; +"bug_tracker_status_closed" = "Closed"; +"bug_tracker_status_requires_adjustment" = "Requires adjustment"; +"bug_tracker_status_locked" = "Blocked"; +"bug_tracker_status_rejected" = "Rejected"; +"bug_tracker_new_report_status" = "New report status"; +"bug_tracker_new_report_priority" = "New report priority"; +"bug_tracker_empty_comment" = "The comment cannot be empty."; +"bug_tracker_success" = "Success"; +"bug_tracker_comment_sent" = "The comment has been sent."; +"bug_tracker_fields_error" = "Not all fields are filled in."; +"bug_tracker_reproduced_text" = "You have indicated that this bug is reproducible for you"; \ No newline at end of file diff --git a/locales/ru.strings b/locales/ru.strings index af93c4db..d377bdd6 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -1105,3 +1105,49 @@ "cookies_popup_content" = "Все дети любят печенье, поэтому этот веб-сайт использует Cookies для того, чтобы идентифицировать вашу сессию и ничего более. Ознакомьтесь с нашей политикой конфиденциальности для получения дополнительной информации."; "cookies_popup_agree" = "Согласен"; + +/* Bugtracker */ + +"bug_tracker_reports" = "Отчёты"; +"bug_tracker_products" = "Продукты"; +"bug_tracker_reporter_card" = "Карточка тестировщика"; +"bug_tracker_product" = "Продукт"; +"bug_tracker_sent_by" = "Отправил"; +"bug_tracker_reproduced" = "Воспроизвелось"; +"bug_tracker_priority" = "Приоритет"; +"bug_tracker_bug_description" = "Описание бага"; +"bug_tracker_priority_feature" = "Пожелание"; +"bug_tracker_priority_low" = "Низкий"; +"bug_tracker_priority_medium" = "Средний"; +"bug_tracker_priority_high" = "Высокий"; +"bug_tracker_priority_critical" = "Критический"; +"bug_tracker_priority_vulnerability" = "Уязвимость"; +"bug_tracker_device" = "Устройство"; +"bug_tracker_product_name" = "Название"; +"bug_tracker_product_is_closed" = "закрыт"; +"bug_tracker_product_created_by" = "Создал"; +"bug_tracker_product_creation_date" = "Дата создания"; +"bug_tracker_product_description" = "Описание продукта"; +"bug_tracker_reporter_card_text" = "тестировщик отправил $1 отчётов, из них $2 имеют положительный статус"; +"bug_tracker_change_status" = "Изменить статус"; +"bug_tracker_change_priority" = "Изменить приоритет"; +"bug_tracker_moderator" = "Модератор"; +"bug_tracker_hidden_comment_span" = "скрытый комментарий"; +"bug_tracker_comment_as_moderator" = "От лица модератора"; +"bug_tracker_hidden_comment" = "Скрытый комментарий"; +"bug_tracker_report_not_found" = "Отчёт не найден. Возможно, он был удалён."; +"bug_tracker_status_open" = "Открыт"; +"bug_tracker_status_under_review" = "На рассмотрении": +"bug_tracker_status_in_progress" = "В работе"; +"bug_tracker_status_fixed" = "Исправлен"; +"bug_tracker_status_closed" = "Закрыт"; +"bug_tracker_status_requires_adjustment" = "Требует корректировки"; +"bug_tracker_status_locked" = "Заблокирован"; +"bug_tracker_status_rejected" = "Отклонён"; +"bug_tracker_new_report_status" = "Новый статус отчёта"; +"bug_tracker_new_report_priority" = "Новый приоритет отчёта"; +"bug_tracker_empty_comment" = "Комментарий не может быть пустым."; +"bug_tracker_success" = "Успех"; +"bug_tracker_comment_sent" = "Комментарий отправлен."; +"bug_tracker_fields_error" = "Заполнены не все поля."; +"bug_tracker_reproduced_text" = "Вы отметили, что у Вас получилось воспроизвести этот баг."; \ No newline at end of file