Allow the search results page to be localized

This commit is contained in:
root
2022-07-21 19:53:18 +05:30
parent 57d9da10c1
commit 3770599132
2 changed files with 43 additions and 19 deletions
+30 -19
View File
@@ -5,10 +5,10 @@
</h5>
<v-select
label="Filter videos"
:value="$route.query.filter"
:label="$t('search_results.filterLabel')"
:value="filterValue"
@change="$router.push({ query: { ...$route.query, filter: $event }})"
:items="availableFilters"
:items="options"
/>
<v-divider class="my-4" />
@@ -42,21 +42,9 @@ export default {
GenericDisplayItem,
VideoItem
},
data () {
return {
results: null,
availableFilters: [
'all',
'videos',
'channels',
'playlists',
'music_songs',
'music_videos',
'music_albums',
'music_playlists'
]
}
},
data: () => ({
results: null
}),
metaInfo () {
return {
title: this.$route.query.search_query
@@ -66,6 +54,29 @@ export default {
mounted () {
this.updateResults()
},
computed: {
filterValue () {
return this.$route.query.filter ?? 'all'
},
options () {
return [
'all',
'videos',
'channels',
'playlists',
'music_songs',
'music_videos',
'music_albums',
'music_playlists'
].map((name) => ({
text: this.$t('search_results.result_types.' + name),
value: name
}))
}
},
watch: {
// For history navigation
'$route.query.search_query' () {
@@ -105,7 +116,7 @@ export default {
path: 'search',
params: {
q: this.$route.query.search_query,
filter: this.$route.query.filter ?? 'all'
filter: this.filterValue
}
})
},
+13
View File
@@ -27,6 +27,19 @@
"lastWatchedTill": "Last watched till {t}",
"watchedAgo": "Watched {t} till {p}"
},
"search_results": {
"filterLabel": "Filter results by type",
"result_types": {
"all": "All videos",
"videos": "Ordinary videos",
"channels": "Channels",
"playlists": "Playlists",
"music_songs": "Songs (YouTube Music)",
"music_videos": "Music Videos (YouTube Music)",
"music_albums": "Albums (YouTube Music)",
"music_playlists": "Playlists (YouTube Music)"
}
},
"video_sharing_panel": {
"title": "Share this video",
"share": "Share",