Translate window titles (#1321)
* Update Titles to change based on locale * Update Title on Forward/Backwards navigation * Revert "Update Title on Forward/Backwards navigation" This reverts commit 0a57825e920911275dcabfbb36d44712a452da15. * Translate Window Titles -Updated en-US & en_GB localization files to include 'Playlist" and "Profile Settings" - Updated app to dynamically change titles + translate (App.js sets title instead of router now) - Channel & Video get title based on Channel Name & Video name (changing those titles are in their respective views) * Revert "Update Titles to change based on locale" This reverts commit 9e8081606710c2a63655dc33594c542af7826df8. * Re-add update title to channel view * fix playlist title * Fix 'Edit Profile' title
This commit is contained in:
parent
6522521b88
commit
93a48ffe24
|
@ -71,6 +71,20 @@ export default Vue.extend({
|
||||||
profileList: function () {
|
profileList: function () {
|
||||||
return this.$store.getters.getProfileList
|
return this.$store.getters.getProfileList
|
||||||
},
|
},
|
||||||
|
windowTitle: function () {
|
||||||
|
if (this.$route.meta.title !== 'Channel' && this.$route.meta.title !== 'Watch') {
|
||||||
|
let title =
|
||||||
|
this.$route.meta.path === '/home'
|
||||||
|
? process.env.PRODUCT_NAME
|
||||||
|
: `${this.$t(this.$route.meta.title)} - ${process.env.PRODUCT_NAME}`
|
||||||
|
if (!title) {
|
||||||
|
title = process.env.PRODUCT_NAME
|
||||||
|
}
|
||||||
|
return title
|
||||||
|
} else {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
},
|
||||||
activeProfile: function () {
|
activeProfile: function () {
|
||||||
return this.$store.getters.getActiveProfile
|
return this.$store.getters.getActiveProfile
|
||||||
},
|
},
|
||||||
|
@ -84,6 +98,12 @@ export default Vue.extend({
|
||||||
return this.$store.getters.getDefaultInvidiousInstance
|
return this.$store.getters.getDefaultInvidiousInstance
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
windowTitle: 'setWindowTitle'
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
this.setWindowTitle()
|
||||||
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
this.grabUserSettings().then(async () => {
|
this.grabUserSettings().then(async () => {
|
||||||
await this.fetchInvidiousInstances()
|
await this.fetchInvidiousInstances()
|
||||||
|
@ -383,6 +403,11 @@ export default Vue.extend({
|
||||||
'setInvidiousInstancesList'
|
'setInvidiousInstancesList'
|
||||||
]),
|
]),
|
||||||
|
|
||||||
|
setWindowTitle: function() {
|
||||||
|
if (this.windowTitle !== null) {
|
||||||
|
document.title = this.windowTitle
|
||||||
|
}
|
||||||
|
},
|
||||||
...mapActions([
|
...mapActions([
|
||||||
'showToast',
|
'showToast',
|
||||||
'openExternalLink',
|
'openExternalLink',
|
||||||
|
|
|
@ -21,7 +21,7 @@ const router = new Router({
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Subscriptions',
|
title: 'Subscriptions.Subscriptions',
|
||||||
icon: 'fa-home'
|
icon: 'fa-home'
|
||||||
},
|
},
|
||||||
component: Subscriptions
|
component: Subscriptions
|
||||||
|
@ -29,7 +29,7 @@ const router = new Router({
|
||||||
{
|
{
|
||||||
path: '/subscriptions',
|
path: '/subscriptions',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Subscriptions',
|
title: 'Subscriptions.Subscriptions',
|
||||||
icon: 'fa-home'
|
icon: 'fa-home'
|
||||||
},
|
},
|
||||||
component: Subscriptions
|
component: Subscriptions
|
||||||
|
@ -37,7 +37,7 @@ const router = new Router({
|
||||||
{
|
{
|
||||||
path: '/settings/profile',
|
path: '/settings/profile',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Profile Settings',
|
title: 'Profile.Profile Settings',
|
||||||
icon: 'fa-home'
|
icon: 'fa-home'
|
||||||
},
|
},
|
||||||
component: ProfileSettings
|
component: ProfileSettings
|
||||||
|
@ -46,7 +46,7 @@ const router = new Router({
|
||||||
path: '/settings/profile/new',
|
path: '/settings/profile/new',
|
||||||
name: 'newProfile',
|
name: 'newProfile',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'New Profile',
|
title: 'Profile.Create New Profile',
|
||||||
icon: 'fa-home'
|
icon: 'fa-home'
|
||||||
},
|
},
|
||||||
component: ProfileEdit
|
component: ProfileEdit
|
||||||
|
@ -55,7 +55,7 @@ const router = new Router({
|
||||||
path: '/settings/profile/edit/:id',
|
path: '/settings/profile/edit/:id',
|
||||||
name: 'editProfile',
|
name: 'editProfile',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Edit Profile',
|
title: 'Profile.Edit Profile',
|
||||||
icon: 'fa-home'
|
icon: 'fa-home'
|
||||||
},
|
},
|
||||||
component: ProfileEdit
|
component: ProfileEdit
|
||||||
|
@ -79,7 +79,7 @@ const router = new Router({
|
||||||
{
|
{
|
||||||
path: '/userplaylists',
|
path: '/userplaylists',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'User Playlists',
|
title: 'User Playlists.Your Playlists',
|
||||||
icon: 'fa-home'
|
icon: 'fa-home'
|
||||||
},
|
},
|
||||||
component: UserPlaylists
|
component: UserPlaylists
|
||||||
|
@ -88,7 +88,7 @@ const router = new Router({
|
||||||
path: '/history',
|
path: '/history',
|
||||||
name: 'history',
|
name: 'history',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'History',
|
title: 'History.History',
|
||||||
icon: 'fa-home'
|
icon: 'fa-home'
|
||||||
},
|
},
|
||||||
component: History
|
component: History
|
||||||
|
@ -96,7 +96,7 @@ const router = new Router({
|
||||||
{
|
{
|
||||||
path: '/settings',
|
path: '/settings',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Settings',
|
title: 'Settings.Settings',
|
||||||
icon: 'fa-home'
|
icon: 'fa-home'
|
||||||
},
|
},
|
||||||
component: Settings
|
component: Settings
|
||||||
|
@ -104,7 +104,7 @@ const router = new Router({
|
||||||
{
|
{
|
||||||
path: '/about',
|
path: '/about',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'About',
|
title: 'About.About',
|
||||||
icon: 'fa-home'
|
icon: 'fa-home'
|
||||||
},
|
},
|
||||||
component: About
|
component: About
|
||||||
|
@ -112,7 +112,7 @@ const router = new Router({
|
||||||
{
|
{
|
||||||
path: '/search/:query',
|
path: '/search/:query',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Search',
|
title: 'Search Filters.Search Results',
|
||||||
icon: 'fa-home'
|
icon: 'fa-home'
|
||||||
},
|
},
|
||||||
component: Search
|
component: Search
|
||||||
|
@ -120,7 +120,7 @@ const router = new Router({
|
||||||
{
|
{
|
||||||
path: '/playlist/:id',
|
path: '/playlist/:id',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Playlist',
|
title: 'Playlist.Playlist',
|
||||||
icon: 'fa-home'
|
icon: 'fa-home'
|
||||||
},
|
},
|
||||||
component: Playlist
|
component: Playlist
|
||||||
|
@ -155,18 +155,4 @@ const router = new Router({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// dynamically set application title to current view
|
|
||||||
router.afterEach(to => {
|
|
||||||
let title =
|
|
||||||
to.path === '/home'
|
|
||||||
? process.env.PRODUCT_NAME
|
|
||||||
: `${to.meta.title} - ${process.env.PRODUCT_NAME}`
|
|
||||||
|
|
||||||
if (!title) {
|
|
||||||
title = 'Home'
|
|
||||||
}
|
|
||||||
|
|
||||||
document.title = title
|
|
||||||
})
|
|
||||||
|
|
||||||
export default router
|
export default router
|
||||||
|
|
|
@ -250,6 +250,7 @@ export default Vue.extend({
|
||||||
ytch.getChannelInfo(this.id).then((response) => {
|
ytch.getChannelInfo(this.id).then((response) => {
|
||||||
this.id = response.authorId
|
this.id = response.authorId
|
||||||
this.channelName = response.author
|
this.channelName = response.author
|
||||||
|
document.title = `${this.channelName} - ${process.env.PRODUCT_NAME}`
|
||||||
if (this.hideChannelSubscriptions || response.subscriberCount === 0) {
|
if (this.hideChannelSubscriptions || response.subscriberCount === 0) {
|
||||||
this.subCount = null
|
this.subCount = null
|
||||||
} else {
|
} else {
|
||||||
|
@ -344,6 +345,7 @@ export default Vue.extend({
|
||||||
this.invidiousGetChannelInfo(this.id).then((response) => {
|
this.invidiousGetChannelInfo(this.id).then((response) => {
|
||||||
console.log(response)
|
console.log(response)
|
||||||
this.channelName = response.author
|
this.channelName = response.author
|
||||||
|
document.title = `${this.channelName} - ${process.env.PRODUCT_NAME}`
|
||||||
this.id = response.authorId
|
this.id = response.authorId
|
||||||
if (this.hideChannelSubscriptions) {
|
if (this.hideChannelSubscriptions) {
|
||||||
this.subCount = null
|
this.subCount = null
|
||||||
|
|
|
@ -327,6 +327,7 @@ About:
|
||||||
Donate: Donate
|
Donate: Donate
|
||||||
|
|
||||||
Profile:
|
Profile:
|
||||||
|
Profile Settings: Profile Settings
|
||||||
Profile Select: Profile Select
|
Profile Select: Profile Select
|
||||||
Profile Filter: Profile Filter
|
Profile Filter: Profile Filter
|
||||||
All Channels: All Channels
|
All Channels: All Channels
|
||||||
|
@ -525,6 +526,7 @@ Videos:
|
||||||
#& Playlists
|
#& Playlists
|
||||||
Playlist:
|
Playlist:
|
||||||
#& About
|
#& About
|
||||||
|
Playlist: Playlist
|
||||||
View Full Playlist: View Full Playlist
|
View Full Playlist: View Full Playlist
|
||||||
Videos: Videos
|
Videos: Videos
|
||||||
View: View
|
View: View
|
||||||
|
|
|
@ -372,6 +372,7 @@ About:
|
||||||
Licensed under the AGPLv3: Licensed under the AGPLv3
|
Licensed under the AGPLv3: Licensed under the AGPLv3
|
||||||
Source code: Source code
|
Source code: Source code
|
||||||
Profile:
|
Profile:
|
||||||
|
Profile Settings: Profile Settings
|
||||||
Profile Select: 'Profile Select'
|
Profile Select: 'Profile Select'
|
||||||
All Channels: 'All Channels'
|
All Channels: 'All Channels'
|
||||||
Profile Manager: 'Profile Manager'
|
Profile Manager: 'Profile Manager'
|
||||||
|
@ -572,6 +573,7 @@ Videos:
|
||||||
#& Playlists
|
#& Playlists
|
||||||
Playlist:
|
Playlist:
|
||||||
#& About
|
#& About
|
||||||
|
Playlist: Playlist
|
||||||
View Full Playlist: 'View Full Playlist'
|
View Full Playlist: 'View Full Playlist'
|
||||||
Videos: 'Videos'
|
Videos: 'Videos'
|
||||||
View: 'View'
|
View: 'View'
|
||||||
|
|
Loading…
Reference in New Issue