From 38858bde95dc20235965ebfb8374e96877a9fe6e Mon Sep 17 00:00:00 2001 From: Christian Beutel <> Date: Wed, 27 Mar 2024 13:04:50 +0100 Subject: [PATCH] adds dutch, portugese & polnish i18n --- db/migrations/1711538388_updated_users.go | 75 ++++++++++++++ web/src/lib/i18n/index.ts | 3 + web/src/lib/i18n/locales/de.json | 4 + web/src/lib/i18n/locales/en.json | 4 + web/src/lib/i18n/locales/nl.json | 118 ++++++++++++++++++++++ web/src/lib/i18n/locales/pl.json | 118 ++++++++++++++++++++++ web/src/lib/i18n/locales/pt.json | 118 ++++++++++++++++++++++ web/src/lib/stores/user_store.ts | 2 +- web/src/routes/profile/+page.svelte | 9 +- 9 files changed, 448 insertions(+), 3 deletions(-) create mode 100644 db/migrations/1711538388_updated_users.go create mode 100644 web/src/lib/i18n/locales/nl.json create mode 100644 web/src/lib/i18n/locales/pl.json create mode 100644 web/src/lib/i18n/locales/pt.json diff --git a/db/migrations/1711538388_updated_users.go b/db/migrations/1711538388_updated_users.go new file mode 100644 index 00000000..098a76cc --- /dev/null +++ b/db/migrations/1711538388_updated_users.go @@ -0,0 +1,75 @@ +package migrations + +import ( + "encoding/json" + + "github.com/pocketbase/dbx" + "github.com/pocketbase/pocketbase/daos" + m "github.com/pocketbase/pocketbase/migrations" + "github.com/pocketbase/pocketbase/models/schema" +) + +func init() { + m.Register(func(db dbx.Builder) error { + dao := daos.New(db); + + collection, err := dao.FindCollectionByNameOrId("_pb_users_auth_") + if err != nil { + return err + } + + // update + edit_language := &schema.SchemaField{} + json.Unmarshal([]byte(`{ + "system": false, + "id": "t1wlsqyp", + "name": "language", + "type": "select", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSelect": 1, + "values": [ + "en", + "de", + "nl", + "pl", + "pt" + ] + } + }`), edit_language) + collection.Schema.AddField(edit_language) + + return dao.SaveCollection(collection) + }, func(db dbx.Builder) error { + dao := daos.New(db); + + collection, err := dao.FindCollectionByNameOrId("_pb_users_auth_") + if err != nil { + return err + } + + // update + edit_language := &schema.SchemaField{} + json.Unmarshal([]byte(`{ + "system": false, + "id": "t1wlsqyp", + "name": "language", + "type": "select", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSelect": 1, + "values": [ + "en", + "de" + ] + } + }`), edit_language) + collection.Schema.AddField(edit_language) + + return dao.SaveCollection(collection) + }) +} diff --git a/web/src/lib/i18n/index.ts b/web/src/lib/i18n/index.ts index a90f0130..ecf19865 100644 --- a/web/src/lib/i18n/index.ts +++ b/web/src/lib/i18n/index.ts @@ -7,6 +7,9 @@ const defaultLocale = 'en' register('en', () => import('./locales/en.json')) register('de', () => import('./locales/de.json')) +register('nl', () => import('./locales/nl.json')) +register('pl', () => import('./locales/pl.json')) +register('pt', () => import('./locales/pt.json')) init({ fallbackLocale: defaultLocale, diff --git a/web/src/lib/i18n/locales/de.json b/web/src/lib/i18n/locales/de.json index c996769b..d7e64a04 100644 --- a/web/src/lib/i18n/locales/de.json +++ b/web/src/lib/i18n/locales/de.json @@ -35,6 +35,7 @@ "distance": "Distanz", "documentation": "Dokumentation", "download-gpx": "GPX herunterladen", + "dutch": "Niederländisch", "easy": "Einfach", "edit": "Bearbeiten", "edit-entry": "Eintrag bearbeiten", @@ -43,6 +44,7 @@ "elevation-gain": "Höhenunterschied", "email": "Email", "english": "Englisch", + "entry": "Eintrag", "error-creating-user": "Fehler beim Erstellen des Nutzers", "error-during-login": "Fehler beim Login", "est-duration": "Gesch. Dauer", @@ -84,6 +86,8 @@ "password": "Passwort", "photos": "Fotos", "pick-a-trail": "Route auswählen", + "polish": "Polnisch", + "portugese": "Portugiesisch", "profile": "Profil", "public": "Öffentlich", "radius": "Radius", diff --git a/web/src/lib/i18n/locales/en.json b/web/src/lib/i18n/locales/en.json index 6a92273a..c753a846 100644 --- a/web/src/lib/i18n/locales/en.json +++ b/web/src/lib/i18n/locales/en.json @@ -35,6 +35,7 @@ "distance": "Distance", "documentation": "Documentation", "download-gpx": "Download GPX", + "dutch": "Dutch", "easy": "Easy", "edit": "Edit", "edit-entry": "Edit Entry", @@ -43,6 +44,7 @@ "elevation-gain": "Elevation Gain", "email": "Email", "english": "English", + "entry": "Entry", "error-creating-user": "Error creating user", "error-during-login": "Error during login", "est-duration": "Est. duration", @@ -84,6 +86,8 @@ "password": "Password", "photos": "Photos", "pick-a-trail": "Pick a trail", + "polish": "Polish", + "portugese": "Portugese", "profile": "Profile", "public": "Public", "radius": "Radius", diff --git a/web/src/lib/i18n/locales/nl.json b/web/src/lib/i18n/locales/nl.json new file mode 100644 index 00000000..066ed172 --- /dev/null +++ b/web/src/lib/i18n/locales/nl.json @@ -0,0 +1,118 @@ +{ + "about": "Over", + "account-delete-confirm": "Je staat op punt je account te verwijderen. Al je trails worden verwijderd. Wil je doorgaan?", + "add-entry": "Item toevoegen", + "add-to-list": "Aan lijst toevoegen", + "add-waypoint": "Via-punt toevoegen", + "added-trail-to": "Trail toegevoegd aan", + "alphabetical": "Alfabetisch", + "already-account": "Je hebt al een account?", + "avatar": "Avatar", + "basic-info": "Basisinformatie", + "cancel": "Annuleren", + "card": "{n, plural, =1 {Kaart} other {Kaarten}}", + "categories": "Categorieën", + "category": "Categorie", + "change": "Aanpassen", + "changelog": "Changelog", + "completed": "Voltooid", + "contribute": "Bijdragen", + "create-new-list": "Nieuwe lijst aanmaken", + "creation-date": "Aanmaakdatum", + "danger-zone": "Gevarenzone", + "date": "Datum", + "default-location": "Standaardlocatie", + "delete": "Verwijder", + "delete-account": "Verwijder account", + "delete-list-confirm": "Wil je deze lijst zeker verwijderen? De routes in de lijst blijven beschikbaar.", + "delete-trail-confirm": "Wil je deze route zeker verwijderen? Dit kan niet ongedaan gemaakt worden.", + "describe-your-trail": "Beschrijf je route", + "description": "Beschrijving", + "difficult": "Moeilijk", + "difficulty": "Moeilijkheid", + "directions": "Wegbeschrijving", + "display-as": "Tonen als", + "distance": "Afstand", + "documentation": "Documentatie", + "download-gpx": "Download GPX", + "dutch": "Nederlands", + "easy": "Makkelijk", + "edit": "Aanpassen", + "edit-entry": "Item aanpassen", + "edit-list": "Lijst aanpassen", + "edit-waypoint": "Via-punt aanpassen", + "elevation-gain": "Hoogteverschil", + "email": "E-mail", + "english": "Engels", + "entry": "Item", + "error-creating-user": "Fout bij het aanmaken van de gebruiker", + "error-during-login": "Fout bij het inloggen", + "est-duration": "Geschatte duur", + "explore": "Verkennen", + "explore-some-trails": "Verken enkele routes", + "features": "Features", + "german": "Duits", + "hero_section_0_text": "Verken spannende routes, sla je favorieten op en ervaar de pracht van de natuur. Ontdek je volgende avontuur!", + "hero_section_1_heading": "Hier zijn nog geen routes.", + "hero_section_1_text": "Hier zijn enkele routes die je misschien leuk vindt. Of je kan ook de volledige lijst bekijken.", + "hero_section_1_text_alternative": "Sla je laatste avontuur op om te beginnen.", + "hero_section_2_text": "Wist je dat? Je kan niet alleen wandelroutes opslaan. Er zijn verschillende categorieën voor al je avonturen.", + "icon": "Icoon", + "imperial": "Amerikaans", + "invalid-username": "Ongeldige gebruikersnaam", + "language": "Taal", + "latitude": "Breedtegraad", + "license": "Licentie", + "list": "{n, plural, =1 {Lijst} other {Lijsten}}", + "location": "Locatie", + "login": "Inloggen", + "logout": "Uitloggen", + "longitude": "Lengtegraad", + "make-one": "Nieuwe aanmaken!", + "make-thumbnail": "Thumbnail aanmaken", + "map": "Kaart", + "metric": "Metrisch", + "moderate": "Gemiddeld", + "must-be-at-least-8-characters-long": "Moet minstens 8 karakters lang zijn", + "name": "Naam", + "near": "Dichtbij", + "new-list": "Nieuwe lijst", + "new-trail": "Nieuwe route", + "no-account": "Geen account?", + "no-preference": "Geen voorkeur", + "no-results": "Geen resultaten gevonden", + "not-a-valid-email-address": "Geen geldig e-mail adres", + "not-completed": "Niet voltooid", + "password": "Wachtwoord", + "photos": "Foto's", + "pick-a-trail": "Kies een route", + "polish": "Pools", + "portugese": "Portugees", + "profile": "Profiel", + "public": "Openbaar", + "radius": "Straal", + "register": "Registreren", + "removed-trail-from": "Route verwijderd uit", + "required": "Verplicht", + "save": "Opslaan", + "save-trail": "Route opslaan", + "search-cities": "Zoek steden", + "search-for-trails-places": "Zoek routes, plaatsen", + "search-trails": "Zoek routes", + "select-list": "Zoek lijst", + "settings": "Instellingen", + "show-in-overview": "Toon in overzicht", + "show-on-map": "Toon op kaart", + "slogan": "Sla je avonturen op!", + "sort": "Sorteren", + "summit-book": "Bergtopboek", + "text": "Tekst", + "trail": "{n, plural, =1 {Route} other {Routes}}", + "trails-for-you": "Routes voor jou", + "units": "Eenheden", + "upload-gpx": "GPX uploaden", + "username": "Gebruikersnaam", + "waypoints": "Via-punten", + "welcome_to": "Welkom bij", + "wrong-username-or-password": "Foute gebruikersnaam of wachtwoord" +} diff --git a/web/src/lib/i18n/locales/pl.json b/web/src/lib/i18n/locales/pl.json new file mode 100644 index 00000000..2837eb57 --- /dev/null +++ b/web/src/lib/i18n/locales/pl.json @@ -0,0 +1,118 @@ +{ + "about": "Więcej", + "account-delete-confirm": "Usuniesz swoje konto. Wszystkie twoje ścieżki zostaną usunięte. Czy chcesz kontynuować?", + "add-entry": "Dodaj Pozycję", + "add-to-list": "Dodaj do listy", + "add-waypoint": "Dodaj Punkt", + "added-trail-to": "Dodaj ścieżkę do", + "alphabetical": "Alfabetycznie", + "already-account": "Czy masz już konto?", + "avatar": "Awatar", + "basic-info": "Podstawowe informacje", + "cancel": "Anuluj", + "card": "{n, plural, =1 {Karta} other {Karty}}", + "categories": "Kategorie", + "category": "Kategoria", + "change": "Zmień", + "changelog": "Dziennik zmian", + "completed": "Zakończono", + "contribute": "Kontrybuuj", + "create-new-list": "Stwórz nową listę", + "creation-date": "Data stworzenia", + "danger-zone": "Strefa zagrożenia", + "date": "Data", + "default-location": "Lokalizacja Domyślna", + "delete": "Usuń", + "delete-account": "Usuń Konto", + "delete-list-confirm": "Czy na pewno chcesz usunąć tę listę? Ścieżki na liście zostaną zachowane.", + "delete-trail-confirm": "Czy na pewno chcesz usunąć tą Ścieżkę? Ta akcja jest nieodwracalna.", + "describe-your-trail": "Opisz swoją ścieżkę", + "description": "Opis", + "difficult": "Trudny", + "difficulty": "Trudność", + "directions": "Kierunki", + "display-as": "Wyświetl jako", + "distance": "Dystans", + "documentation": "Dokumentacja", + "download-gpx": "Popierz GPX", + "dutch": "Niderlandzki", + "easy": "Łatwy", + "edit": "Edytuj", + "edit-entry": "Edytuj pozycję", + "edit-list": "Edytuj Listę", + "edit-waypoint": "Edytuj Punkt", + "elevation-gain": "Wzrost Wysokości", + "email": "Email", + "english": "Angielski", + "entry": "Pozycja", + "error-creating-user": "Błąd tworzenia użytkownika", + "error-during-login": "Błąd podczas logowania", + "est-duration": "Szacowany czas", + "explore": "Eksploruj", + "explore-some-trails": "Eksploruj różne ścieżki", + "features": "Funkcje", + "german": "Niemiecki", + "hero_section_0_text": "Eksploruj ekscytujące szlaki, zapisz swoje ulubione, doświadcz piękna naturalnego świata. Znajdź swoją następną przygodę!", + "hero_section_1_heading": "Wygląda na to że nie ma tutaj ścieżek.", + "hero_section_1_text": "Oto kila ścieżek które możesz zobaczyć lub możesz przejść do pełnej listy.", + "hero_section_1_text_alternative": "Zacznij poprzez zapisanie swojej ostatniej wyprawy.", + "hero_section_2_text": "Czy wiesz że, możesz zapisywać nie tylko piesze wycieczki ale także inne kategorie wypraw?", + "icon": "Ikona", + "imperial": "Anglosaskie", + "invalid-username": "Błędna nazwa użytkownika", + "language": "Język", + "latitude": "Szerokość", + "license": "Licencja", + "list": "{n, plural, =1 {Lista} other {Listy}}", + "location": "Lokalizacja", + "login": "Zaloguj się", + "logout": "Wyloguj", + "longitude": "Wysokość", + "make-one": "Stwórz ją!", + "make-thumbnail": "Zrób miniatórkę", + "map": "Mapa", + "metric": "Metryczne", + "moderate": "Moderuj", + "must-be-at-least-8-characters-long": "Długość musi wynosić przynajmniej 8 znaków", + "name": "Nazwa", + "near": "Blisko", + "new-list": "Nowa Lista", + "new-trail": "Nowa ścieżka", + "no-account": "Nie masz konta?", + "no-preference": "Brak preferencji", + "no-results": "Brak wyników", + "not-a-valid-email-address": "Nieprawidłowy adres email", + "not-completed": "Nie dokończono", + "password": "Hasło", + "photos": "Zdjęcia", + "pick-a-trail": "Wybierz ścieżkę", + "polish": "Polski", + "portugese": "Portugalski", + "profile": "Profil", + "public": "Publiczny", + "radius": "Promień", + "register": "Zarejestruj", + "removed-trail-from": "Usunięto ścieżkę z", + "required": "Wymagane", + "save": "Zapisz", + "save-trail": "Zapisz ścieżkę", + "search-cities": "Szukaj miasta", + "search-for-trails-places": "Szukaj ścieżek lub miejsc", + "search-trails": "Szukaj ścieżek", + "select-list": "Zaznacz Listę", + "settings": "Ustawienia", + "show-in-overview": "Pokaż w przeglądzie", + "show-on-map": "Pokaż na mapie", + "slogan": "Zapisz swoją wyprawę!", + "sort": "Sortowanie", + "summit-book": "Księga Szczytów", + "text": "Tekst", + "trail": "{n, plural, =1 {Szlak} other {Szlaki}}", + "trails-for-you": "Ścieżki dla ciebie", + "units": "Jednostki", + "upload-gpx": "Wyślij GPX", + "username": "Nazwa Użytkownika", + "waypoints": "Punkty", + "welcome_to": "Witaj w", + "wrong-username-or-password": "Zła nazwa użytkownika lub hasło" +} diff --git a/web/src/lib/i18n/locales/pt.json b/web/src/lib/i18n/locales/pt.json new file mode 100644 index 00000000..b3cc69ad --- /dev/null +++ b/web/src/lib/i18n/locales/pt.json @@ -0,0 +1,118 @@ +{ + "about": "Sobre", + "account-delete-confirm": "Você está prestes a excluir sua conta. Todas as suas trilhas também serão excluídas. Queres prosseguir?", + "add-entry": "Adicionar entrada", + "add-to-list": "Adicionar à lista", + "add-waypoint": "Adicionar ponto de vista", + "added-trail-to": "Trilha adicionada para", + "alphabetical": "Alfabético", + "already-account": "Já tem uma conta?", + "avatar": "Avatar", + "basic-info": "Informações básicas", + "cancel": "Cancelar", + "card": "{n, plural, =1 {Cartão} other {cartãos}}", + "categories": "Categorias", + "category": "Categoria", + "change": "Alterar", + "changelog": "Registo de alterações", + "completed": "Completada", + "contribute": "Contribuir", + "create-new-list": "Criar nova lista", + "creation-date": "Data de criação", + "danger-zone": "Zona de perigo", + "date": "Data", + "default-location": "Localização padrão", + "delete": "Excluir", + "delete-account": "Excluir conta", + "delete-list-confirm": "Você realmente quer excluir esta lista? As trilhas na lista ainda estarão disponíveis.", + "delete-trail-confirm": "Você realmente quer excluir esta trilha? Esta ação não pode ser desfeita.", + "describe-your-trail": "Descreva sua trilha", + "description": "Descrição", + "difficult": "Difícil", + "difficulty": "Dificuldade", + "directions": "Instruções", + "display-as": "Exibir como", + "distance": "Distância", + "documentation": "Documentação", + "download-gpx": "Baixar GPX", + "dutch": "Holandês", + "easy": "Fácil", + "edit": "Editar", + "edit-entry": "Editar entrada", + "edit-list": "Editar lista", + "edit-waypoint": "Editar ponto de passagem", + "elevation-gain": "Ganho de elevação", + "email": "Email", + "english": "Inglês", + "entry": "Entrada", + "error-creating-user": "Erro ao criar usuário", + "error-during-login": "Erro durante o login", + "est-duration": "Duração prevista", + "explore": "Explorar", + "explore-some-trails": "Explore algumas trilhas", + "features": "Características", + "german": "Alemão", + "hero_section_0_text": "Explore trilhas emocionantes, salve seus favoritos e experimente a beleza da natureza. Encontre sua próxima aventura!", + "hero_section_1_heading": "Parece que ainda não há trilhas aqui.", + "hero_section_1_text": "Aqui estão algumas trilhas que você pode gostar. Ou podes ir à lista completa agora.", + "hero_section_1_text_alternative": "Comece salvando sua última aventura.", + "hero_section_2_text": "Sabias? Você não pode apenas salvá-lo trilhas de caminhada. Há muitas categorias para todas as suas aventuras.", + "icon": "Ícone", + "imperial": "Imperial", + "invalid-username": "Nome de usuário inválido", + "language": "Língua", + "latitude": "Latitude", + "license": "Licença", + "list": "{n, plural, =1 {Lista} other {Listas}}", + "location": "Localização", + "login": "Login", + "logout": "Sair", + "longitude": "Longitude", + "make-one": "Faz um!", + "make-thumbnail": "Faça miniatura", + "map": "Mapa", + "metric": "Métrica", + "moderate": "Moderado", + "must-be-at-least-8-characters-long": "Deve ter pelo menos 8 caracteres", + "name": "Nome", + "near": "Próximo", + "new-list": "Nova lista", + "new-trail": "Nova trilha", + "no-account": "Não tem uma conta?", + "no-preference": "Nenhuma preferência", + "no-results": "Nenhum resultado encontrado", + "not-a-valid-email-address": "Não um endereço de e-mail válido", + "not-completed": "Não preenchido", + "password": "Senha", + "photos": "Fotos", + "pick-a-trail": "Escolha uma trilha", + "polish": "Polonês", + "portugese": "Português", + "profile": "Perfil", + "public": "Público", + "radius": "Raio", + "register": "Registo", + "removed-trail-from": "Trilha removida de", + "required": "Obrigatório", + "save": "Guardar", + "save-trail": "Guardar trilho", + "search-cities": "Procurar cidades", + "search-for-trails-places": "Procurar trilhos, locais", + "search-trails": "Procurar trilhos", + "select-list": "Selecionar lista", + "settings": "Definições", + "show-in-overview": "Mostrar na vista geral", + "show-on-map": "Mostrar no mapa", + "slogan": "Guarde as suas aventuras!", + "sort": "Ordenar", + "summit-book": "Livro da cimeira", + "text": "Texto", + "trail": "{n, plural, =1 {Percurso} other {Percursos}}", + "trails-for-you": "Trilhos para si", + "units": "Unidades", + "upload-gpx": "Carregar GPX", + "username": "Nome de utilizador", + "waypoints": "Pontos de passagem", + "welcome_to": "Bem-vindo ao", + "wrong-username-or-password": "Nome de utilizador ou palavra-passe errados" +} diff --git a/web/src/lib/stores/user_store.ts b/web/src/lib/stores/user_store.ts index 73b8d188..938a3848 100644 --- a/web/src/lib/stores/user_store.ts +++ b/web/src/lib/stores/user_store.ts @@ -9,7 +9,7 @@ export type User = { password: string, avatar?: string; unit?: "metric" | "imperial"; - language?: "en" | "de"; + language?: "en" | "de" | "nl" | "pl" | "pt"; location?: { name: string, lat: number, lon: number } } diff --git a/web/src/routes/profile/+page.svelte b/web/src/routes/profile/+page.svelte index 71ab16c5..8e12122c 100644 --- a/web/src/routes/profile/+page.svelte +++ b/web/src/routes/profile/+page.svelte @@ -22,8 +22,11 @@ import { _, locale } from "svelte-i18n"; const languages: SelectItem[] = [ - { text: $_("english"), value: "en" }, { text: $_("german"), value: "de" }, + { text: $_("english"), value: "en" }, + { text: $_("dutch"), value: "nl" }, + { text: $_("polish"), value: "pl" }, + { text: $_("portugese"), value: "pt" }, ]; const units: RadioItem[] = [ @@ -90,7 +93,9 @@ }); } - async function handleLanguageSelection(value: "en" | "de") { + async function handleLanguageSelection( + value: "en" | "de" | "nl" | "pl" | "pt", + ) { locale.set(value); await users_update({ id: $currentUser!.id,