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); <?php declare(strict_types=1);
namespace openvk\Web\Models\Entities; namespace openvk\Web\Models\Entities;
use Chandler\Database\DatabaseConnection as DB; 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\RowModel;
use openvk\Web\Models\Entities\Notifications\LikeNotification; use openvk\Web\Models\Entities\Notifications\LikeNotification;
@ -55,6 +55,15 @@ class Post extends Postable
{ {
return $this->getRecord()->wall; 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 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"> <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->isDeactivationMessage() ? ($author->isFemale() ? tr($deac . "_f") : tr($deac . "_m"))}
{if ($onWallOf ?? false) &&!$post->isPostedOnBehalfOfGroup() && $post->getOwnerPost() !== $post->getTargetWall()} {if ($onWallOf ?? false) &&!$post->isPostedOnBehalfOfGroup() && $post->getOwnerPost() !== $post->getTargetWall()}
{var $wallId = $post->getTargetWall()} {var $wallOwner = $post->getWallOwner()}
{var $wallURL = $wallId > -1 ? "/id$wallId" : "/club" . abs($wallId)} <a href="{$wallOwner->getURL()}">
на
<a href="{$wallURL}">
<b> <b>
{if isset($thisUser) && $thisUser->getId() === $wallId} {if isset($thisUser) && $thisUser->getId() === $post->getTargetWall()}
вашей {_post_on_your_wall}
{/if} {elseif $wallOwner instanceof \openvk\Web\Models\Entities\Club}
стене {tr("post_on_group_wall", ovk_proc_strtr($wallOwner->getName(), 52))}
{if $wallId < 0} {else}
группы {tr("post_on_user_wall", $wallOwner->getMorphedName("genitive", false))}
{/if} {/if}
</b> </b>
</a> </a>

View file

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

View file

@ -154,6 +154,9 @@
"post_deact_f" = "deleted her profile saying:"; "post_deact_f" = "deleted her profile saying:";
"post_deact_silent_m" = "silently deleted his profile."; "post_deact_silent_m" = "silently deleted his profile.";
"post_deact_silent_f" = "silently deleted her 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"; "wall" = "Wall";
"post" = "Post"; "post" = "Post";
"write" = "Write"; "write" = "Write";

View file

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