From 946e3dd4a6326cb646091c88f301b793e1c612bc Mon Sep 17 00:00:00 2001 From: Marco Rodolfi Date: Tue, 16 Jun 2026 20:49:30 +0200 Subject: [PATCH 01/11] Make project localizable. Originally implemented from d0ul Rebased to 3.0.1 by me --- package.json | 1 + src/components/AlbumView/GenreBanner.vue | 5 +- src/components/AlbumView/Header/Stats.vue | 9 +- .../ArtistView/HeaderComponents/Info.vue | 9 +- src/components/ArtistView/TopTracks.vue | 5 +- src/components/BottomBar/Left.vue | 7 +- src/components/BottomBar/Right.vue | 5 +- src/components/CardListView/SortBanner.vue | 27 +-- src/components/FolderView/FolderItem.vue | 5 +- src/components/HomeView/Browse.vue | 23 +-- src/components/LeftSidebar/MobileNav.vue | 3 +- src/components/LeftSidebar/NavButtons.vue | 3 +- src/components/LeftSidebar/navitems.ts | 105 ++++++------ src/components/NowPlaying/Header.vue | 9 +- src/components/NowPlaying/PlayingFrom.vue | 5 +- src/components/PlaylistView/AfterHeader.vue | 6 +- src/components/PlaylistView/Header/Info.vue | 5 +- .../PlaylistView/Header/LastUpdated.vue | 7 +- src/components/PlaylistsList/PlaylistCard.vue | 5 +- .../RightSideBar/Home/Recommendation.vue | 6 +- src/components/RightSideBar/Queue.vue | 7 +- .../RightSideBar/Queue/QueueActions.vue | 7 +- .../RightSideBar/Search/TopResults.vue | 16 +- .../RightSideBar/Search/TracksGrid.vue | 5 +- src/components/RightSideBar/SearchInput.vue | 7 +- src/components/SettingsView/About.vue | 29 ++-- .../SettingsView/Components/BackupRestore.vue | 22 ++- .../SettingsView/Components/List.vue | 5 +- .../SettingsView/Components/NumberInput.vue | 9 +- .../SettingsView/Components/SecretInput.vue | 5 +- .../Components/SeparatorsInput.vue | 5 +- src/components/bubbles/DropArea.vue | 6 +- src/components/nav/NavLinks.vue | 3 +- src/components/nav/NavSidenav.vue | 3 +- src/locales/en.json | 162 ++++++++++++++++++ src/locales/ko.json | 162 ++++++++++++++++++ src/main.ts | 19 ++ src/views/HomeView/main.vue | 16 +- yarn.lock | 35 ++++ 39 files changed, 623 insertions(+), 150 deletions(-) create mode 100644 src/locales/en.json create mode 100644 src/locales/ko.json diff --git a/package.json b/package.json index 6054cd92..f15f1bf8 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "vue": "^v3.5.13", "vue-boring-avatars": "^1.4.0", "vue-debounce": "^3.0.2", + "vue-i18n": "11", "vue-router": "^4.1.3", "vue-template-compiler": "^2.0.0", "vue-virtual-scroller": "^2.0.0-beta.7", diff --git a/src/components/AlbumView/GenreBanner.vue b/src/components/AlbumView/GenreBanner.vue index bdc42957..ea91d7b8 100644 --- a/src/components/AlbumView/GenreBanner.vue +++ b/src/components/AlbumView/GenreBanner.vue @@ -7,7 +7,7 @@ >
- {{ genres.length ? "Genres" : "No genres" }} + {{ genres.length ? t('AlbumView.GenreBanner.GenreExists') : t('AlbumView.GenreBanner.GenreDoesNotExist') }}
- {{ new Date(album.date * 1000).getFullYear() }} {{ !album.is_single ? `• ${album.trackcount} Tracks` : "" }} • + {{ new Date(album.date * 1000).getFullYear() }} {{ !album.is_single ? `• ${album.trackcount} ${$t('AlbumView.TrackCountPlural')}` : "" }} • {{ formatSeconds(album.duration, true) }}
@@ -18,6 +18,7 @@ diff --git a/src/components/ArtistView/HeaderComponents/Info.vue b/src/components/ArtistView/HeaderComponents/Info.vue index 5ccdb8e7..cc4890ee 100644 --- a/src/components/ArtistView/HeaderComponents/Info.vue +++ b/src/components/ArtistView/HeaderComponents/Info.vue @@ -6,16 +6,16 @@ }" >
-
Artist
+
{{ t('ArtistView.Title') }}
{{ artist.name }}
- {{ artist.trackcount.toLocaleString() }} Track{{ `${artist.trackcount == 1 ? '' : 's'} • ` }} + {{ artist.trackcount.toLocaleString() }} {{ `${artist.trackcount == 1 ? t('ArtistView.TrackCount') : t('ArtistView.TrackCountPlural')} • ` }} - {{ artist.albumcount.toLocaleString() }} Album{{ `${artist.albumcount == 1 ? '' : 's'} • ` }} + {{ artist.albumcount.toLocaleString() }} {{ `${artist.albumcount == 1 ? t('ArtistView.AlbumCount') : t('ArtistView.AlbumCountPlural')} • ` }} {{ `${formatSeconds(artist.duration, true)}` }} @@ -32,6 +32,9 @@ import { getTextColor } from '@/utils/colortools/shift' import { Artist } from '@/interfaces' import formatSeconds from '@/utils/useFormatSeconds' import Buttons from './Buttons.vue' +import { useI18n } from "vue-i18n"; + +const { t } = useI18n(); defineProps<{ artist: Artist diff --git a/src/components/ArtistView/TopTracks.vue b/src/components/ArtistView/TopTracks.vue index b716ac6e..8da2b140 100644 --- a/src/components/ArtistView/TopTracks.vue +++ b/src/components/ArtistView/TopTracks.vue @@ -14,7 +14,7 @@ @playThis="playHandler(index)" />
-
No tracks
+
{{ t('ArtistView.NoTracks') }}
@@ -24,6 +24,9 @@ import { Track } from '@/interfaces' import { isMedium, isSmall } from '@/stores/content-width' import SeeAll from '../shared/SeeAll.vue' import SongItem from '../shared/SongItem.vue' +import { useI18n } from "vue-i18n"; + +const { t } = useI18n(); defineProps<{ tracks: Track[] diff --git a/src/components/BottomBar/Left.vue b/src/components/BottomBar/Left.vue index baff4018..29b90252 100644 --- a/src/components/BottomBar/Left.vue +++ b/src/components/BottomBar/Left.vue @@ -37,7 +37,7 @@ >
@@ -61,6 +61,8 @@ diff --git a/src/components/FolderView/FolderItem.vue b/src/components/FolderView/FolderItem.vue index 2a00ac83..42771035 100644 --- a/src/components/FolderView/FolderItem.vue +++ b/src/components/FolderView/FolderItem.vue @@ -17,7 +17,7 @@
{{ folder.name }}
- {{ folder.trackcount.toLocaleString() + ` File${folder.trackcount == 1 ? "" : "s"}` }} + {{ folder.trackcount.toLocaleString() + ` ${folder.trackcount == 1 ? t('FolderView.FileCount') : t('FolderView.FileCountPlural')}` }}
@@ -31,6 +31,9 @@ \ No newline at end of file diff --git a/src/components/LeftSidebar/NavButtons.vue b/src/components/LeftSidebar/NavButtons.vue index 0c42517a..ecbcd277 100644 --- a/src/components/LeftSidebar/NavButtons.vue +++ b/src/components/LeftSidebar/NavButtons.vue @@ -25,7 +25,8 @@