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:
parent
197abb21d5
commit
f8eff0e422
|
@ -24,7 +24,10 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
externalPlayerNames: function () {
|
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 () {
|
externalPlayerValues: function () {
|
||||||
return this.$store.getters.getExternalPlayerValues
|
return this.$store.getters.getExternalPlayerValues
|
||||||
|
|
|
@ -107,6 +107,7 @@ const state = {
|
||||||
'#B4BEFE'
|
'#B4BEFE'
|
||||||
],
|
],
|
||||||
externalPlayerNames: [],
|
externalPlayerNames: [],
|
||||||
|
externalPlayerNameTranslationKeys: [],
|
||||||
externalPlayerValues: [],
|
externalPlayerValues: [],
|
||||||
externalPlayerCmdArguments: {}
|
externalPlayerCmdArguments: {}
|
||||||
}
|
}
|
||||||
|
@ -168,6 +169,10 @@ const getters = {
|
||||||
return state.externalPlayerNames
|
return state.externalPlayerNames
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getExternalPlayerNameTranslationKeys () {
|
||||||
|
return state.externalPlayerNameTranslationKeys
|
||||||
|
},
|
||||||
|
|
||||||
getExternalPlayerValues () {
|
getExternalPlayerValues () {
|
||||||
return state.externalPlayerValues
|
return state.externalPlayerValues
|
||||||
},
|
},
|
||||||
|
@ -939,10 +944,11 @@ const actions = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const externalPlayerMap = JSON.parse(fileData).map((entry) => {
|
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 externalPlayerNames = externalPlayerMap.map((entry) => { return entry.name })
|
||||||
|
const externalPlayerNameTranslationKeys = externalPlayerMap.map((entry) => { return entry.nameTranslationKey })
|
||||||
const externalPlayerValues = externalPlayerMap.map((entry) => { return entry.value })
|
const externalPlayerValues = externalPlayerMap.map((entry) => { return entry.value })
|
||||||
const externalPlayerCmdArguments = externalPlayerMap.reduce((result, item) => {
|
const externalPlayerCmdArguments = externalPlayerMap.reduce((result, item) => {
|
||||||
result[item.value] = item.cmdArguments
|
result[item.value] = item.cmdArguments
|
||||||
|
@ -950,6 +956,7 @@ const actions = {
|
||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
commit('setExternalPlayerNames', externalPlayerNames)
|
commit('setExternalPlayerNames', externalPlayerNames)
|
||||||
|
commit('setExternalPlayerNameTranslationKeys', externalPlayerNameTranslationKeys)
|
||||||
commit('setExternalPlayerValues', externalPlayerValues)
|
commit('setExternalPlayerValues', externalPlayerValues)
|
||||||
commit('setExternalPlayerCmdArguments', externalPlayerCmdArguments)
|
commit('setExternalPlayerCmdArguments', externalPlayerCmdArguments)
|
||||||
},
|
},
|
||||||
|
@ -1162,6 +1169,10 @@ const mutations = {
|
||||||
state.externalPlayerNames = value
|
state.externalPlayerNames = value
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setExternalPlayerNameTranslationKeys (state, value) {
|
||||||
|
state.externalPlayerNameTranslationKeys = value
|
||||||
|
},
|
||||||
|
|
||||||
setExternalPlayerValues (state, value) {
|
setExternalPlayerValues (state, value) {
|
||||||
state.externalPlayerValues = value
|
state.externalPlayerValues = value
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "None",
|
"name": "None",
|
||||||
|
"nameTranslationKey": "Settings.External Player Settings.Players.None.Name",
|
||||||
"value": "",
|
"value": "",
|
||||||
"cmdArguments": null
|
"cmdArguments": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "mpv",
|
"name": "mpv",
|
||||||
|
"nameTranslationKey": "Settings.External Player Settings.Players.mpv.Name",
|
||||||
"value": "mpv",
|
"value": "mpv",
|
||||||
"cmdArguments": {
|
"cmdArguments": {
|
||||||
"defaultExecutable": "mpv",
|
"defaultExecutable": "mpv",
|
||||||
|
@ -23,6 +25,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "VLC",
|
"name": "VLC",
|
||||||
|
"nameTranslationKey": "Settings.External Player Settings.Players.VLC.Name",
|
||||||
"value": "vlc",
|
"value": "vlc",
|
||||||
"cmdArguments": {
|
"cmdArguments": {
|
||||||
"defaultExecutable": "vlc",
|
"defaultExecutable": "vlc",
|
||||||
|
@ -40,6 +43,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "iina",
|
"name": "iina",
|
||||||
|
"nameTranslationKey": "Settings.External Player Settings.Players.iina.Name",
|
||||||
"value": "iina",
|
"value": "iina",
|
||||||
"cmdArguments": {
|
"cmdArguments": {
|
||||||
"defaultExecutable": "iina",
|
"defaultExecutable": "iina",
|
||||||
|
|
|
@ -279,6 +279,9 @@ Settings:
|
||||||
Ignore Unsupported Action Warnings: Ignore Unsupported Action Warnings
|
Ignore Unsupported Action Warnings: Ignore Unsupported Action Warnings
|
||||||
Custom External Player Executable: Custom External Player Executable
|
Custom External Player Executable: Custom External Player Executable
|
||||||
Custom External Player Arguments: Custom External Player Arguments
|
Custom External Player Arguments: Custom External Player Arguments
|
||||||
|
Players:
|
||||||
|
None:
|
||||||
|
Name: None
|
||||||
Privacy Settings:
|
Privacy Settings:
|
||||||
Privacy Settings: Privacy Settings
|
Privacy Settings: Privacy Settings
|
||||||
Remember History: Remember History
|
Remember History: Remember History
|
||||||
|
|
|
@ -383,6 +383,9 @@ Settings:
|
||||||
Ignore Unsupported Action Warnings: Omitir advertencias sobre acciones no soportadas
|
Ignore Unsupported Action Warnings: Omitir advertencias sobre acciones no soportadas
|
||||||
External Player: Reproductor externo
|
External Player: Reproductor externo
|
||||||
External Player Settings: Reproductor externo
|
External Player Settings: Reproductor externo
|
||||||
|
Players:
|
||||||
|
None:
|
||||||
|
Name: Ninguno
|
||||||
Download Settings:
|
Download Settings:
|
||||||
Download Settings: Descargas
|
Download Settings: Descargas
|
||||||
Ask Download Path: Preguntar ruta de descarga
|
Ask Download Path: Preguntar ruta de descarga
|
||||||
|
|
Loading…
Reference in New Issue