External player choice 'None' translated in Settings (#2075)

* External player choice 'None' translated in Settings

* requested fix related to Vue i18n import

* suggested changes using translation key and fallback to player name
This commit is contained in:
9ekaitz 2022-08-10 23:52:31 +02:00 committed by GitHub
parent 197abb21d5
commit f8eff0e422
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 2 deletions

View File

@ -24,7 +24,10 @@ export default Vue.extend({
},
externalPlayerNames: function () {
return this.$store.getters.getExternalPlayerNames
const fallbackNames = this.$store.getters.getExternalPlayerNames
const nameTranslationKeys = this.$store.getters.getExternalPlayerNameTranslationKeys
return nameTranslationKeys.map((translationKey, idx) => this.$te(translationKey) ? this.$t(translationKey) : fallbackNames[idx])
},
externalPlayerValues: function () {
return this.$store.getters.getExternalPlayerValues

View File

@ -107,6 +107,7 @@ const state = {
'#B4BEFE'
],
externalPlayerNames: [],
externalPlayerNameTranslationKeys: [],
externalPlayerValues: [],
externalPlayerCmdArguments: {}
}
@ -168,6 +169,10 @@ const getters = {
return state.externalPlayerNames
},
getExternalPlayerNameTranslationKeys () {
return state.externalPlayerNameTranslationKeys
},
getExternalPlayerValues () {
return state.externalPlayerValues
},
@ -939,10 +944,11 @@ const actions = {
}
const externalPlayerMap = JSON.parse(fileData).map((entry) => {
return { name: entry.name, value: entry.value, cmdArguments: entry.cmdArguments }
return { name: entry.name, nameTranslationKey: entry.nameTranslationKey, value: entry.value, cmdArguments: entry.cmdArguments }
})
const externalPlayerNames = externalPlayerMap.map((entry) => { return entry.name })
const externalPlayerNameTranslationKeys = externalPlayerMap.map((entry) => { return entry.nameTranslationKey })
const externalPlayerValues = externalPlayerMap.map((entry) => { return entry.value })
const externalPlayerCmdArguments = externalPlayerMap.reduce((result, item) => {
result[item.value] = item.cmdArguments
@ -950,6 +956,7 @@ const actions = {
}, {})
commit('setExternalPlayerNames', externalPlayerNames)
commit('setExternalPlayerNameTranslationKeys', externalPlayerNameTranslationKeys)
commit('setExternalPlayerValues', externalPlayerValues)
commit('setExternalPlayerCmdArguments', externalPlayerCmdArguments)
},
@ -1162,6 +1169,10 @@ const mutations = {
state.externalPlayerNames = value
},
setExternalPlayerNameTranslationKeys (state, value) {
state.externalPlayerNameTranslationKeys = value
},
setExternalPlayerValues (state, value) {
state.externalPlayerValues = value
},

View File

@ -1,11 +1,13 @@
[
{
"name": "None",
"nameTranslationKey": "Settings.External Player Settings.Players.None.Name",
"value": "",
"cmdArguments": null
},
{
"name": "mpv",
"nameTranslationKey": "Settings.External Player Settings.Players.mpv.Name",
"value": "mpv",
"cmdArguments": {
"defaultExecutable": "mpv",
@ -23,6 +25,7 @@
},
{
"name": "VLC",
"nameTranslationKey": "Settings.External Player Settings.Players.VLC.Name",
"value": "vlc",
"cmdArguments": {
"defaultExecutable": "vlc",
@ -40,6 +43,7 @@
},
{
"name": "iina",
"nameTranslationKey": "Settings.External Player Settings.Players.iina.Name",
"value": "iina",
"cmdArguments": {
"defaultExecutable": "iina",

View File

@ -279,6 +279,9 @@ Settings:
Ignore Unsupported Action Warnings: Ignore Unsupported Action Warnings
Custom External Player Executable: Custom External Player Executable
Custom External Player Arguments: Custom External Player Arguments
Players:
None:
Name: None
Privacy Settings:
Privacy Settings: Privacy Settings
Remember History: Remember History

View File

@ -383,6 +383,9 @@ Settings:
Ignore Unsupported Action Warnings: Omitir advertencias sobre acciones no soportadas
External Player: Reproductor externo
External Player Settings: Reproductor externo
Players:
None:
Name: Ninguno
Download Settings:
Download Settings: Descargas
Ask Download Path: Preguntar ruta de descarga