Localization Supplement

This commit is contained in:
veselcraft 2020-08-20 17:05:00 +03:00
parent de778a283e
commit fdc58c4185
9 changed files with 100 additions and 29 deletions

View file

@ -112,12 +112,12 @@ final class UserPresenter extends OpenVKPresenter
if(!empty($this->postParam("phone")) && $this->postParam("phone") !== $user->getPhone()) { if(!empty($this->postParam("phone")) && $this->postParam("phone") !== $user->getPhone()) {
if(!OPENVK_ROOT_CONF["openvk"]["credentials"]["zadarma"]["enable"]) if(!OPENVK_ROOT_CONF["openvk"]["credentials"]["zadarma"]["enable"])
$this->flashFail("err", "Ошибка сегментации", "котлетки"); $this->flashFail("err", tr("error_segmentation"), "котлетки");
$code = $user->setPhoneWithVerification($this->postParam("phone")); $code = $user->setPhoneWithVerification($this->postParam("phone"));
if(!Sms::send($this->postParam("phone"), "OPENVK | Your verification code is: $code")) if(!Sms::send($this->postParam("phone"), "OPENVK | Your verification code is: $code"))
$this->flashFail("err", "Ошибка сегментации", "котлетки: Remote err!"); $this->flashFail("err", tr("error_segmentation"), "котлетки: Remote err!");
} }
} elseif($_GET['act'] === "contacts") { } elseif($_GET['act'] === "contacts") {
$user->setEmail_Contact(empty($this->postParam("email_contact")) ? NULL : $this->postParam("email_contact")); $user->setEmail_Contact(empty($this->postParam("email_contact")) ? NULL : $this->postParam("email_contact"));
@ -138,12 +138,12 @@ final class UserPresenter extends OpenVKPresenter
$user->save(); $user->save();
} catch(\PDOException $ex) { } catch(\PDOException $ex) {
if($ex->getCode() == 23000) if($ex->getCode() == 23000)
$this->flashFail("err", "Ошибка", "Данный короткий адрес уже занят."); $this->flashFail("err", tr("error"), tr("error_shorturl"));
else else
throw $ex; throw $ex;
} }
$this->flash("succ", "Изменения сохранены", "Новые данные появятся на вашей странице."); $this->flash("succ", tr("changes_saved"), tr("changes_saved_comment"));
} }
$this->template->mode = in_array($this->queryParam("act"), [ $this->template->mode = in_array($this->queryParam("act"), [
@ -168,7 +168,7 @@ final class UserPresenter extends OpenVKPresenter
if(!$user->verifyNumber($this->postParam("code") ?? 0)) if(!$user->verifyNumber($this->postParam("code") ?? 0))
$this->flashFail("err", "Ошибка", "Не удалось подтвердить номер телефона: неверный код."); $this->flashFail("err", "Ошибка", "Не удалось подтвердить номер телефона: неверный код.");
$this->flash("succ", "Изменения сохранены", "Новые данные появятся на вашей странице."); $this->flash("succ", tr("changes_saved"), tr("changes_saved_comment"));
} }
} }
@ -201,11 +201,11 @@ final class UserPresenter extends OpenVKPresenter
$photo->save(); $photo->save();
} catch(ISE $ex) { } catch(ISE $ex) {
$name = $album->getName(); $name = $album->getName();
$this->flashFail("err", "Неизвестная ошибка", "Не удалось сохранить фотографию."); $this->flashFail("err", tr("error"), tr("error_upload_failed"));
} }
(new Albums)->getUserAvatarAlbum($this->user->identity)->addPhoto($photo); (new Albums)->getUserAvatarAlbum($this->user->identity)->addPhoto($photo);
$this->flashFail("succ", "Фотография сохранена", "Новое изображения профиля появится у вас на странице."); $this->flashFail("succ", tr("photo_saved"), tr("photo_saved_comment"));
} }
function renderSettings(): void function renderSettings(): void
@ -223,14 +223,14 @@ final class UserPresenter extends OpenVKPresenter
if($this->postParam("old_pass") && $this->postParam("new_pass") && $this->postParam("repeat_pass")) { if($this->postParam("old_pass") && $this->postParam("new_pass") && $this->postParam("repeat_pass")) {
if($this->postParam("new_pass") === $this->postParam("repeat_pass")) { if($this->postParam("new_pass") === $this->postParam("repeat_pass")) {
if(!$this->user->identity->getChandlerUser()->updatePassword($this->postParam("new_pass"), $this->postParam("old_pass"))) if(!$this->user->identity->getChandlerUser()->updatePassword($this->postParam("new_pass"), $this->postParam("old_pass")))
$this->flashFail("err", "Ошибка", "Старый пароль не совпадает."); $this->flashFail("err", tr("error"), tr("error_old_password"));
} else { } else {
$this->flashFail("err", "Ошибка", "Новые пароли не совпадают."); $this->flashFail("err", tr("error"), tr("error_new_password"));
} }
} }
if(!$user->setShortCode(empty($this->postParam("sc")) ? NULL : $this->postParam("sc"))) if(!$user->setShortCode(empty($this->postParam("sc")) ? NULL : $this->postParam("sc")))
$this->flashFail("err", "Ошибка", "Короткий адрес имеет некорректный формат."); $this->flashFail("err", tr("error"), tr("error_shorturl_incorrect"));
}elseif($_GET['act'] === "privacy") { }elseif($_GET['act'] === "privacy") {
$settings = [ $settings = [
"page.read", "page.read",
@ -273,7 +273,7 @@ final class UserPresenter extends OpenVKPresenter
$user->save(); $user->save();
} catch(\PDOException $ex) { } catch(\PDOException $ex) {
if($ex->getCode() == 23000) if($ex->getCode() == 23000)
$this->flashFail("err", "Ошибка", "Данный короткий адрес уже занят."); $this->flashFail("err", tr("error"), tr("error_shorturl"));
else else
throw $ex; throw $ex;
} }

View file

@ -66,7 +66,7 @@
<tbody> <tbody>
<tr> <tr>
<td width="120" valign="top"><span class="nobold">{_"gender"}: </span></td> <td width="120" valign="top"><span class="nobold">{_"gender"}: </span></td>
<td>{$x->isFemale() ? "женский" : "мужской"}</td> <td>{$x->isFemale() ? tr("female") : tr("male")}</td>
</tr> </tr>
<tr> <tr>
<td width="120" valign="top"><span class="nobold">{_"relationship"}:</span></td> <td width="120" valign="top"><span class="nobold">{_"relationship"}:</span></td>

View file

@ -117,6 +117,7 @@
</form> </form>
<!-- dsrev: it's better if we hide it before the page deletion function appears tbh. <!-- dsrev: it's better if we hide it before the page deletion function appears tbh.
vc: i agree
<div class="settings_delete"> <div class="settings_delete">
{_you_can_also} <a href="#" onclick="alert('Не реализовали ждите')">{_delete_your_page}</a>. {_you_can_also} <a href="#" onclick="alert('Не реализовали ждите')">{_delete_your_page}</a>.

View file

@ -47,8 +47,8 @@
{if !$user->getPrivacyPermission('page.read', $thisUser ?? NULL)} {if !$user->getPrivacyPermission('page.read', $thisUser ?? NULL)}
<div class="msg msg_err"> <div class="msg msg_err">
<b>Ошибка доступа</b><br/> <b>{_forbidden}</b><br/>
Настройки приватности этого пользователя не разрешают вам смотреть на его страницу. {_forbidden_comment}
</div> </div>
{else} {else}
@ -56,7 +56,7 @@
<div> <div>
<a href="{$user->getAvatarLink()|nocheck}"> <a href="{$user->getAvatarLink()|nocheck}">
<img src="{$user->getAvatarUrl()}" <img src="{$user->getAvatarUrl()}"
alt="Фотография пользователя {$user->getCanonicalName()}" alt="{$user->getCanonicalName()}"
style="width: 100%; image-rendering: -webkit-optimize-contrast;" /> style="width: 100%; image-rendering: -webkit-optimize-contrast;" />
</a> </a>
</div> </div>
@ -68,16 +68,16 @@
{else} {else}
{if $thisUser->getChandlerUser()->can("substitute")->model('openvk\Web\Models\Entities\User')->whichBelongsTo(0)} {if $thisUser->getChandlerUser()->can("substitute")->model('openvk\Web\Models\Entities\User')->whichBelongsTo(0)}
<a href="/setSID/{$user->getChandlerUser()->getId()}?hash={rawurlencode($csrfToken)}" class="profile_link"> <a href="/setSID/{$user->getChandlerUser()->getId()}?hash={rawurlencode($csrfToken)}" class="profile_link">
Войти как {$user->getFirstName()} {tr("login_as", $user->getFirstName())}
</a> </a>
{/if} {/if}
{if $thisUser->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL)} {if $thisUser->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL)}
<a href="javascript:banUser()" class="profile_link"> <a href="javascript:banUser()" class="profile_link">
Забанить пользователя {_ban_user_action}
</a> </a>
<a href="javascript:warnUser()" class="profile_link"> <a href="javascript:warnUser()" class="profile_link">
Предупредить пользователя {_warn_user_action}
</a> </a>
{/if} {/if}
@ -217,7 +217,7 @@
</div> </div>
<div> <div>
<b><a href="/album{$album->getPrettyId()}">{$album->getName()}</a></b><br> <b><a href="/album{$album->getPrettyId()}">{$album->getName()}</a></b><br>
<span class="nobold">Обновлён {$album->getEditTime() ?? $album->getPublicationTime()}</span> <span class="nobold">{tr("updated_at", $album->getEditTime() ?? $album->getPublicationTime())}</span>
</div> </div>
</div> </div>
</div> </div>
@ -436,7 +436,7 @@
{if !empty($contactInfo_Tmp)} {if !empty($contactInfo_Tmp)}
{$contactInfo_Tmp|noescape} {$contactInfo_Tmp|noescape}
{else} {else}
<div style="padding: 15px;color:gray;text-align: center;">Информация отсутствует.</div> <div style="padding: 15px;color:gray;text-align: center;">{_no_information_provided}</div>
{/if} {/if}
<br> <br>
{/if} {/if}
@ -444,7 +444,7 @@
{if !empty($uInfo_Tmp)} {if !empty($uInfo_Tmp)}
{$uInfo_Tmp|noescape} {$uInfo_Tmp|noescape}
{else} {else}
<div style="padding-top: 15px;color:gray;text-align: center;">Информация отсутствует.</div> <div style="padding-top: 15px;color:gray;text-align: center;">{_no_information_provided}</div>
{/if} {/if}
</div> </div>
</div> </div>

