From 9015b07c216e4c548ef3c06e16cb663452eb3f96 Mon Sep 17 00:00:00 2001 From: Lenny Angst Date: Tue, 8 Jul 2025 18:18:47 +0200 Subject: [PATCH 1/3] Add untranslatable strings to translation Strings "x comments" and "x replies"/"1 reply" were not translatable and are now added to the English base file as well as the German translation. --- materialious/package-lock.json | 4 ++-- materialious/src/lib/components/Comment.svelte | 3 ++- materialious/src/lib/i18n/locales/de.json | 4 +++- materialious/src/lib/i18n/locales/en.json | 2 ++ materialious/src/routes/(app)/watch/[slug]/+page.svelte | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/materialious/package-lock.json b/materialious/package-lock.json index 4d8a99b6..d27176be 100644 --- a/materialious/package-lock.json +++ b/materialious/package-lock.json @@ -1,12 +1,12 @@ { "name": "materialious", - "version": "1.9.18", + "version": "1.9.19", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "materialious", - "version": "1.9.18", + "version": "1.9.19", "hasInstallScript": true, "dependencies": { "@capacitor-community/electron": "^5.0.1", diff --git a/materialious/src/lib/components/Comment.svelte b/materialious/src/lib/components/Comment.svelte index f5832f49..400c609b 100644 --- a/materialious/src/lib/components/Comment.svelte +++ b/materialious/src/lib/components/Comment.svelte @@ -7,6 +7,7 @@ import { onMount } from 'svelte'; import CommentSelf from './Comment.svelte'; import { insecureRequestImageHandler } from '$lib/misc'; + import { _ } from '$lib/i18n'; interface Props { comment: Comment; @@ -17,7 +18,7 @@ let replies: Comments | undefined = $state(undefined); - const replyText: string = comment.replies?.replyCount > 1 ? 'replies' : 'reply'; + const replyText: string = comment.replies?.replyCount > 1 ? $_('replies') : $_('reply'); async function loadReplies(continuation: string) { try { diff --git a/materialious/src/lib/i18n/locales/de.json b/materialious/src/lib/i18n/locales/de.json index 83ee1fdf..2ab9c5cd 100644 --- a/materialious/src/lib/i18n/locales/de.json +++ b/materialious/src/lib/i18n/locales/de.json @@ -13,7 +13,9 @@ "donate": "Spenden", "deleteAllHistory": "Gesamten Verlauf löschen", "skipping": "Überspringen", - "replies": "antworten", + "comments": "Kommentare", + "reply": "Antwort", + "replies": "Antworten", "region": "Region", "noResult": "Keine Ergebnisse", "language": "Sprache", diff --git a/materialious/src/lib/i18n/locales/en.json b/materialious/src/lib/i18n/locales/en.json index 1e1f9beb..001824f9 100644 --- a/materialious/src/lib/i18n/locales/en.json +++ b/materialious/src/lib/i18n/locales/en.json @@ -19,6 +19,8 @@ "donate": "Donate", "deleteAllHistory": "Delete all history", "skipping": "Skipping", + "comments": "comments", + "reply": "reply", "replies": "replies", "region": "Region", "noResult": "No results", diff --git a/materialious/src/routes/(app)/watch/[slug]/+page.svelte b/materialious/src/routes/(app)/watch/[slug]/+page.svelte index 3edcfc25..b6e98a0d 100644 --- a/materialious/src/routes/(app)/watch/[slug]/+page.svelte +++ b/materialious/src/routes/(app)/watch/[slug]/+page.svelte @@ -469,7 +469,7 @@
From 5db4897725aef61d529611de48cbc560b7de4b4a Mon Sep 17 00:00:00 2001 From: Lenny Angst Date: Tue, 8 Jul 2025 18:22:10 +0200 Subject: [PATCH 2/3] Enhance getUserLocale to better find the best lang The current implementation of getUserLocale didn't catch regional variations of the languages. These are separated by a dash and uppercase letters. E.g. a user with 'de-CH' didn't get the German translation but fell back to English. This new implementation also considers these variations and falls back to the more general language if the exact variation is not available. Additionally, instead of navigator.language we now use navigator.languages, which contains all of the browsers preferred languages in order. This features is supported by all major browsers since 2017. ['it', 'de'] will then resolve to German instead of English. --- materialious/src/lib/i18n/index.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/materialious/src/lib/i18n/index.ts b/materialious/src/lib/i18n/index.ts index e4f3f121..e62b5313 100644 --- a/materialious/src/lib/i18n/index.ts +++ b/materialious/src/lib/i18n/index.ts @@ -23,8 +23,16 @@ const resources: Record Promise>> = { function getUserLocale(): string { if (typeof navigator !== 'undefined') { - const lang = navigator.language; - return resources[lang] ? lang : defaultLocale; + for (const lang of navigator.languages) { + if (resources[lang]) { + return lang; + } + // In case of a regional code (e.g. 'de-CH'), fallback to the more general lang + const baseLang = lang.split('-')[0] + if (resources[baseLang]) { + return baseLang + } + } } return defaultLocale; } From 8f18bfb7ff8a382c90562720a53557d01d0e084f Mon Sep 17 00:00:00 2001 From: WardPearce Date: Wed, 9 Jul 2025 15:14:34 +1200 Subject: [PATCH 3/3] Bump version --- materialious/android/app/build.gradle | 4 ++-- materialious/electron/materialious.metainfo.xml | 6 +++++- materialious/electron/package.json | 4 ++-- materialious/package.json | 2 +- update_versions.py | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/materialious/android/app/build.gradle b/materialious/android/app/build.gradle index 896112ff..053c299b 100644 --- a/materialious/android/app/build.gradle +++ b/materialious/android/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "us.materialio.app" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 136 - versionName "1.9.19" + versionCode 137 + versionName "1.9.20" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/materialious/electron/materialious.metainfo.xml b/materialious/electron/materialious.metainfo.xml index b7a8ca03..0e423078 100644 --- a/materialious/electron/materialious.metainfo.xml +++ b/materialious/electron/materialious.metainfo.xml @@ -71,7 +71,11 @@ - + + + https://github.com/Materialious/Materialious/releases/tag/1.9.20 + + https://github.com/Materialious/Materialious/releases/tag/1.9.19 diff --git a/materialious/electron/package.json b/materialious/electron/package.json index 2732fc6e..84691dd3 100644 --- a/materialious/electron/package.json +++ b/materialious/electron/package.json @@ -1,6 +1,6 @@ { "name": "Materialious", - "version": "1.9.19", + "version": "1.9.20", "description": "Modern material design for Invidious.", "author": { "name": "Ward Pearce", @@ -44,4 +44,4 @@ "capacitor", "electron" ] -} +} \ No newline at end of file diff --git a/materialious/package.json b/materialious/package.json index 52d70d0c..a18d9add 100644 --- a/materialious/package.json +++ b/materialious/package.json @@ -1,6 +1,6 @@ { "name": "materialious", - "version": "1.9.19", + "version": "1.9.20", "private": true, "scripts": { "dev": "vite dev", diff --git a/update_versions.py b/update_versions.py index f8e24a04..bc45c1c9 100644 --- a/update_versions.py +++ b/update_versions.py @@ -3,7 +3,7 @@ import os import re from datetime import datetime -LATEST_VERSION = "1.9.19" +LATEST_VERSION = "1.9.20" RELEASE_DATE = datetime.now().strftime("%Y-%-m-%d") # Format: YYYY-M-D WORKING_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "materialious")