Skip to content

Commit

Permalink
Let translateWindowTitle use the imported i18n instance (#5745)
Browse files Browse the repository at this point in the history
  • Loading branch information
absidue committed Sep 28, 2024
1 parent 9f697c9 commit 008dafa
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/renderer/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default defineComponent({
windowTitle: function () {
const routePath = this.$route.path
if (!routePath.startsWith('/channel/') && !routePath.startsWith('/watch/') && !routePath.startsWith('/hashtag/') && !routePath.startsWith('/playlist/')) {
let title = translateWindowTitle(this.$route.meta.title, this.$i18n)
let title = translateWindowTitle(this.$route.meta.title)
if (!title) {
title = packageDetails.productName
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default defineComponent({
return this.$router.getRoutes().filter((route) => includedPageNames.includes(route.name))
},
defaultPageNames: function () {
return this.defaultPages.map((route) => translateWindowTitle(route.meta.title, this.$i18n))
return this.defaultPages.map((route) => translateWindowTitle(route.meta.title))
},
defaultPageValues: function () {
// avoid Vue parsing issues by excluding '/' from path values
Expand Down
3 changes: 1 addition & 2 deletions src/renderer/components/top-nav/top-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ export default defineComponent({
{
page: translateWindowTitle(this.$router.getRoutes()
.find((route) => route.path === '/' + this.landingPage)
.meta.title,
this.$i18n
.meta.title
)
})
},
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/helpers/strings.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import i18n from '../i18n/index'

/**
* This will return true if a string is null, undefined or empty.
* @param {string|null|undefined} _string the string to process
Expand All @@ -24,7 +26,7 @@ export function isKeyboardEventKeyPrintableChar(eventKey) {
return false
}

export function translateWindowTitle(title, i18n) {
export function translateWindowTitle(title) {
switch (title) {
case 'Subscriptions':
return i18n.t('Subscriptions.Subscriptions')
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// import the styles
import Vue from 'vue'
import App from './App.vue'
import i18n from './i18n/index'
import router from './router/index'
import store from './store/index'
import i18n from './i18n/index'
import App from './App.vue'
import { IpcChannels } from '../constants'
import { library } from '@fortawesome/fontawesome-svg-core'

Expand Down

0 comments on commit 008dafa

Please sign in to comment.