From a8de5d075f66e68f76124f7619a5e753a07559bd Mon Sep 17 00:00:00 2001 From: Christian Beutel <> Date: Sun, 24 Aug 2025 15:23:54 +0200 Subject: [PATCH] adds es, eu, ru translations --- db/migrations/1756041217_updated_settings.go | 78 +++++++++++++++++++ web/src/lib/i18n/index.ts | 3 + web/src/lib/i18n/locales/de.json | 2 + web/src/lib/i18n/locales/en.json | 2 + web/src/lib/i18n/locales/es.json | 2 + web/src/lib/i18n/locales/eu.json | 2 + web/src/lib/i18n/locales/fr.json | 2 + web/src/lib/i18n/locales/hu.json | 2 + web/src/lib/i18n/locales/it.json | 2 + web/src/lib/i18n/locales/nl.json | 2 + web/src/lib/i18n/locales/pl.json | 2 + web/src/lib/i18n/locales/pt.json | 2 + web/src/lib/i18n/locales/ru.json | 4 +- web/src/lib/i18n/locales/zh.json | 2 + web/src/lib/models/settings.ts | 2 + web/src/routes/settings/language/+page.svelte | 14 ++-- 16 files changed, 115 insertions(+), 8 deletions(-) create mode 100644 db/migrations/1756041217_updated_settings.go diff --git a/db/migrations/1756041217_updated_settings.go b/db/migrations/1756041217_updated_settings.go new file mode 100644 index 00000000..70e012b4 --- /dev/null +++ b/db/migrations/1756041217_updated_settings.go @@ -0,0 +1,78 @@ +package migrations + +import ( + "github.com/pocketbase/pocketbase/core" + m "github.com/pocketbase/pocketbase/migrations" +) + +func init() { + m.Register(func(app core.App) error { + collection, err := app.FindCollectionByNameOrId("uavt73rsqcn1n13") + if err != nil { + return err + } + + // update field + if err := collection.Fields.AddMarshaledJSONAt(1, []byte(`{ + "hidden": false, + "id": "0sepzvkh", + "maxSelect": 1, + "name": "language", + "presentable": false, + "required": false, + "system": false, + "type": "select", + "values": [ + "en", + "de", + "fr", + "hu", + "it", + "nl", + "pl", + "pt", + "zh", + "es", + "eu", + "ru" + ] + }`)); err != nil { + return err + } + + return app.Save(collection) + }, func(app core.App) error { + collection, err := app.FindCollectionByNameOrId("uavt73rsqcn1n13") + if err != nil { + return err + } + + // update field + if err := collection.Fields.AddMarshaledJSONAt(1, []byte(`{ + "hidden": false, + "id": "0sepzvkh", + "maxSelect": 1, + "name": "language", + "presentable": false, + "required": false, + "system": false, + "type": "select", + "values": [ + "en", + "de", + "fr", + "hu", + "it", + "nl", + "pl", + "pt", + "zh", + "es" + ] + }`)); err != nil { + return err + } + + return app.Save(collection) + }) +} diff --git a/web/src/lib/i18n/index.ts b/web/src/lib/i18n/index.ts index d87cf327..2109cf0a 100644 --- a/web/src/lib/i18n/index.ts +++ b/web/src/lib/i18n/index.ts @@ -6,12 +6,15 @@ const defaultLocale = 'en' register('en', () => import('./locales/en.json')) register('de', () => import('./locales/de.json')) +register('es', () => import('./locales/es.json')) +register('eu', () => import('./locales/eu.json')) register('fr', () => import('./locales/fr.json')) register('hu', () => import('./locales/hu.json')) register('it', () => import('./locales/it.json')) register('nl', () => import('./locales/nl.json')) register('pl', () => import('./locales/pl.json')) register('pt', () => import('./locales/pt.json')) +register('ru', () => import('./locales/ru.json')) register('zh', () => import('./locales/zh.json')) init({ diff --git a/web/src/lib/i18n/locales/de.json b/web/src/lib/i18n/locales/de.json index a5f2a704..17b601fc 100644 --- a/web/src/lib/i18n/locales/de.json +++ b/web/src/lib/i18n/locales/de.json @@ -56,6 +56,7 @@ "car": "Auto", "car-motorcycle": "Auto/Motorrad", "card": "{n, plural, =1 {Karte} other {Karten}}", + "catalan": "Katalanisch", "categories": "Kategorien", "category": "Kategorie", "change": "Ändern", @@ -335,6 +336,7 @@ "road": "Straße", "route": "{n, plural, =1 {Route} other {Routen}}", "route-point": "Punkt auf Route", + "russian": "", "save": "Speichern", "save-list": "Liste speichern", "save-trail": "Route speichern", diff --git a/web/src/lib/i18n/locales/en.json b/web/src/lib/i18n/locales/en.json index 94c82332..91004cb0 100644 --- a/web/src/lib/i18n/locales/en.json +++ b/web/src/lib/i18n/locales/en.json @@ -56,6 +56,7 @@ "car": "Car", "car-motorcycle": "Car/Motorcycle", "card": "{n, plural, =1 {Card} other {Cards}}", + "catalan": "Catalan", "categories": "Categories", "category": "Category", "change": "Change", @@ -335,6 +336,7 @@ "road": "Road", "route": "{n, plural, =1 {Route} other {Routes}}", "route-point": "Route Point", + "russian": "Russian", "save": "Save", "save-list": "Save List", "save-trail": "Save Trail", diff --git a/web/src/lib/i18n/locales/es.json b/web/src/lib/i18n/locales/es.json index 1c5580cf..15ab8c2d 100644 --- a/web/src/lib/i18n/locales/es.json +++ b/web/src/lib/i18n/locales/es.json @@ -56,6 +56,7 @@ "car": "Coche", "car-motorcycle": "Car/Motorcycle", "card": "{n, plural, one {}=1 {Ficha} other {Fichas}}", + "catalan": "", "categories": "Categorías", "category": "Categoría", "change": "Modificar", @@ -335,6 +336,7 @@ "road": "Carretera", "route": "{n, plural, =1 {Route} other {Routes}}", "route-point": "Route Point", + "russian": "", "save": "Guardar", "save-list": "Guardar Lista", "save-trail": "Guardar Ruta", diff --git a/web/src/lib/i18n/locales/eu.json b/web/src/lib/i18n/locales/eu.json index d8e720b6..c6b3398c 100644 --- a/web/src/lib/i18n/locales/eu.json +++ b/web/src/lib/i18n/locales/eu.json @@ -56,6 +56,7 @@ "car": "Kotxea", "car-motorcycle": "Kotxea/Motozikleta", "card": "{n, plural, one {}=1 {Txartea} other {Txartelak}}", + "catalan": "Catalan", "categories": "Kategoriak", "category": "Kategoria", "change": "Aldatu", @@ -336,6 +337,7 @@ "route": "{n, plural, one {}=1 {Ibilbidea} other {Ibilbideak}}", "route-point": "Ibilbideko puntua", "save": "Gorde", + "russian": "Russian", "save-list": "Gorde zerrenda", "save-trail": "Gorde ibilaldia", "save-your-trail-first": "Gorde zure ibilaldia lehenengo", diff --git a/web/src/lib/i18n/locales/fr.json b/web/src/lib/i18n/locales/fr.json index bac52305..c78ce7ce 100644 --- a/web/src/lib/i18n/locales/fr.json +++ b/web/src/lib/i18n/locales/fr.json @@ -56,6 +56,7 @@ "car": "Voiture", "car-motorcycle": "Car/Motorcycle", "card": "{n, plural, =1 {Tuile} other {Tuiles}}", + "catalan": "", "categories": "Catégories", "category": "Catégorie", "change": "Changement", @@ -335,6 +336,7 @@ "road": "Route", "route": "{n, plural, =1 {Itinéraire} other {Itinéraires}}", "route-point": "Étape", + "russian": "", "save": "Sauvegarder", "save-list": "Sauvegarder la liste", "save-trail": "Sauvegarder l'itinéraire", diff --git a/web/src/lib/i18n/locales/hu.json b/web/src/lib/i18n/locales/hu.json index a2af3482..85267c49 100644 --- a/web/src/lib/i18n/locales/hu.json +++ b/web/src/lib/i18n/locales/hu.json @@ -56,6 +56,7 @@ "car": "Car", "car-motorcycle": "Car/Motorcycle", "card": "{n, plural, =1 {Kártya} other {Kártyák}}", + "catalan": "", "categories": "Kategóriák", "category": "Kategória", "change": "Változás", @@ -335,6 +336,7 @@ "road": "Road", "route": "{n, plural, =1 {Route} other {Routes}}", "route-point": "Route Point", + "russian": "", "save": "Mentés", "save-list": "Save List", "save-trail": "Útvonal mentése", diff --git a/web/src/lib/i18n/locales/it.json b/web/src/lib/i18n/locales/it.json index d2b7ec34..a50006dd 100644 --- a/web/src/lib/i18n/locales/it.json +++ b/web/src/lib/i18n/locales/it.json @@ -56,6 +56,7 @@ "car": "Car", "car-motorcycle": "Car/Motorcycle", "card": "{n, plural, =1 {Carta} other {Carte}}", + "catalan": "", "categories": "Categorie", "category": "Categoria", "change": "Modifica", @@ -335,6 +336,7 @@ "road": "Road", "route": "{n, plural, =1 {Route} other {Routes}}", "route-point": "Route Point", + "russian": "", "save": "Salva", "save-list": "Salta Lista", "save-trail": "Salva percorso", diff --git a/web/src/lib/i18n/locales/nl.json b/web/src/lib/i18n/locales/nl.json index 301f7e3d..31875c9b 100644 --- a/web/src/lib/i18n/locales/nl.json +++ b/web/src/lib/i18n/locales/nl.json @@ -56,6 +56,7 @@ "car": "Wagen", "car-motorcycle": "Car/Motorcycle", "card": "{n, plural, =1 {Kaart} other {Kaarten}}", + "catalan": "", "categories": "Categorieën", "category": "Categorie", "change": "Wijzigen", @@ -335,6 +336,7 @@ "road": "Weg", "route": "{n, plural,=1 {Tocht} other {Tochten}}", "route-point": "Routepunt", + "russian": "", "save": "Bewaren", "save-list": "Bewaar lijst", "save-trail": "Bewaar Route", diff --git a/web/src/lib/i18n/locales/pl.json b/web/src/lib/i18n/locales/pl.json index eb5dbc85..a0573380 100644 --- a/web/src/lib/i18n/locales/pl.json +++ b/web/src/lib/i18n/locales/pl.json @@ -56,6 +56,7 @@ "car": "Samochód", "car-motorcycle": "Car/Motorcycle", "card": "{n, plural, =1 {Karta} other {Karty}}", + "catalan": "", "categories": "Kategorie", "category": "Kategoria", "change": "Zmień", @@ -335,6 +336,7 @@ "road": "Droga", "route": "{n, plural,=1 {Trasa} other {Trasy}}", "route-point": "Punkt trasy", + "russian": "", "save": "Zapisz", "save-list": "Zapisz listę", "save-trail": "Zapisz szlak", diff --git a/web/src/lib/i18n/locales/pt.json b/web/src/lib/i18n/locales/pt.json index 6b6187f9..24af1b04 100644 --- a/web/src/lib/i18n/locales/pt.json +++ b/web/src/lib/i18n/locales/pt.json @@ -56,6 +56,7 @@ "car": "Car", "car-motorcycle": "Car/Motorcycle", "card": "{n, plural, =1 {Cartão} other {Cartões}}", + "catalan": "", "categories": "Categorias", "category": "Categoria", "change": "Alterar", @@ -335,6 +336,7 @@ "road": "Road", "route": "{n, plural, =1 {Route} other {Routes}}", "route-point": "Route Point", + "russian": "", "save": "Guardar", "save-list": "Gravar lista", "save-trail": "Guardar trilho", diff --git a/web/src/lib/i18n/locales/ru.json b/web/src/lib/i18n/locales/ru.json index 3302a74e..3b67bac8 100644 --- a/web/src/lib/i18n/locales/ru.json +++ b/web/src/lib/i18n/locales/ru.json @@ -56,6 +56,7 @@ "car": "Автомобиль:", "car-motorcycle": "Car/Motorcycle", "card": "{n, plural, =1 {Карточка} other {Карточки}}", + "catalan": "Catalan", "categories": "Категории", "category": "Категория", "change": "Изменить", @@ -337,6 +338,7 @@ "route-point": "Точка маршрута", "save": "Сохранить", "save-list": "Сохранить список", + "russian": "Russian", "save-trail": "Сохранить трек", "save-your-trail-first": "Сначала сохраните трек", "search-cities": "Поиск по городам", @@ -423,4 +425,4 @@ "width": "Ширина", "wrong-username-or-password": "Неверный логин или пароль", "you-can": "Вы можете" -} +} \ No newline at end of file diff --git a/web/src/lib/i18n/locales/zh.json b/web/src/lib/i18n/locales/zh.json index 5d669b29..022a9982 100644 --- a/web/src/lib/i18n/locales/zh.json +++ b/web/src/lib/i18n/locales/zh.json @@ -56,6 +56,7 @@ "car": "汽车", "car-motorcycle": "汽车/摩托车", "card": "{n, plural, =1 {卡片} other {卡片}}", + "catalan": "", "categories": "分类", "category": "分类", "change": "更换", @@ -335,6 +336,7 @@ "road": "道路", "route": "{n, plural, =1 {Route} other {Routes}}", "route-point": "路线点", + "russian": "", "save": "保存", "save-list": "保存列表", "save-trail": "保存路线", diff --git a/web/src/lib/models/settings.ts b/web/src/lib/models/settings.ts index 34e093c5..a4bd4f9b 100644 --- a/web/src/lib/models/settings.ts +++ b/web/src/lib/models/settings.ts @@ -4,12 +4,14 @@ export enum Language { en = "en", de = "de", es = "es", + eu = "eu", fr = "fr", hu = "hu", it = "it", nl = "nl", pl = "pl", pt = "pt", + ru = "ru", zh = "zh" } diff --git a/web/src/routes/settings/language/+page.svelte b/web/src/routes/settings/language/+page.svelte index 99a34e45..2d9e62bc 100644 --- a/web/src/routes/settings/language/+page.svelte +++ b/web/src/routes/settings/language/+page.svelte @@ -8,21 +8,23 @@ } from "$lib/components/base/select.svelte"; import type { Language } from "$lib/models/settings"; import { settings_update } from "$lib/stores/settings_store"; - import { _, locale } from "svelte-i18n"; + import { _ } from "svelte-i18n"; const settings = page.data.settings; const languages: SelectItem[] = [ - { text: $_("chinese"), value: "zh" }, - { text: $_("german"), value: "de" }, { text: $_("english"), value: "en" }, + { text: $_("german"), value: "de" }, { text: $_("spanish"), value: "es" }, + { text: $_("catalan"), value: "eu" }, { text: $_("french"), value: "fr" }, { text: $_("hungarian"), value: "hu" }, { text: $_("italian"), value: "it" }, { text: $_("dutch"), value: "nl" }, { text: $_("polish"), value: "pl" }, { text: $_("portuguese"), value: "pt" }, + { text: $_("russian"), value: "ru" }, + { text: $_("chinese"), value: "zh" }, ]; const units: RadioItem[] = [ @@ -32,9 +34,7 @@ let selectedLanguage = $state(settings?.language ?? "en"); - async function handleLanguageSelection( - value: Language, - ) { + async function handleLanguageSelection(value: Language) { await settings_update({ id: settings!.id, language: value, @@ -67,4 +67,4 @@ items={units} selected={settings?.unit == "metric" ? 0 : 1} onchange={handleUnitSelection} -> \ No newline at end of file +>