mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-07 04:18:48 +02:00
Add translation strings for download dialogs and notification
This commit is contained in:
+22
-1
@@ -1,4 +1,6 @@
|
||||
import Vue from 'vue'
|
||||
import { Capacitor } from '@capacitor/core'
|
||||
import { AbsDownloader, AbsFileSystem } from '@/plugins/capacitor'
|
||||
import enUsStrings from '../strings/en-us.json'
|
||||
|
||||
const defaultCode = 'en-us'
|
||||
@@ -41,6 +43,24 @@ function supplant(str, subs) {
|
||||
})
|
||||
}
|
||||
|
||||
function syncDownloadNotificationStrings() {
|
||||
if (Capacitor.getPlatform() !== 'android') return
|
||||
AbsDownloader.setDownloadNotificationStrings({
|
||||
preparing: Vue.prototype.$strings.MessagePreparingDownloads,
|
||||
downloadingFile: Vue.prototype.$strings.MessageDownloadingFile,
|
||||
waitingForStorage: Vue.prototype.$strings.MessageWaitingForAvailableStorage,
|
||||
downloads: Vue.prototype.$strings.HeaderDownloads,
|
||||
cancel: Vue.prototype.$strings.ButtonCancel
|
||||
}).catch((error) => console.warn('Failed to update download notification strings', error))
|
||||
AbsFileSystem.setFolderPickerStrings({
|
||||
writeAccessRequired: Vue.prototype.$strings.MessageStorageWriteAccessRequired,
|
||||
allow: Vue.prototype.$strings.ButtonAllow,
|
||||
cancel: Vue.prototype.$strings.ButtonCancel,
|
||||
accessDenied: Vue.prototype.$strings.MessageStorageAccessDenied,
|
||||
permissionDenied: Vue.prototype.$strings.MessageStoragePermissionDenied
|
||||
}).catch((error) => console.warn('Failed to update folder picker strings', error))
|
||||
}
|
||||
|
||||
Vue.prototype.$languageCodeOptions = Object.keys(languageCodeMap).map((code) => {
|
||||
return {
|
||||
text: languageCodeMap[code].label,
|
||||
@@ -108,6 +128,7 @@ async function loadi18n(code) {
|
||||
}
|
||||
|
||||
Vue.prototype.$setDateFnsLocale(languageCodeMap[code].dateFnsLocale)
|
||||
syncDownloadNotificationStrings()
|
||||
|
||||
this.$eventBus.$emit('change-lang', code)
|
||||
return true
|
||||
@@ -145,5 +166,5 @@ async function initialize() {
|
||||
|
||||
export default ({ app, store }, inject) => {
|
||||
$localStore = app.$localStore
|
||||
initialize()
|
||||
initialize().finally(syncDownloadNotificationStrings)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user