View file

@ -17,12 +17,12 @@
parent => $post } parent => $post }
</div> </div>
<div style="float: left; min-height: 100px; width: 32%;"> <div style="float: left; min-height: 100px; width: 32%;">
<h4>Действия</h4> <h4>{_actions}</h4>
{if isset($thisUser)} {if isset($thisUser)}
{var canDelete = $post->canBeDeletedBy($thisUser)} {var canDelete = $post->canBeDeletedBy($thisUser)}
{/if} {/if}
<a n:if="$canDelete ?? false" class="profile_link" style="display:block;width:96%;" href="/wall{$post->getPrettyId()}/delete">Удалить</a> <a n:if="$canDelete ?? false" class="profile_link" style="display:block;width:96%;" href="/wall{$post->getPrettyId()}/delete">{_delete}</a>
<a class="profile_link" style="display:block;width:96%;" href="/report.pl/{$post->getId()}?type=post">Пожаловаться</a> <a class="profile_link" style="display:block;width:96%;" href="/report.pl/{$post->getId()}?type=post">{_report}</a>
</div> </div>
{/block} {/block}

View file

@ -49,7 +49,7 @@
<input type="submit" value="{_'write'}" class="button" /> <input type="submit" value="{_'write'}" class="button" />
<div style="float: right;"> <div style="float: right;">
<a href="javascript:void(document.querySelector(`input[name=_pic_attachment]`).click());"> <a href="javascript:void(document.querySelector(`input[name=_pic_attachment]`).click());">
Прикрепить изображение {_attach_photo}
</a> </a>
</div> </div>
</form> </form>
@ -63,7 +63,7 @@
{/foreach} {/foreach}
{include "../components/paginator.xml", conf => $paginatorConf} {include "../components/paginator.xml", conf => $paginatorConf}
{else} {else}
Здесь никто ничего не написал... Пока. {_no_posts_abstract}
{/if} {/if}
</div> </div>
</div> </div>

