mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-12-23 14:48:14 -05:00
Misc. Bug fixes and Translation Improvments (#926)
* Fixes [BUG] Editing a location removes it from all the collections Fixes #893 * Add new translations for Chinese and Ukrainian locales - Updated zh.json to include new keys: "about_country", "about_region", "show_less", and "show_more". - Registered Ukrainian locale in +layout.svelte and added it to the locales array. * Update translation for 'back' in Dutch locale (#917) --------- Co-authored-by: Sille Van Landschoot <979071+sillevl@users.noreply.github.com>
This commit is contained in:
@@ -66,6 +66,7 @@
|
||||
'pt-br': 'Português (Brasil)',
|
||||
sk: 'Slovenský',
|
||||
tr: 'Türkçe',
|
||||
uk: 'Українська',
|
||||
hu: 'Magyar'
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import { MapLibre, Marker, MapEvents } from 'svelte-maplibre';
|
||||
import { number, t } from 'svelte-i18n';
|
||||
import { t } from 'svelte-i18n';
|
||||
import { getBasemapUrl } from '$lib';
|
||||
import CategoryDropdown from '../CategoryDropdown.svelte';
|
||||
import type { Collection, Location } from '$lib/types';
|
||||
@@ -14,11 +14,7 @@
|
||||
import ClearIcon from '~icons/mdi/close';
|
||||
import PinIcon from '~icons/mdi/map-marker';
|
||||
import InfoIcon from '~icons/mdi/information';
|
||||
import StarIcon from '~icons/mdi/star';
|
||||
import LinkIcon from '~icons/mdi/link';
|
||||
import TextIcon from '~icons/mdi/text';
|
||||
import CategoryIcon from '~icons/mdi/tag';
|
||||
import PublicIcon from '~icons/mdi/earth';
|
||||
import GenerateIcon from '~icons/mdi/lightning-bolt';
|
||||
import ArrowLeftIcon from '~icons/mdi/arrow-left';
|
||||
import SaveIcon from '~icons/mdi/content-save';
|
||||
@@ -323,14 +319,27 @@
|
||||
location.collections = [collection.id];
|
||||
}
|
||||
|
||||
// either a post or a patch depending on whether we're editing or creating
|
||||
// Build payload and avoid sending an empty `collections` array when editing
|
||||
const payload: any = { ...location };
|
||||
|
||||
// If we're editing and the original location had collections, but the form's collections
|
||||
// is empty (i.e. user didn't modify collections), omit collections from payload so the
|
||||
// server doesn't clear them unintentionally.
|
||||
if (locationToEdit && locationToEdit.id) {
|
||||
if (
|
||||
(!payload.collections || payload.collections.length === 0) &&
|
||||
locationToEdit.collections &&
|
||||
locationToEdit.collections.length > 0
|
||||
) {
|
||||
delete payload.collections;
|
||||
}
|
||||
|
||||
let res = await fetch(`/api/locations/${locationToEdit.id}`, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(location)
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
let updatedLocation = await res.json();
|
||||
location = updatedLocation;
|
||||
@@ -340,7 +349,7 @@
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(location)
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
let newLocation = await res.json();
|
||||
location = newLocation;
|
||||
@@ -403,6 +412,21 @@
|
||||
location.tags = initialLocation.tags;
|
||||
}
|
||||
|
||||
// Preserve existing collections when editing so we don't accidentally send an empty array
|
||||
if (initialLocation.collections && Array.isArray(initialLocation.collections)) {
|
||||
location.collections = initialLocation.collections.map((c: any) =>
|
||||
typeof c === 'string' ? c : c.id
|
||||
);
|
||||
} else if (
|
||||
locationToEdit &&
|
||||
locationToEdit.collections &&
|
||||
Array.isArray(locationToEdit.collections)
|
||||
) {
|
||||
location.collections = locationToEdit.collections.map((c: any) =>
|
||||
typeof c === 'string' ? c : c.id
|
||||
);
|
||||
}
|
||||
|
||||
if (initialLocation.location) {
|
||||
location.location = initialLocation.location;
|
||||
}
|
||||
|
||||
@@ -1034,6 +1034,10 @@
|
||||
"spin_again": "تدور مرة أخرى",
|
||||
"spinning_globe": "كرة الغزل",
|
||||
"try_again": "حاول ثانية",
|
||||
"your_random_adventure_awaits": "مغامرتك العشوائية تنتظر!"
|
||||
"your_random_adventure_awaits": "مغامرتك العشوائية تنتظر!",
|
||||
"about_country": "حول البلد",
|
||||
"about_region": "حول المنطقة",
|
||||
"show_less": "عرض أقل",
|
||||
"show_more": "عرض المزيد"
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -553,7 +553,8 @@
|
||||
"no_globe_spin_data": "No Globe Spin Data",
|
||||
"show_less": "Show Less",
|
||||
"show_more": "Show More",
|
||||
"about_country": "About Country"
|
||||
"about_country": "About Country",
|
||||
"about_region": "About Region"
|
||||
},
|
||||
"auth": {
|
||||
"username": "Username",
|
||||
|
||||
@@ -549,7 +549,11 @@
|
||||
"spin_again": "Girar de nuevo",
|
||||
"spinning_globe": "Globo hilado",
|
||||
"try_again": "Intentar otra vez",
|
||||
"your_random_adventure_awaits": "¡Tu aventura aleatoria te espera!"
|
||||
"your_random_adventure_awaits": "¡Tu aventura aleatoria te espera!",
|
||||
"about_country": "Acerca del país",
|
||||
"about_region": "Acerca de la región",
|
||||
"show_less": "Mostrar menos",
|
||||
"show_more": "Mostrar más"
|
||||
},
|
||||
"auth": {
|
||||
"forgot_password": "¿Has olvidado tu contraseña?",
|
||||
|
||||
@@ -578,7 +578,11 @@
|
||||
"spin_again": "Remonter",
|
||||
"spinning_globe": "Globe de rotation",
|
||||
"try_again": "Essayer à nouveau",
|
||||
"your_random_adventure_awaits": "Votre aventure aléatoire vous attend!"
|
||||
"your_random_adventure_awaits": "Votre aventure aléatoire vous attend!",
|
||||
"about_country": "À propos du pays",
|
||||
"about_region": "À propos de la région",
|
||||
"show_less": "Afficher moins",
|
||||
"show_more": "Afficher plus"
|
||||
},
|
||||
"settings": {
|
||||
"account_settings": "Paramètres du compte utilisateur",
|
||||
|
||||
@@ -550,7 +550,11 @@
|
||||
"spin_again": "Forgatás újra",
|
||||
"globe_spin_error_desc": "Hiba történt a földgömb adatainak lekérésekor",
|
||||
"try_again": "Próbáld újra",
|
||||
"no_globe_spin_data": "Nincsenek földgömb adatok"
|
||||
"no_globe_spin_data": "Nincsenek földgömb adatok",
|
||||
"about_country": "Országról",
|
||||
"about_region": "A régióról",
|
||||
"show_less": "Mutass kevesebbet",
|
||||
"show_more": "Továbbiak megjelenítése"
|
||||
},
|
||||
"auth": {
|
||||
"username": "Felhasználónév",
|
||||
@@ -789,36 +793,36 @@
|
||||
"add_your_first_item": "Add hozzá az első elemedet"
|
||||
},
|
||||
"transportation": {
|
||||
"transportation_deleted": "Szállítás sikeresen törölve!",
|
||||
"transportation_delete_error": "Hiba a szállítás törlésekor",
|
||||
"type": "Típus",
|
||||
"new_transportation": "Új szállítás",
|
||||
"flight_number": "Járatszám",
|
||||
"from_location": "Kiindulási hely",
|
||||
"to_location": "Célállomás",
|
||||
"fetch_location_information": "Helyszíninformáció lekérése",
|
||||
"starting_airport_desc": "Add meg a kiindulási repülőtér kódját (pl.: JFK)",
|
||||
"ending_airport_desc": "Add meg a cél repülőtér kódját (pl.: LAX)",
|
||||
"edit": "Szerkesztés",
|
||||
"modes": {
|
||||
"car": "Autó",
|
||||
"plane": "Repülő",
|
||||
"train": "Vonat",
|
||||
"bus": "Busz",
|
||||
"boat": "Hajó",
|
||||
"bike": "Kerékpár",
|
||||
"walking": "Gyalog",
|
||||
"other": "Egyéb"
|
||||
},
|
||||
"edit_transportation": "Szállítás szerkesztése",
|
||||
"update_transportation_details": "Szállítási adatok frissítése",
|
||||
"create_new_transportation": "Új szállítás létrehozása",
|
||||
"enter_transportation_name": "Add meg a szállítás nevét",
|
||||
"select_type": "Válassz típust",
|
||||
"enter_link": "Adj meg egy hivatkozást",
|
||||
"enter_flight_number": "Add meg a járatszámot",
|
||||
"enter_from_location": "Add meg a kiindulási helyet",
|
||||
"enter_to_location": "Add meg a célállomást"
|
||||
"transportation_deleted": "Szállítás sikeresen törölve!",
|
||||
"transportation_delete_error": "Hiba a szállítás törlésekor",
|
||||
"type": "Típus",
|
||||
"new_transportation": "Új szállítás",
|
||||
"flight_number": "Járatszám",
|
||||
"from_location": "Kiindulási hely",
|
||||
"to_location": "Célállomás",
|
||||
"fetch_location_information": "Helyszíninformáció lekérése",
|
||||
"starting_airport_desc": "Add meg a kiindulási repülőtér kódját (pl.: JFK)",
|
||||
"ending_airport_desc": "Add meg a cél repülőtér kódját (pl.: LAX)",
|
||||
"edit": "Szerkesztés",
|
||||
"modes": {
|
||||
"car": "Autó",
|
||||
"plane": "Repülő",
|
||||
"train": "Vonat",
|
||||
"bus": "Busz",
|
||||
"boat": "Hajó",
|
||||
"bike": "Kerékpár",
|
||||
"walking": "Gyalog",
|
||||
"other": "Egyéb"
|
||||
},
|
||||
"edit_transportation": "Szállítás szerkesztése",
|
||||
"update_transportation_details": "Szállítási adatok frissítése",
|
||||
"create_new_transportation": "Új szállítás létrehozása",
|
||||
"enter_transportation_name": "Add meg a szállítás nevét",
|
||||
"select_type": "Válassz típust",
|
||||
"enter_link": "Adj meg egy hivatkozást",
|
||||
"enter_flight_number": "Add meg a járatszámot",
|
||||
"enter_from_location": "Add meg a kiindulási helyet",
|
||||
"enter_to_location": "Add meg a célállomást"
|
||||
},
|
||||
"lodging": {
|
||||
"new_lodging": "Új szállás",
|
||||
|
||||
@@ -579,7 +579,11 @@
|
||||
"spin_again": "Girare di nuovo",
|
||||
"spinning_globe": "Globe rotante",
|
||||
"try_again": "Riprova",
|
||||
"your_random_adventure_awaits": "La tua avventura casuale ti aspetta!"
|
||||
"your_random_adventure_awaits": "La tua avventura casuale ti aspetta!",
|
||||
"about_country": "Informazioni sul paese",
|
||||
"about_region": "A proposito di Regione",
|
||||
"show_less": "Mostra meno",
|
||||
"show_more": "Mostra altro"
|
||||
},
|
||||
"settings": {
|
||||
"account_settings": "Impostazioni dell'account utente",
|
||||
|
||||
@@ -1034,6 +1034,10 @@
|
||||
"spin_again": "もう一度スピンします",
|
||||
"spinning_globe": "スピニンググローブ",
|
||||
"try_again": "もう一度やり直してください",
|
||||
"your_random_adventure_awaits": "あなたのランダムな冒険が待っています!"
|
||||
"your_random_adventure_awaits": "あなたのランダムな冒険が待っています!",
|
||||
"about_country": "国について",
|
||||
"about_region": "地域について",
|
||||
"show_less": "表示を減らす",
|
||||
"show_more": "もっと見る"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -959,7 +959,11 @@
|
||||
"try_again": "다시 시도하십시오",
|
||||
"your_random_adventure_awaits": "당신의 임의의 모험이 기다리고 있습니다!",
|
||||
"cities_available": "이용 가능",
|
||||
"destination_revealed": "목적지 공개!"
|
||||
"destination_revealed": "목적지 공개!",
|
||||
"about_country": "국가 소개",
|
||||
"about_region": "지역정보",
|
||||
"show_less": "간략히 표시",
|
||||
"show_more": "더보기"
|
||||
},
|
||||
"lodging": {
|
||||
"apartment": "아파트",
|
||||
|
||||
@@ -291,7 +291,7 @@
|
||||
"average_cadence": "Gemiddelde cadans",
|
||||
"average_speed": "Gemiddelde snelheid",
|
||||
"avg_speed": "Gemiddelde snelheid",
|
||||
"back": "Rug",
|
||||
"back": "Terug",
|
||||
"cadence": "Cadans",
|
||||
"calories": "Calorieën",
|
||||
"click_map": "Klik op de kaart om een locatie te selecteren",
|
||||
@@ -579,7 +579,11 @@
|
||||
"spin_again": "Weer spinnen",
|
||||
"spinning_globe": "Spinnende bol",
|
||||
"try_again": "Probeer het opnieuw",
|
||||
"your_random_adventure_awaits": "Je willekeurige avontuur wacht!"
|
||||
"your_random_adventure_awaits": "Je willekeurige avontuur wacht!",
|
||||
"about_country": "Over land",
|
||||
"about_region": "Over Regio",
|
||||
"show_less": "Toon minder",
|
||||
"show_more": "Toon meer"
|
||||
},
|
||||
"settings": {
|
||||
"account_settings": "Gebruikersaccount instellingen",
|
||||
|
||||
@@ -549,7 +549,11 @@
|
||||
"spin_again": "Spinn igjen",
|
||||
"spinning_globe": "Spinnende klode",
|
||||
"try_again": "Prøv igjen",
|
||||
"your_random_adventure_awaits": "Ditt tilfeldige eventyr venter!"
|
||||
"your_random_adventure_awaits": "Ditt tilfeldige eventyr venter!",
|
||||
"about_country": "Om landet",
|
||||
"about_region": "Om regionen",
|
||||
"show_less": "Vis mindre",
|
||||
"show_more": "Vis mer"
|
||||
},
|
||||
"auth": {
|
||||
"username": "Brukernavn",
|
||||
|
||||
@@ -550,7 +550,11 @@
|
||||
"spin_again": "Obrócić ponownie",
|
||||
"spinning_globe": "Spinning Globe",
|
||||
"try_again": "Spróbuj ponownie",
|
||||
"your_random_adventure_awaits": "Twoja przypadkowa przygoda czeka!"
|
||||
"your_random_adventure_awaits": "Twoja przypadkowa przygoda czeka!",
|
||||
"about_country": "O kraju",
|
||||
"about_region": "O Regionie",
|
||||
"show_less": "Pokaż mniej",
|
||||
"show_more": "Pokaż więcej"
|
||||
},
|
||||
"auth": {
|
||||
"username": "Nazwa użytkownika",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -550,7 +550,11 @@
|
||||
"spin_again": "Снова спите",
|
||||
"spinning_globe": "Вращающийся глобус",
|
||||
"try_again": "Попробуйте еще раз",
|
||||
"your_random_adventure_awaits": "Ваше случайное приключение ждет!"
|
||||
"your_random_adventure_awaits": "Ваше случайное приключение ждет!",
|
||||
"about_country": "О стране",
|
||||
"about_region": "О регионе",
|
||||
"show_less": "Показать меньше",
|
||||
"show_more": "Показать больше"
|
||||
},
|
||||
"auth": {
|
||||
"username": "Имя пользователя",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -549,7 +549,11 @@
|
||||
"spin_again": "Snurra igen",
|
||||
"spinning_globe": "Snurrande jordklot",
|
||||
"try_again": "Försök igen",
|
||||
"your_random_adventure_awaits": "Ditt slumpmässiga äventyr väntar!"
|
||||
"your_random_adventure_awaits": "Ditt slumpmässiga äventyr väntar!",
|
||||
"about_country": "Om Country",
|
||||
"about_region": "Om regionen",
|
||||
"show_less": "Visa mindre",
|
||||
"show_more": "Visa mer"
|
||||
},
|
||||
"auth": {
|
||||
"confirm_password": "Bekräfta lösenord",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -576,7 +576,11 @@
|
||||
"spin_again": "再次旋转",
|
||||
"spinning_globe": "旋转地球",
|
||||
"try_again": "再试一次",
|
||||
"your_random_adventure_awaits": "您的随机冒险在等待!"
|
||||
"your_random_adventure_awaits": "您的随机冒险在等待!",
|
||||
"about_country": "关于国家",
|
||||
"about_region": "关于地区",
|
||||
"show_less": "显示较少",
|
||||
"show_more": "显示更多"
|
||||
},
|
||||
"users": {
|
||||
"no_users_found": "未找到已公开的用户。"
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
register('pt-br', () => import('../locales/pt-br.json'));
|
||||
register('sk', () => import('../locales/sk.json'));
|
||||
register('tr', () => import('../locales/tr.json'));
|
||||
register('uk', () => import('../locales/uk.json'));
|
||||
register('hu', () => import('../locales/hu.json'));
|
||||
|
||||
let locales = [
|
||||
@@ -42,6 +43,7 @@
|
||||
'pt-br',
|
||||
'sk',
|
||||
'tr',
|
||||
'uk',
|
||||
'hu'
|
||||
];
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
import ChevronDown from '~icons/mdi/chevron-down';
|
||||
import ChevronUp from '~icons/mdi/chevron-up';
|
||||
|
||||
let measurementSystem = data.user?.measurement_system || 'metric';
|
||||
let measurementSystem: string = 'metric';
|
||||
let expandedCategories = new Set();
|
||||
|
||||
let stats: {
|
||||
@@ -87,10 +87,16 @@
|
||||
activity_elevation: number;
|
||||
} | null;
|
||||
|
||||
const user: User = data.user;
|
||||
const adventures: Location[] = data.adventures;
|
||||
const collections: Collection[] = data.collections;
|
||||
stats = data.stats || null;
|
||||
let user: User = data.user;
|
||||
let adventures: Location[] = data.adventures;
|
||||
let collections: Collection[] = data.collections;
|
||||
|
||||
// Keep values reactive when `data` changes (client navigation between params)
|
||||
$: user = data.user;
|
||||
$: adventures = data.adventures;
|
||||
$: collections = data.collections;
|
||||
$: measurementSystem = data.user?.measurement_system || 'metric';
|
||||
$: stats = data.stats || null;
|
||||
|
||||
// Activity category configurations
|
||||
const categoryConfig: Record<
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import ImmichLogo from '$lib/assets/immich.svg';
|
||||
import GoogleMapsLogo from '$lib/assets/google_maps.svg';
|
||||
import StravaLogo from '$lib/assets/strava.svg';
|
||||
import WandererLogo from '$lib/assets/wanderer.svg';
|
||||
import WandererLogoSrc from '$lib/assets/wanderer.svg';
|
||||
|
||||
export let data;
|
||||
console.log(data);
|
||||
@@ -1129,12 +1129,9 @@
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="p-6 bg-base-200 rounded-xl">
|
||||
<div class="p-6 bg-base-200 rounded-xl mb-4">
|
||||
<div class="flex items-center gap-4 mb-4">
|
||||
<div
|
||||
class="w-8 h-8 rounded-md bg-base-content"
|
||||
style="mask: url({WandererLogo}) no-repeat center; mask-size: contain; -webkit-mask: url({WandererLogo}) no-repeat center; -webkit-mask-size: contain;"
|
||||
></div>
|
||||
<img src={WandererLogoSrc} alt="Wanderer" class="w-8 h-8" />
|
||||
<div>
|
||||
<h3 class="text-xl font-bold">Wanderer</h3>
|
||||
<p class="text-sm text-base-content/70">
|
||||
|
||||
@@ -252,7 +252,7 @@
|
||||
<div class="card-body p-4">
|
||||
<div class="flex items-center gap-2 mb-4">
|
||||
<Info class="w-5 h-5 text-primary" />
|
||||
<h2 class="text-lg font-semibold">{$t('worldtravel.about_country')}</h2>
|
||||
<h2 class="text-lg font-semibold">{$t('worldtravel.about_region')}</h2>
|
||||
</div>
|
||||
<p
|
||||
class="text-base-content/70 leading-relaxed"
|
||||
|
||||
Reference in New Issue
Block a user