Wall: geotag translation

This commit is contained in:
veselcraft 2023-08-03 23:48:03 +03:00
parent a5f1433207
commit 0262da5a81
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E
6 changed files with 27 additions and 11 deletions

View file

@ -298,7 +298,7 @@ final class WallPresenter extends OpenVKPresenter
if (!is_null($this->postParam("geo")) && $this->postParam("geo") != "none") {
$geo = json_decode($this->postParam("geo"), true, JSON_UNESCAPED_UNICODE);
if (!$geo["lat"] || !$geo["lng"] || !$geo["name"]) {
$this->flashFail("err", tr("error"), "Ошибка при прикреплении геометки");
$this->flashFail("err", tr("error"), tr("error_geolocation"));
}
}
@ -508,7 +508,7 @@ final class WallPresenter extends OpenVKPresenter
$lon = $post->getLon();
if (!$lat || !$lon)
$this->returnJson(["success" => false, "error" => "У поста не указана гео-метка"]);
$this->returnJson(["success" => false, "error" => tr("error_no_geotag")]);
$query = file_get_contents(__DIR__ . "/../Models/sql/get-nearest-posts.tsql");
$_posts = DatabaseConnection::i()->getContext()->query($query, $lat, $lon, $post->getId())->fetchAll();

View file

@ -75,7 +75,7 @@
</div>
<div n:if="$post->getGeo()" style="padding: 4px;">
<div style="border-bottom: #ECECEC solid 1px;" />
<div style="cursor: pointer; padding: 4px;" onclick="javascript:openGeo({$post->getGeo()}, {$post->getOwner()->getId()}, {$post->getVirtualId()})"><b>Геометка</b>: {$post->getGeo()->name}</div>
<div style="cursor: pointer; padding: 4px;" onclick="javascript:openGeo({$post->getGeo()}, {$post->getOwner()->getId()}, {$post->getVirtualId()})"><b>{_geotag}</b>: {$post->getGeo()->name}</div>
</div>
<div n:if="$post->isAd()" style="color:grey;">
<br/>

View file

@ -69,7 +69,7 @@
</div>
<div n:if="$post->getGeo()" style="padding: 4px;">
<div style="border-bottom: #ECECEC solid 1px;" />
<div style="cursor: pointer; padding: 4px;" onclick="javascript:openGeo({$post->getGeo()}, {$post->getOwner()->getId()}, {$post->getVirtualId()})"><b>Геометка</b>: {$post->getGeo()->name}</div>
<div style="cursor: pointer; padding: 4px;" onclick="javascript:openGeo({$post->getGeo()}, {$post->getOwner()->getId()}, {$post->getVirtualId()})"><b>{_geotag}</b>: {$post->getGeo()->name}</div>
</div>
<div n:if="$post->isAd()" style="color:grey;">
<br/>

View file

