Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let translateWindowTitle use the imported i18n instance #5745

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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