View file

@ -3,12 +3,12 @@
<center> <center>
<a n:if="$conf->page != 1" <a n:if="$conf->page != 1"
href="?{http_build_query(array_merge($_GET, ['p' => ($conf->page - 1)]), 'k', '&', PHP_QUERY_RFC3986)}" href="?{http_build_query(array_merge($_GET, ['p' => ($conf->page - 1)]), 'k', '&', PHP_QUERY_RFC3986)}"
style="float: left;">&lt;&lt; Назад</a> style="float: left;">&lt;&lt; {_paginator_back}</a>
Страница {$conf->page} {tr("paginator_page", $conf->page)}
<a n:if="$conf->count > (($conf->page - 1) * $conf->perPage + $conf->amount) && $conf->amount > 0" <a n:if="$conf->count > (($conf->page - 1) * $conf->perPage + $conf->amount) && $conf->amount > 0"
href="?{http_build_query(array_merge($_GET, ['p' => ($conf->page + 1)]), 'k', '&', PHP_QUERY_RFC3986)}" href="?{http_build_query(array_merge($_GET, ['p' => ($conf->page + 1)]), 'k', '&', PHP_QUERY_RFC3986)}"
style="float: right;">Вперёд &gt;&gt;</a> style="float: right;">{_paginator_next} &gt;&gt;</a>
</center> </center>
</div> </div>

