Add translation strings for download dialogs and notification

This commit is contained in:
Nicholas Wallace
2026-07-20 20:01:02 -07:00
parent 6282fd1f95
commit 58fbfca645
6 changed files with 145 additions and 18 deletions
+22 -1
View File
@@ -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)
}