Localize "posted in ..." messages

Also preliminary solved #739
This commit is contained in:
celestora 2022-10-08 23:47:21 +03:00
parent a950a2d706
commit c09694b568
5 changed files with 32 additions and 21 deletions

View file

@ -1,7 +1,7 @@
<?php declare(strict_types=1);
namespace openvk\Web\Models\Entities;
use Chandler\Database\DatabaseConnection as DB;
use openvk\Web\Models\Repositories\Clubs;
use openvk\Web\Models\Repositories\{Clubs, Users};
use openvk\Web\Models\RowModel;
use openvk\Web\Models\Entities\Notifications\LikeNotification;
@ -55,6 +55,15 @@ class Post extends Postable
{
return $this->getRecord()->wall;
}
function getWallOwner()
{
$w = $this->getRecord()->wall;
if($w < 0)
return (new Clubs)->get(abs($w));
return (new Users)->get($w);
}
function getRepostCount(): int
{

View file

@ -24,17 +24,15 @@
<img n:if="$author->isVerified()" class="name-checkmark" src="/assets/packages/static/openvk/img/checkmark.png">
{$post->isDeactivationMessage() ? ($author->isFemale() ? tr($deac . "_f") : tr($deac . "_m"))}
{if ($onWallOf ?? false) &&!$post->isPostedOnBehalfOfGroup() && $post->getOwnerPost() !== $post->getTargetWall()}
{var $wallId = $post->getTargetWall()}
{var $wallURL = $wallId > -1 ? "/id$wallId" : "/club" . abs($wallId)}
на
<a href="{$wallURL}">
{var $wallOwner = $post->getWallOwner()}
<a href="{$wallOwner->getURL()}">
<b>
{if isset($thisUser) && $thisUser->getId() === $wallId}
вашей
{/if}
стене
{if $wallId < 0}
группы
{if isset($thisUser) && $thisUser->getId() === $post->getTargetWall()}
{_post_on_your_wall}
{elseif $wallOwner instanceof \openvk\Web\Models\Entities\Club}
{tr("post_on_group_wall", ovk_proc_strtr($wallOwner->getName(), 52))}
{else}
{tr("post_on_user_wall", $wallOwner->getMorphedName("genitive", false))}
{/if}
</b>
</a>

View file

@ -20,17 +20,15 @@
<img n:if="$author->isVerified()" class="name-checkmark" src="/assets/packages/static/openvk/img/checkmark.png">
{$post->isDeactivationMessage() ? ($author->isFemale() ? tr($deac . "_f") : tr($deac . "_m")) : ($post->isPostedOnBehalfOfGroup() ? tr("post_writes_g") : ($author->isFemale() ? tr("post_writes_f") : tr("post_writes_m")))}
{if ($onWallOf ?? false) &&!$post->isPostedOnBehalfOfGroup() && $post->getOwnerPost() !== $post->getTargetWall()}
{var $wallId = $post->getTargetWall()}
{var $wallURL = $wallId > -1 ? "/id$wallId" : "/club" . abs($wallId)}
на
<a href="{$wallURL}">
{var $wallOwner = $post->getWallOwner()}
<a href="{$wallOwner->getURL()}">
<b>
{if isset($thisUser) && $thisUser->getId() === $wallId}
вашей
{/if}
стене
{if $wallId < 0}
группы
{if isset($thisUser) && $thisUser->getId() === $post->getTargetWall()}
{_post_on_your_wall}
{elseif $wallOwner instanceof \openvk\Web\Models\Entities\Club}
{tr("post_on_group_wall", ovk_proc_strtr($wallOwner->getName(), 52))}
{else}
{tr("post_on_user_wall", $wallOwner->getMorphedName("genitive", false))}
{/if}
</b>
</a>

View file

@ -154,6 +154,9 @@
"post_deact_f" = "deleted her profile saying:";
"post_deact_silent_m" = "silently deleted his profile.";
"post_deact_silent_f" = "silently deleted her profile.";
"post_on_your_wall" = "on your wall";
"post_on_group_wall" = "in $1";
"post_on_user_wall" = "on $1's wall";
"wall" = "Wall";
"post" = "Post";
"write" = "Write";

View file

@ -162,6 +162,9 @@
"post_deact_f" = "удалила страницу со словами:";
"post_deact_silent_m" = "молча удалил свою страницу.";
"post_deact_silent_f" = "молча удалила свою страницу.";
"post_on_your_wall" = "на вашей стене";
"post_on_group_wall" = "в $1";
"post_on_user_wall" = "на стене $1";
"wall" = "Стена";
"post" = "Запись";
"write" = "Написать";