diff --git a/front/package.json b/front/package.json index 43116ca50..051076f21 100644 --- a/front/package.json +++ b/front/package.json @@ -76,7 +76,6 @@ "@vue/eslint-config-typescript": "11.0.2", "@vue/test-utils": "2.2.4", "@vue/tsconfig": "0.1.3", - "easygettext": "2.17.0", "eslint": "8.28.0", "eslint-config-standard": "17.0.0", "eslint-plugin-html": "7.1.0", diff --git a/front/src/components/About.vue b/front/src/components/About.vue index 6e2bf9815..fddb6a1ba 100644 --- a/front/src/components/About.vue +++ b/front/src/components/About.vue @@ -1,6 +1,6 @@ @@ -20,13 +20,13 @@ const labels = computed(() => ({

- + Page not found!

- + Sorry, the page you asked for does not exist:

@@ -36,7 +36,7 @@ const labels = computed(() => ({ class="ui icon labeled right button" to="/" > - + Go to home page diff --git a/front/src/components/Queue.vue b/front/src/components/Queue.vue index 763058190..e90b613fa 100644 --- a/front/src/components/Queue.vue +++ b/front/src/components/Queue.vue @@ -4,7 +4,6 @@ import type { QueueItemSource } from '~/types' import { whenever, watchDebounced, useCurrentElement, useScrollLock, useFullscreen, useIdle, refAutoReset, useStorage } from '@vueuse/core' import { nextTick, ref, computed, watchEffect, onMounted } from 'vue' import { useFocusTrap } from '@vueuse/integrations/useFocusTrap' -import { useGettext } from 'vue3-gettext' import { useRouter } from 'vue-router' import { useStore } from '~/store' @@ -18,6 +17,11 @@ import TrackFavoriteIcon from '~/components/favorites/TrackFavoriteIcon.vue' import TrackPlaylistIcon from '~/components/playlists/TrackPlaylistIcon.vue' import PlayerControls from '~/components/audio/PlayerControls.vue' import MilkDrop from '~/components/audio/visualizer/MilkDrop.vue' +import { whenever, watchDebounced, useCurrentElement, useScrollLock } from '@vueuse/core' +import { useI18n } from 'vue-i18n' +import useQueue from '~/composables/audio/useQueue' +import usePlayer from '~/composables/audio/usePlayer' + import VirtualList from '~/components/vui/list/VirtualList.vue' import QueueItem from '~/components/QueueItem.vue' @@ -49,24 +53,24 @@ const { currentSound } = useTracks() const queueModal = ref() const { activate, deactivate } = useFocusTrap(queueModal, { allowOutsideClick: true, preventScroll: true }) -const { $pgettext } = useGettext() +const { t } = useI18n() const scrollLock = useScrollLock(document.body) const store = useStore() const labels = computed(() => ({ - queue: $pgettext('*/*/*', 'Queue'), - populating: $pgettext('*/*/*', 'Fetching radio track'), - duration: $pgettext('*/*/*', 'Duration'), - addArtistContentFilter: $pgettext('Sidebar/Player/Icon.Tooltip/Verb', 'Hide content from this artist…'), - restart: $pgettext('*/*/*', 'Restart track'), - previous: $pgettext('*/*/*', 'Previous track'), - next: $pgettext('*/*/*', 'Next track'), - pause: $pgettext('*/*/*', 'Pause'), - play: $pgettext('*/*/*', 'Play'), - fullscreen: $pgettext('*/*/*', 'Fullscreen'), - exitFullscreen: $pgettext('*/*/*', 'Exit fullscreen'), - showCoverArt: $pgettext('*/*/*', 'Show cover art'), - showVisualizer: $pgettext('*/*/*', 'Show visualizer') + queue: t('Queue'), + populating: t('Fetching radio track'), + duration: t('Duration'), + addArtistContentFilter: t('Hide content from this artist…'), + restart: t('Restart track'), + previous: t('Previous track'), + next: t('Next track'), + pause: t('Pause'), + play: t('Play'), + fullscreen: t('Fullscreen'), + exitFullscreen: t('Exit fullscreen'), + showCoverArt: t('Show cover art'), + showVisualizer: t('Show visualizer') })) watchEffect(async () => { @@ -125,10 +129,11 @@ const queueItems = computed(() => queue.value.map((track, index) => ({ ...track, key: `${index}-${track.id}`, labels: { - remove: $pgettext('*/*/*', 'Remove'), - selectTrack: $pgettext('*/*/*', 'Select track'), - favorite: $pgettext('*/*/*', 'Favorite track') - } + remove: t('Remove'), + selectTrack: t('Select track'), + favorite: t('Favorite track') + }, + duration: time.durationFormatted(track.uploads[0]?.duration ?? 0) ?? '' }) as QueueItemSource)) const reorderTracks = async (from: number, to: number) => { @@ -296,18 +301,18 @@ const coverType = useStorage('queue:cover-type', CoverType.COVER_ART) class="ui small warning message" >

- + The track cannot be loaded

- + The next track will play automatically in a few seconds…

- + You may have a connectivity issue.

@@ -408,7 +413,7 @@ const coverType = useStorage('queue:cover-type', CoverType.COVER_ART) class="ui right floated basic button" @click="$store.commit('ui/queueFocused', null)" > - + Close @@ -416,7 +421,7 @@ const coverType = useStorage('queue:cover-type', CoverType.COVER_ART) class="ui right floated basic button danger" @click="clear" > - + Clear @@ -424,7 +429,6 @@ const coverType = useStorage('queue:cover-type', CoverType.COVER_ART)
Track %{ index } of %{ length } @@ -473,12 +477,12 @@ const coverType = useStorage('queue:cover-type', CoverType.COVER_ART) >

- + You have a radio playing

- + New tracks will be appended here automatically.

@@ -486,7 +490,7 @@ const coverType = useStorage('queue:cover-type', CoverType.COVER_ART) class="ui basic primary button" @click="$store.dispatch('radios/stop')" > - + Stop radio diff --git a/front/src/components/RemoteSearchForm.vue b/front/src/components/RemoteSearchForm.vue index 5c50fd996..777f108a8 100644 --- a/front/src/components/RemoteSearchForm.vue +++ b/front/src/components/RemoteSearchForm.vue @@ -2,7 +2,7 @@ import type { BackendError } from '~/types' import { ref, computed, watch } from 'vue' -import { useGettext } from 'vue3-gettext' +import { useI18n } from 'vue-i18n' import { useRouter } from 'vue-router' import { useStore } from '~/store' @@ -37,17 +37,17 @@ const type = ref(props.initialType) const id = ref(props.initialId) const errors = ref([] as string[]) -const { $pgettext } = useGettext() +const { t } = useI18n() const labels = computed(() => ({ title: type.value === 'rss' - ? $pgettext('Head/Fetch/Title', 'Subscribe to a podcast RSS feed') - : $pgettext('Head/Fetch/Title', 'Subscribe to a podcast hosted on the Fediverse'), + ? t('Subscribe to a podcast RSS feed') + : t('Subscribe to a podcast hosted on the Fediverse'), fieldLabel: type.value === 'rss' - ? $pgettext('*/*/*', 'RSS feed location') - : $pgettext('*/*/*', 'Fediverse object'), + ? t('RSS feed location') + : t('Fediverse object'), fieldPlaceholder: type.value === 'rss' - ? $pgettext('Head/Fetch/Field.Placeholder', 'https://website.example.com/rss.xml') - : $pgettext('Head/Fetch/Field.Placeholder', '@username@example.com') + ? t('https://website.example.com/rss.xml') + : t('@username@example.com') })) const obj = ref() @@ -117,7 +117,7 @@ const createFetch = async () => { obj.value = response.data if (response.data.status === 'errored' || response.data.status === 'skipped') { - errors.value.push($pgettext('Content/*/Error message.Title', 'This object cannot be retrieved')) + errors.value.push(t('This object cannot be retrieved')) } } catch (error) { errors.value = (error as BackendError).backendErrors @@ -172,7 +172,7 @@ watch(() => props.initialId, () => { @click.prevent="type = 'rss'" > - + RSS @@ -182,7 +182,7 @@ watch(() => props.initialId, () => { @click.prevent="type = 'artists'" > - + Fediverse @@ -199,7 +199,7 @@ watch(() => props.initialId, () => { class="ui negative message" >

- + Error while fetching object

@@ -217,12 +217,12 @@ watch(() => props.initialId, () => { {{ labels.fieldLabel }}

- + Use this form to subscribe to an RSS feed from its URL.

- + Use this form to subscribe to a channel hosted somewhere else on the Fediverse.

@@ -241,7 +241,7 @@ watch(() => props.initialId, () => { :class="['ui', 'primary', {loading: isLoading}, 'button']" :disabled="isLoading || !id || id.length === 0" > - + Search @@ -252,7 +252,7 @@ watch(() => props.initialId, () => { class="ui warning message" >

- + This kind of object isn't supported yet

diff --git a/front/src/components/SetInstanceModal.vue b/front/src/components/SetInstanceModal.vue index ec50c76fd..70b00fb09 100644 --- a/front/src/components/SetInstanceModal.vue +++ b/front/src/components/SetInstanceModal.vue @@ -1,6 +1,6 @@ @@ -73,7 +73,7 @@ const labels = computed(() => ({