@ -265,14 +265,14 @@ async function showArticle(note_id) {
}
async function initGeo(tid) {
MessageBox("Прикрепить геометку", "<div id=\"osm-map\"></div>", ["Прикрепить", "Отмена"], [(function () {
MessageBox(tr("attach_geotag"), "<div id=\"osm-map\"></div>", ["Прикрепить", tr("cancel")], [(function () {
let marker = {
lat: currentMarker._latlng.lat,
lng: currentMarker._latlng.lng,
name: currentMarker._popup._content
};
$(`#post-buttons${tid} #geo`).val(JSON.stringify(marker));
$(`#post-buttons${tid} .post-has-geo`).text(`Геометка: ${marker.name}`);
$(`#post-buttons${tid} .post-has-geo`).text(`${tr("geotag")}: ${marker.name}`);
$(`#post-buttons${tid} .post-has-geo`).show();
}), Function.noop]);
@ -323,8 +323,8 @@ async function initGeo(tid) {
currentMarker = L.marker([lat, lng]).addTo(map);
currentMarker.bindPopup(name).openPopup();
console.log("Широта: " + lat + ", Долгота: " + lng);
console.log("Название места: " + name);
console.log(`${tr("latitude")}: ${lat}, ${tr("longitude")}: ${lng}`);
console.log(`${tr("name_of_the_place")}: ${name}`);
let marker = {
lat: lat,
@ -343,7 +343,7 @@ async function initGeo(tid) {
}
function openGeo(data, owner_id, virtual_id) {
MessageBox("Геометка", "<div id=\"osm-map\"></div>", ["Ближайшие посты", "OK"], [(function () {
MessageBox(tr("geotag"), "<div id=\"osm-map\"></div>", [tr("nearest_posts"), "OK"], [(function () {
getNearPosts(owner_id, virtual_id);
}), Function.noop]);
@ -372,7 +372,7 @@ function getNearPosts(owner_id, virtual_id) {
if (response.success) {
openNearPosts(response);
} else {
MessageBox("Ошибка", "Произошла ошибка в ходе запроса:" + (response?.error ?? "Неизвестная ошибка"), ["OK"], [Function.noop]);
MessageBox(tr("error"), `${tr("error_segmentation")}: ${(response?.error ?? "Unknown error")}`, ["OK"], [Function.noop]);
}
}
});
@ -408,7 +408,7 @@ function openNearPosts(posts) {
</div>
<div style="padding: 4px;">
<div style="border-bottom: #ECECEC solid 1px;"></div>
<div style="cursor: pointer; padding: 4px;"><b>Геометка</b>: ${post.geo.name}</div>
<div style="cursor: pointer; padding: 4px;"><b>${tr("geotag")}</b>: ${post.geo.name}</div>
</div>
</div>
</td>

View file

@ -204,6 +204,7 @@
"attach" = "Attach";
"attach_photo" = "Attach photo";
"attach_video" = "Attach video";
"attach_geotag" = "Attach geotag";
"draw_graffiti" = "Draw graffiti";
"no_posts_abstract" = "Nobody wrote anything here... So far.";
"attach_no_longer_available" = "This attachment is no longer available.";
@ -213,6 +214,11 @@
"graffiti" = "Graffiti";
"reply" = "Reply";
"geotag" = "Geotag";
"nearest_posts" = "Nearest posts";
"Latitude" = "Latitude";
"longitude" = "Longitude";
"name_of_the_place" = "Name of the place";
/* Friends */
@ -1100,6 +1106,8 @@
"media_file_corrupted_or_too_large" = "The media content file is corrupted or too large.";
"post_is_empty_or_too_big" = "The post is empty or too big.";
"post_is_too_big" = "The post is too big.";
"error_geolocation" = "Error while trying to pin geolocation";
"error_no_geotag" = "There is no geo-tag pinned in this post";
/* Admin actions */

View file

@ -184,6 +184,7 @@
"attach" = "Прикрепить";
"attach_photo" = "Прикрепить фото";
"attach_video" = "Прикрепить видео";
"attach_geotag" = "Прикрепить геометку";
"draw_graffiti" = "Нарисовать граффити";
"no_posts_abstract" = "Здесь никто ничего не написал... Пока.";
"attach_no_longer_available" = "Это вложение больше недоступно.";
@ -191,6 +192,11 @@
"version_incompatibility" = "Не удалось отобразить это вложение. Возможно, база данных несовместима с текущей версией OpenVK.";
"graffiti" = "Граффити";
"reply" = "Ответить";
"geotag" = "Геоточка";
"nearest_posts" = "Ближайшие посты";
"Latitude" = "Широта";
"longitude" = "Долгота";
"name_of_the_place" = "Название места";
/* Friends */
@ -1000,6 +1006,8 @@
"media_file_corrupted_or_too_large" = "Файл медиаконтента повреждён или слишком велик.";
"post_is_empty_or_too_big" = "Пост пустой или слишком большой.";
"post_is_too_big" = "Пост слишком большой.";
"error_geolocation" = "Ошибка при прикреплении геометки";
"error_no_geotag" = "У поста не указана гео-метка";
/* Admin actions */