View file

@ -42,6 +42,7 @@
"all_title" = "All"; "all_title" = "All";
"information" = "Information"; "information" = "Information";
"status" = "Status"; "status" = "Status";
"no_information_provided" = "No information provided.";
"relationship" = "Relationship"; "relationship" = "Relationship";
@ -86,6 +87,8 @@
"favorite_quotes" = "Favorite quotes"; "favorite_quotes" = "Favorite quotes";
"information_about" = "About"; "information_about" = "About";
"updated_at" = "Updated at $1";
%{ Wall %} %{ Wall %}
"post_writes_m" = "wrote"; "post_writes_m" = "wrote";
@ -109,6 +112,9 @@
"publish_post" = "Add post"; "publish_post" = "Add post";
"nsfw_warning" = "This post may have NSFW-content"; "nsfw_warning" = "This post may have NSFW-content";
"report" = "Report";
"attach_photo" = "Attach photo";
"no_posts_abstract" = "Nobody wrote anything here... At least.";
%{ Friends %} %{ Friends %}
@ -374,3 +380,32 @@
"no_data" = "No data"; "no_data" = "No data";
"no_data_description" = "There is no data."; "no_data_description" = "There is no data.";
"error" = "Error";
"error_shorturl" = "This short address is already owned.";
"error_segmentation" = "Segmentation error";
"error_upload_failed" = "Failed to upload a photo";
"error_old_password" = "Old password does not match";
"error_new_password" = "New password does not match";
"error_shorturl_incorrect" = "The short address has an incorrect format.";
"forbidden" = "Access error";
"forbidden_comment" = "This user\'s privacy settings do not allow you to look at his page.";
"changes_saved" = "Changes saved";
"changes_saved_comment" = "New data will appear on your page";
"photo_saved" = "Photo saved";
"photo_saved_comment" = "New profile picture will appear on your page";
%{ Admin actions %}
"login_as" = "Login as $1";
"ban_user_action" = "Ban user";
"warn_user_action" = "Warn user";
%{ Paginator %}
"paginator_back" = "Back";
"paginator_page" = "Page $1";
"paginator_next" = "Next";

View file

@ -40,6 +40,7 @@
"all_title" = "Все"; "all_title" = "Все";
"information" = "Информация"; "information" = "Информация";
"status" = "Статус"; "status" = "Статус";
"no_information_provided" = "Информация отсутствует.";
"relationship" = "Семейное положение"; "relationship" = "Семейное положение";
@ -84,6 +85,8 @@
"favorite_quotes" = "Любимые цитаты"; "favorite_quotes" = "Любимые цитаты";
"information_about" = "О себе"; "information_about" = "О себе";
"updated_at" = "Обновлено $1";
%{ Wall %} %{ Wall %}
"post_writes_m" = "написал"; "post_writes_m" = "написал";
@ -108,6 +111,9 @@
"wall_other" = "$1 записей"; "wall_other" = "$1 записей";
"nsfw_warning" = "Данный пост может содержать 18+ контент"; "nsfw_warning" = "Данный пост может содержать 18+ контент";
"report" = "Пожаловаться";
"attach_photo" = "Прикрепить фото";
"no_posts_abstract" = "Здесь никто ничего не написал... Пока.";
%{ Friends %} %{ Friends %}
@ -437,3 +443,32 @@
"no_data" = "Нет данных"; "no_data" = "Нет данных";
"no_data_description" = "В этом представлении отсутствуют данные."; "no_data_description" = "В этом представлении отсутствуют данные.";
"error" = "Ошибка";
"error_shorturl" = "Данный короткий адрес уже занят.";
"error_segmentation" = "Ошибка сегментации";
"error_upload_failed" = "Не удалось загрузить фото";
"error_old_password" = "Старый пароль не совпадает";
"error_new_password" = "Новые пароли не совпадает";
"error_shorturl_incorrect" = "Короткий адрес имеет некорректный формат.";
"forbidden" = "Ошибка доступа";
"forbidden_comment" = "Настройки приватности этого пользователя не разрешают вам смотреть на его страницу.";
"changes_saved" = "Изменения сохранены";
"changes_saved_comment" = "Новый данные появятся на вашей странице";
"photo_saved" = "Фотография сохранена";
"photo_saved_comment" = "Новое изображние профиля появится у вас на странице";
%{ Admin actions %}
"login_as" = "Войти как $1";
"ban_user_action" = "Забанить пользователя";
"warn_user_action" = "Предупредить пользователя";
%{ Paginator %}
"paginator_back" = "Назад";
"paginator_page" = "Страница $1";
"paginator_next" = "Дальше";