From ccc7298213c58eaf39f884426cd374e94baf4fbf Mon Sep 17 00:00:00 2001 From: axolotle Date: Tue, 12 Mar 2024 18:36:14 +0100 Subject: [PATCH] migration(vue-i18n): legacy mode off --- app/src/components/globals/AbstractForm.vue | 2 +- app/src/components/globals/CardForm.vue | 2 +- app/src/components/globals/FormField.vue | 2 +- app/src/components/globals/ReadOnlyField.vue | 8 ++--- app/src/components/globals/ViewSearch.vue | 8 +++-- .../globals/formItems/TagsSelectizeItem.vue | 20 ++++++++---- app/src/i18n/index.js | 3 +- app/src/main.js | 8 ++--- app/src/views/LoginView.vue | 6 ++-- app/src/views/PostInstall.vue | 16 +++++----- app/src/views/_partials/DomainForm.vue | 18 +++++------ app/src/views/app/AppCatalog.vue | 24 +++++++------- app/src/views/app/AppInfo.vue | 12 +++---- app/src/views/app/AppInstall.vue | 16 ++++------ app/src/views/backup/BackupCreate.vue | 6 ++-- app/src/views/backup/BackupInfo.vue | 10 +++--- app/src/views/backup/BackupList.vue | 2 +- app/src/views/backup/BackupView.vue | 2 +- app/src/views/domain/DomainDns.vue | 2 +- app/src/views/domain/DomainInfo.vue | 4 +-- app/src/views/group/GroupCreate.vue | 6 ++-- app/src/views/group/GroupList.vue | 4 +-- app/src/views/service/ServiceInfo.vue | 2 +- app/src/views/tool/ToolFirewall.vue | 32 +++++++++---------- app/src/views/tool/ToolMigrations.vue | 2 +- app/src/views/tool/ToolPower.vue | 2 +- app/src/views/tool/ToolWebadmin.vue | 20 ++++++------ app/src/views/update/SystemUpdate.vue | 12 +++---- app/src/views/user/UserCreate.vue | 18 +++++------ app/src/views/user/UserEdit.vue | 28 ++++++++-------- app/src/views/user/UserImport.vue | 18 +++++------ 31 files changed, 156 insertions(+), 159 deletions(-) diff --git a/app/src/components/globals/AbstractForm.vue b/app/src/components/globals/AbstractForm.vue index 767fc9f2..273073ca 100644 --- a/app/src/components/globals/AbstractForm.vue +++ b/app/src/components/globals/AbstractForm.vue @@ -48,7 +48,7 @@ export default { errorFeedback() { if (this.serverError) return this.serverError else if (this.validation && this.validation.$errors.length) { - return this.$i18n.t('form_errors.invalid_form') + return this.$t('form_errors.invalid_form') } else return '' }, }, diff --git a/app/src/components/globals/CardForm.vue b/app/src/components/globals/CardForm.vue index 16e8d0ad..c63bbbeb 100644 --- a/app/src/components/globals/CardForm.vue +++ b/app/src/components/globals/CardForm.vue @@ -53,7 +53,7 @@ export default { errorFeedback() { if (this.serverError) return this.serverError else if (this.validation && this.validation.$errors.length) { - return this.$i18n.t('form_errors.invalid_form') + return this.$t('form_errors.invalid_form') } else return '' }, }, diff --git a/app/src/components/globals/FormField.vue b/app/src/components/globals/FormField.vue index bba49ece..e08692e7 100644 --- a/app/src/components/globals/FormField.vue +++ b/app/src/components/globals/FormField.vue @@ -119,7 +119,7 @@ export default { const err = this.error if (err) { if (err.$message) return err.$message - return this.$i18n.t('form_errors.' + err.$validator, { + return this.$t('form_errors.' + err.$validator, { value: err.$model, ...err.$params, }) diff --git a/app/src/components/globals/ReadOnlyField.vue b/app/src/components/globals/ReadOnlyField.vue index 39949a72..0a631a69 100644 --- a/app/src/components/globals/ReadOnlyField.vue +++ b/app/src/components/globals/ReadOnlyField.vue @@ -38,15 +38,13 @@ export default { parseValue(value) { const item = this.component if (item === 'FileItem') value = value.file ? value.file.name : null - if (item === 'CheckboxItem') value = this.$i18n.t(value ? 'yes' : 'no') + if (item === 'CheckboxItem') value = this.$t(value ? 'yes' : 'no') if (item === 'TextAreaItem') value = value.replaceAll('\n', '
') if (Array.isArray(value)) { - value = value.length - ? value.join(this.$i18n.t('words.separator')) - : null + value = value.length ? value.join(this.$t('words.separator')) : null } if ([null, undefined, ''].includes(this.value)) - value = this.$i18n.t('words.none') + value = this.$t('words.none') return value }, }, diff --git a/app/src/components/globals/ViewSearch.vue b/app/src/components/globals/ViewSearch.vue index cd2d7f06..94073c98 100644 --- a/app/src/components/globals/ViewSearch.vue +++ b/app/src/components/globals/ViewSearch.vue @@ -14,7 +14,7 @@ :value="search" @input="$emit('update:search', $event)" :placeholder=" - $t('search.for', { items: $tc('items.' + itemsName, 2) }) + $t('search.for', { items: $t('items.' + itemsName, 2) }) " :disabled="!items" /> @@ -33,10 +33,12 @@ {{ - $tc( + $t( items === null ? 'items_verbose_count' : 'search.not_found', + { + items: $t('items.' + itemsName, 0), + }, 0, - { items: $tc('items.' + itemsName, 0) }, ) }} diff --git a/app/src/components/globals/formItems/TagsSelectizeItem.vue b/app/src/components/globals/formItems/TagsSelectizeItem.vue index dd161f12..685576c4 100644 --- a/app/src/components/globals/formItems/TagsSelectizeItem.vue +++ b/app/src/components/globals/formItems/TagsSelectizeItem.vue @@ -49,9 +49,13 @@ label-size="sm" :label-for="id + '-search-input'" :invalid-feedback=" - $tc('search.not_found', 0, { - items: $tc('items.' + itemsName, 0), - }) + $t( + 'search.not_found', + { + items: $t('items.' + itemsName, 0), + }, + 0, + ) " :state="searchState" :disabled="disabled" @@ -80,9 +84,13 @@ {{ - $tc('items_verbose_items_left', 0, { - items: $tc('items.' + itemsName, 0), - }) + $t( + 'items_verbose_items_left', + { + items: $t('items.' + itemsName, 0), + }, + 0, + ) }} diff --git a/app/src/i18n/index.js b/app/src/i18n/index.js index df48cfc5..fa6e965e 100644 --- a/app/src/i18n/index.js +++ b/app/src/i18n/index.js @@ -6,6 +6,5 @@ import { createI18n } from 'vue-i18n' export default createI18n({ - // FIXME - legacy: true, + legacy: false, }) diff --git a/app/src/main.js b/app/src/main.js index c6bd4686..f130934e 100644 --- a/app/src/main.js +++ b/app/src/main.js @@ -36,8 +36,8 @@ app.use(VueShowdownPlugin, { // FIXME find or wait for a better way app.config.globalProperties.$askConfirmation = function (message, props) { return this.$bvModal.msgBoxConfirm(message, { - okTitle: this.$i18n.t('ok'), - cancelTitle: this.$i18n.t('cancel'), + okTitle: this.$t('ok'), + cancelTitle: this.$t('cancel'), bodyBgVariant: 'warning', centered: true, bodyClass: [ @@ -58,8 +58,8 @@ app.config.globalProperties.$askMdConfirmation = function ( props: { markdown, flavor: 'github', options: { headerLevelStart: 4 } }, }) return this.$bvModal['msgBox' + (ok ? 'Ok' : 'Confirm')](content, { - okTitle: this.$i18n.t('yes'), - cancelTitle: this.$i18n.t('cancel'), + okTitle: this.$t('yes'), + cancelTitle: this.$t('cancel'), headerBgVariant: 'warning', headerClass: store.state.theme ? 'text-white' : 'text-black', centered: true, diff --git a/app/src/views/LoginView.vue b/app/src/views/LoginView.vue index a05bb197..7e4f9435 100644 --- a/app/src/views/LoginView.vue +++ b/app/src/views/LoginView.vue @@ -60,14 +60,14 @@ export default { }, fields: { username: { - label: this.$i18n.t('user_username'), + label: this.$t('user_username'), props: { id: 'username', autocomplete: 'username', }, }, password: { - label: this.$i18n.t('password'), + label: this.$t('password'), props: { id: 'password', type: 'password', @@ -109,7 +109,7 @@ export default { }) .catch((err) => { if (err.name !== 'APIUnauthorizedError') throw err - this.serverError = this.$i18n.t('wrong_password_or_username') + this.serverError = this.$t('wrong_password_or_username') }) }, }, diff --git a/app/src/views/PostInstall.vue b/app/src/views/PostInstall.vue index 8b1e92e0..ac9c0dd4 100644 --- a/app/src/views/PostInstall.vue +++ b/app/src/views/PostInstall.vue @@ -132,30 +132,30 @@ export default { fields: { username: { - label: this.$i18n.t('user_username'), + label: this.$t('user_username'), props: { id: 'username', - placeholder: this.$i18n.t('placeholder.username'), + placeholder: this.$t('placeholder.username'), }, }, fullname: { - label: this.$i18n.t('user_fullname'), + label: this.$t('user_fullname'), props: { id: 'fullname', - placeholder: this.$i18n.t('placeholder.fullname'), + placeholder: this.$t('placeholder.fullname'), }, }, password: { - label: this.$i18n.t('password'), - description: this.$i18n.t('good_practices_about_admin_password'), + label: this.$t('password'), + description: this.$t('good_practices_about_admin_password'), descriptionVariant: 'warning', props: { id: 'password', placeholder: '••••••••', type: 'password' }, }, confirmation: { - label: this.$i18n.t('password_confirmation'), + label: this.$t('password_confirmation'), props: { id: 'confirmation', placeholder: '••••••••', @@ -180,7 +180,7 @@ export default { async setUser() { const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_postinstall', { domain: this.domain }), + this.$t('confirm_postinstall', { domain: this.domain }), ) if (!confirmed) return this.performPostInstall() diff --git a/app/src/views/_partials/DomainForm.vue b/app/src/views/_partials/DomainForm.vue index 3ede67f6..28de1fba 100644 --- a/app/src/views/_partials/DomainForm.vue +++ b/app/src/views/_partials/DomainForm.vue @@ -157,26 +157,26 @@ export default { fields: { domain: { - label: this.$i18n.t('domain_name'), + label: this.$t('domain_name'), props: { id: 'domain', - placeholder: this.$i18n.t('placeholder.domain'), + placeholder: this.$t('placeholder.domain'), }, }, dynDomain: { - label: this.$i18n.t('domain_name'), + label: this.$t('domain_name'), props: { id: 'dyn-domain', - placeholder: this.$i18n.t('placeholder.domain').split('.')[0], + placeholder: this.$t('placeholder.domain').split('.')[0], type: 'domain', choices: ['nohost.me', 'noho.st', 'ynh.fr'], }, }, dynDomainPassword: { - label: this.$i18n.t('domain.add.dyn_dns_password'), - description: this.$i18n.t('domain.add.dyn_dns_password_desc'), + label: this.$t('domain.add.dyn_dns_password'), + description: this.$t('domain.add.dyn_dns_password_desc'), props: { id: 'dyn-dns-password', placeholder: '••••••••', @@ -185,7 +185,7 @@ export default { }, dynDomainPasswordConfirmation: { - label: this.$i18n.t('password_confirmation'), + label: this.$t('password_confirmation'), props: { id: 'dyn-dns-password-confirmation', placeholder: '••••••••', @@ -194,10 +194,10 @@ export default { }, localDomain: { - label: this.$i18n.t('domain_name'), + label: this.$t('domain_name'), props: { id: 'dyn-domain', - placeholder: this.$i18n.t('placeholder.domain').split('.')[0], + placeholder: this.$t('placeholder.domain').split('.')[0], type: 'domain', choices: ['local', 'test'], }, diff --git a/app/src/views/app/AppCatalog.vue b/app/src/views/app/AppCatalog.vue index edc67c49..5f6afe7f 100644 --- a/app/src/views/app/AppCatalog.vue +++ b/app/src/views/app/AppCatalog.vue @@ -15,7 +15,7 @@ @@ -257,24 +257,24 @@ export default { // Filtering options qualityOptions: [ - { value: 'high_quality', text: this.$i18n.t('only_highquality_apps') }, + { value: 'high_quality', text: this.$t('only_highquality_apps') }, { value: 'decent_quality', - text: this.$i18n.t('only_decent_quality_apps'), + text: this.$t('only_decent_quality_apps'), }, - { value: 'working', text: this.$i18n.t('only_working_apps') }, - { value: 'all', text: this.$i18n.t('all_apps') }, + { value: 'working', text: this.$t('only_working_apps') }, + { value: 'all', text: this.$t('all_apps') }, ], categories: [ - { text: this.$i18n.t('app_choose_category'), value: null }, - { text: this.$i18n.t('all_apps'), value: 'all', icon: 'search' }, + { text: this.$t('app_choose_category'), value: null }, + { text: this.$t('all_apps'), value: 'all', icon: 'search' }, // The rest is filled from api data ], // Custom install form customInstall: { field: { - label: this.$i18n.t('url'), + label: this.$t('url'), props: { id: 'custom-install', placeholder: 'https://some.git.forge.tld/USER/REPOSITORY', @@ -321,11 +321,11 @@ export default { (cat) => cat.value === this.category, ) if (category.subtags) { - const subtags = [{ text: this.$i18n.t('all'), value: 'all' }] + const subtags = [{ text: this.$t('all'), value: 'all' }] category.subtags.forEach((subtag) => { subtags.push({ text: subtag.title, value: subtag.id }) }) - subtags.push({ text: this.$i18n.t('others'), value: 'others' }) + subtags.push({ text: this.$t('others'), value: 'others' }) return subtags } } @@ -404,7 +404,7 @@ export default { const app = this.apps.find((app) => app.id === appId) if (!app.decent_quality) { const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_install_app_' + app.state), + this.$t('confirm_install_app_' + app.state), ) if (!confirmed) return } @@ -414,7 +414,7 @@ export default { // INSTALL CUSTOM APP async onCustomInstallClick() { const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_install_custom_app'), + this.$t('confirm_install_custom_app'), ) if (!confirmed) return diff --git a/app/src/views/app/AppInfo.vue b/app/src/views/app/AppInfo.vue index 860c2034..435074de 100644 --- a/app/src/views/app/AppInfo.vue +++ b/app/src/views/app/AppInfo.vue @@ -411,7 +411,7 @@ export default { { hasApplyButton: false, id: 'operations', - name: this.$i18n.t('operations'), + name: this.$t('operations'), }, ], validations: {}, @@ -467,7 +467,7 @@ export default { const mainPermission = app.permissions[this.id + '.main'] mainPermission.name = this.id + '.main' - mainPermission.title = this.$i18n.t('permission_main') + mainPermission.title = this.$t('permission_main') mainPermission.tileAvailable = mainPermission.url !== null && !mainPermission.url.startsWith('re:') form.labels.push({ @@ -507,7 +507,7 @@ export default { domain: app.settings.domain, alternativeTo: app.from_catalog.potential_alternative_to?.length ? app.from_catalog.potential_alternative_to.join( - this.$i18n.t('words.separator'), + this.$t('words.separator'), ) : null, description: DESCRIPTION @@ -517,7 +517,7 @@ export default { app.manifest.packaging_format >= 2 ? { archs: Array.isArray(archs) - ? archs.join(this.$i18n.t('words.separator')) + ? archs.join(this.$t('words.separator')) : archs, ldap: ldap === 'not_relevant' ? null : ldap, sso: sso === 'not_relevant' ? null : sso, @@ -647,7 +647,7 @@ export default { async changeUrl() { const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_app_change_url'), + this.$t('confirm_app_change_url'), ) if (!confirmed) return @@ -663,7 +663,7 @@ export default { async setAsDefaultDomain(undo = false) { const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_app_default'), + this.$t('confirm_app_default'), ) if (!confirmed) return diff --git a/app/src/views/app/AppInstall.vue b/app/src/views/app/AppInstall.vue index 1da7fb8f..4922d953 100644 --- a/app/src/views/app/AppInstall.vue +++ b/app/src/views/app/AppInstall.vue @@ -313,9 +313,7 @@ export default { name, alternativeTo: _app.potential_alternative_to && _app.potential_alternative_to.length - ? _app.potential_alternative_to.join( - this.$i18n.t('words.separator'), - ) + ? _app.potential_alternative_to.join(this.$t('words.separator')) : null, description: formatI18nField(_app.doc.DESCRIPTION || _app.description), screenshot: _app.screenshot, @@ -326,7 +324,7 @@ export default { _app.packaging_format >= 2 ? { archs: Array.isArray(archs) - ? archs.join(this.$i18n.t('words.separator')) + ? archs.join(this.$t('words.separator')) : archs, ldap: ldap === 'not_relevant' ? null : ldap, sso: sso === 'not_relevant' ? null : sso, @@ -382,7 +380,7 @@ export default { async performInstall() { if ('path' in this.form && this.form.path === '/') { const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_install_domain_root', { + this.$t('confirm_install_domain_root', { domain: this.form.domain, }), ) @@ -406,16 +404,14 @@ export default { const postInstall = this.formatAppNotifs(notifications) if (postInstall) { const message = - this.$i18n.t('app.install.notifs.post.alert') + - '\n\n' + - postInstall + this.$t('app.install.notifs.post.alert') + '\n\n' + postInstall await this.$askMdConfirmation( message, { - title: this.$i18n.t('app.install.notifs.post.title', { + title: this.$t('app.install.notifs.post.title', { name: this.app.name, }), - okTitle: this.$i18n.t('ok'), + okTitle: this.$t('ok'), }, true, ) diff --git a/app/src/views/backup/BackupCreate.vue b/app/src/views/backup/BackupCreate.vue index 38c6cda8..578faefe 100644 --- a/app/src/views/backup/BackupCreate.vue +++ b/app/src/views/backup/BackupCreate.vue @@ -155,12 +155,12 @@ export default { : hook if (groupId in data) { data[groupId].value.push(hook) - data[groupId].description += ', ' + this.$i18n.t('hook_' + hook) + data[groupId].description += ', ' + this.$t('hook_' + hook) } else { data[groupId] = { - name: this.$i18n.t('hook_' + groupId), + name: this.$t('hook_' + groupId), value: [hook], - description: this.$i18n.t( + description: this.$t( groupId === hook ? `hook_${hook}_desc` : 'hook_' + hook, ), } diff --git a/app/src/views/backup/BackupInfo.vue b/app/src/views/backup/BackupInfo.vue index 891fec74..f4af06bd 100644 --- a/app/src/views/backup/BackupInfo.vue +++ b/app/src/views/backup/BackupInfo.vue @@ -177,13 +177,13 @@ export default { : hook if (groupId in data) { data[groupId].value.push(hook) - data[groupId].description += ', ' + this.$i18n.t('hook_' + hook) + data[groupId].description += ', ' + this.$t('hook_' + hook) data[groupId].size += size } else { data[groupId] = { - name: this.$i18n.t('hook_' + groupId), + name: this.$t('hook_' + groupId), value: [hook], - description: this.$i18n.t( + description: this.$t( groupId === hook ? `hook_${hook}_desc` : 'hook_' + hook, ), size, @@ -216,7 +216,7 @@ export default { async restoreBackup() { const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_restore', { name: this.name }), + this.$t('confirm_restore', { name: this.name }), ) if (!confirmed) return @@ -246,7 +246,7 @@ export default { async deleteBackup() { const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_delete', { name: this.name }), + this.$t('confirm_delete', { name: this.name }), ) if (!confirmed) return diff --git a/app/src/views/backup/BackupList.vue b/app/src/views/backup/BackupList.vue index 5389b086..875f3390 100644 --- a/app/src/views/backup/BackupList.vue +++ b/app/src/views/backup/BackupList.vue @@ -16,7 +16,7 @@ - {{ $tc('items_verbose_count', 0, { items: $tc('items.backups', 0) }) }} + {{ $t('items_verbose_count', { items: $t('items.backups', 0) }, 0) }} diff --git a/app/src/views/backup/BackupView.vue b/app/src/views/backup/BackupView.vue index f94a5f8b..b81f6ff6 100644 --- a/app/src/views/backup/BackupView.vue +++ b/app/src/views/backup/BackupView.vue @@ -31,7 +31,7 @@ export default { storages: [ { id: 'local', - name: this.$i18n.t('local_archives'), + name: this.$t('local_archives'), uri: '/home/yunohost.backup/', }, ], diff --git a/app/src/views/domain/DomainDns.vue b/app/src/views/domain/DomainDns.vue index 4ac881aa..32b5371d 100644 --- a/app/src/views/domain/DomainDns.vue +++ b/app/src/views/domain/DomainDns.vue @@ -247,7 +247,7 @@ export default { async pushDnsChanges() { if (this.force) { const confirmed = await this.$askConfirmation( - this.$i18n.t('domain.dns.push_force_confirm'), + this.$t('domain.dns.push_force_confirm'), ) if (!confirmed) return } diff --git a/app/src/views/domain/DomainInfo.vue b/app/src/views/domain/DomainInfo.vue index b63c7578..824e0da5 100644 --- a/app/src/views/domain/DomainInfo.vue +++ b/app/src/views/domain/DomainInfo.vue @@ -53,7 +53,7 @@ ({{ $t('domain.cert.valid_for', { - days: $tc('day_validity', cert.validity), + days: $t('day_validity', cert.validity), }) }}) @@ -280,7 +280,7 @@ export default { async setAsDefaultDomain() { const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_change_maindomain'), + this.$t('confirm_change_maindomain'), ) if (!confirmed) return diff --git a/app/src/views/group/GroupCreate.vue b/app/src/views/group/GroupCreate.vue index fb571677..ef30e5f0 100644 --- a/app/src/views/group/GroupCreate.vue +++ b/app/src/views/group/GroupCreate.vue @@ -37,11 +37,11 @@ export default { }, serverError: '', groupname: { - label: this.$i18n.t('group_name'), - description: this.$i18n.t('group_format_name_help'), + label: this.$t('group_name'), + description: this.$t('group_format_name_help'), props: { id: 'groupname', - placeholder: this.$i18n.t('placeholder.groupname'), + placeholder: this.$t('placeholder.groupname'), }, }, } diff --git a/app/src/views/group/GroupList.vue b/app/src/views/group/GroupList.vue index aa1f6ed2..56db370e 100644 --- a/app/src/views/group/GroupList.vue +++ b/app/src/views/group/GroupList.vue @@ -265,7 +265,7 @@ export default { const permId = this.permissions.find((perm) => perm.label === option).id if (action === 'add' && ['sftp.main', 'ssh.main'].includes(permId)) { const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_group_add_access_permission', { + this.$t('confirm_group_add_access_permission', { name: groupName, perm: option, }), @@ -311,7 +311,7 @@ export default { async deleteGroup(groupName) { const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_delete', { name: groupName }), + this.$t('confirm_delete', { name: groupName }), ) if (!confirmed) return diff --git a/app/src/views/service/ServiceInfo.vue b/app/src/views/service/ServiceInfo.vue index fd9082e9..57472494 100644 --- a/app/src/views/service/ServiceInfo.vue +++ b/app/src/views/service/ServiceInfo.vue @@ -133,7 +133,7 @@ export default { async updateService(action) { const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_service_' + action, { name: this.name }), + this.$t('confirm_service_' + action, { name: this.name }), ) if (!confirmed) return diff --git a/app/src/views/tool/ToolFirewall.vue b/app/src/views/tool/ToolFirewall.vue index 2c722c2e..c86e6105 100644 --- a/app/src/views/tool/ToolFirewall.vue +++ b/app/src/views/tool/ToolFirewall.vue @@ -140,27 +140,27 @@ export default { // Ports tables data fields: [ - { key: 'port', label: this.$i18n.t('port') }, - { key: 'ipv4', label: this.$i18n.t('ipv4') }, - { key: 'ipv6', label: this.$i18n.t('ipv6') }, - { key: 'uPnP', label: this.$i18n.t('upnp') }, + { key: 'port', label: this.$t('port') }, + { key: 'ipv4', label: this.$t('ipv4') }, + { key: 'ipv6', label: this.$t('ipv6') }, + { key: 'uPnP', label: this.$t('upnp') }, ], protocols: undefined, portToToggle: undefined, // Ports form data actionChoices: [ - { value: 'allow', text: this.$i18n.t('open') }, - { value: 'disallow', text: this.$i18n.t('close') }, + { value: 'allow', text: this.$t('open') }, + { value: 'disallow', text: this.$t('close') }, ], connectionChoices: [ - { value: 'ipv4', text: this.$i18n.t('ipv4') }, - { value: 'ipv6', text: this.$i18n.t('ipv6') }, + { value: 'ipv4', text: this.$t('ipv4') }, + { value: 'ipv6', text: this.$t('ipv6') }, ], protocolChoices: [ - { value: 'TCP', text: this.$i18n.t('tcp') }, - { value: 'UDP', text: this.$i18n.t('udp') }, - { value: 'Both', text: this.$i18n.t('both') }, + { value: 'TCP', text: this.$t('tcp') }, + { value: 'UDP', text: this.$t('udp') }, + { value: 'Both', text: this.$t('both') }, ], form: { action: 'allow', @@ -216,7 +216,7 @@ export default { async togglePort({ action, port, protocol, connection }) { const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_firewall_' + action, { + this.$t('confirm_firewall_' + action, { port, protocol, connection, @@ -226,9 +226,7 @@ export default { return Promise.resolve(confirmed) } - const actionTrad = this.$i18n.t( - { allow: 'open', disallow: 'close' }[action], - ) + const actionTrad = this.$t({ allow: 'open', disallow: 'close' }[action]) return api .put( `firewall/${protocol}/${action}/${port}?${connection}_only`, @@ -248,7 +246,7 @@ export default { async toggleUpnp(value) { const action = this.upnpEnabled ? 'disable' : 'enable' const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_upnp_' + action), + this.$t('confirm_upnp_' + action), ) if (!confirmed) return @@ -256,7 +254,7 @@ export default { .put( 'firewall/upnp/' + action, {}, - { key: 'firewall.upnp', action: this.$i18n.t(action) }, + { key: 'firewall.upnp', action: this.$t(action) }, ) .then(() => { // FIXME Couldn't test when it works. diff --git a/app/src/views/tool/ToolMigrations.vue b/app/src/views/tool/ToolMigrations.vue index 55e749ba..bba1f253 100644 --- a/app/src/views/tool/ToolMigrations.vue +++ b/app/src/views/tool/ToolMigrations.vue @@ -137,7 +137,7 @@ export default { async skipMigration(id) { const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_migrations_skip'), + this.$t('confirm_migrations_skip'), ) if (!confirmed) return api diff --git a/app/src/views/tool/ToolPower.vue b/app/src/views/tool/ToolPower.vue index 0443f043..b9435cb3 100644 --- a/app/src/views/tool/ToolPower.vue +++ b/app/src/views/tool/ToolPower.vue @@ -42,7 +42,7 @@ export default { methods: { async triggerAction(action) { const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_reboot_action_' + action), + this.$t('confirm_reboot_action_' + action), ) if (!confirmed) return diff --git a/app/src/views/tool/ToolWebadmin.vue b/app/src/views/tool/ToolWebadmin.vue index 90200cf4..cd053f95 100644 --- a/app/src/views/tool/ToolWebadmin.vue +++ b/app/src/views/tool/ToolWebadmin.vue @@ -36,38 +36,36 @@ export default { fields: { locale: { - label: this.$i18n.t('tools_webadmin.language'), + label: this.$t('tools_webadmin.language'), component: 'SelectItem', props: { id: 'locale', choices: [] }, }, fallbackLocale: { - label: this.$i18n.t('tools_webadmin.fallback_language'), - description: this.$i18n.t( - 'tools_webadmin.fallback_language_description', - ), + label: this.$t('tools_webadmin.fallback_language'), + description: this.$t('tools_webadmin.fallback_language_description'), component: 'SelectItem', props: { id: 'fallback-locale', choices: [] }, }, cache: { id: 'cache', - label: this.$i18n.t('tools_webadmin.cache'), - description: this.$i18n.t('tools_webadmin.cache_description'), + label: this.$t('tools_webadmin.cache'), + description: this.$t('tools_webadmin.cache_description'), component: 'CheckboxItem', props: { labels: { true: 'enabled', false: 'disabled' } }, }, transitions: { id: 'transitions', - label: this.$i18n.t('tools_webadmin.transitions'), + label: this.$t('tools_webadmin.transitions'), component: 'CheckboxItem', props: { labels: { true: 'enabled', false: 'disabled' } }, }, theme: { id: 'theme', - label: this.$i18n.t('tools_webadmin.theme'), + label: this.$t('tools_webadmin.theme'), component: 'CheckboxItem', props: { labels: { true: '🌙', false: '☀️' } }, }, @@ -90,8 +88,8 @@ export default { if (import.meta.env.DEV) { this.fields.experimental = { id: 'experimental', - label: this.$i18n.t('tools_webadmin.experimental'), - description: this.$i18n.t('tools_webadmin.experimental_description'), + label: this.$t('tools_webadmin.experimental'), + description: this.$t('tools_webadmin.experimental_description'), component: 'CheckboxItem', props: { labels: { true: 'enabled', false: 'disabled' } }, } diff --git a/app/src/views/update/SystemUpdate.vue b/app/src/views/update/SystemUpdate.vue index 08b3cbbd..349e3307 100644 --- a/app/src/views/update/SystemUpdate.vue +++ b/app/src/views/update/SystemUpdate.vue @@ -223,17 +223,15 @@ export default { if (postMessage) { const message = - this.$i18n.t('app.upgrade.notifs.post.alert') + - '\n\n' + - postMessage + this.$t('app.upgrade.notifs.post.alert') + '\n\n' + postMessage return this.$askMdConfirmation( message, { - title: this.$i18n.t('app.upgrade.notifs.post.title', { + title: this.$t('app.upgrade.notifs.post.title', { name: app.name, }), - okTitle: this.$i18n.t(isLast ? 'ok' : 'app.upgrade.continue'), - cancelTitle: this.$i18n.t('app.upgrade.stop'), + okTitle: this.$t(isLast ? 'ok' : 'app.upgrade.continue'), + cancelTitle: this.$t('app.upgrade.stop'), }, isLast, ) @@ -251,7 +249,7 @@ export default { async performSystemUpgrade() { const confirmed = await this.$askConfirmation( - this.$i18n.t('confirm_update_system'), + this.$t('confirm_update_system'), ) if (!confirmed) return diff --git a/app/src/views/user/UserCreate.vue b/app/src/views/user/UserCreate.vue index 7d62555d..f1d1e3f4 100644 --- a/app/src/views/user/UserCreate.vue +++ b/app/src/views/user/UserCreate.vue @@ -111,32 +111,32 @@ export default { fields: { username: { - label: this.$i18n.t('user_username'), + label: this.$t('user_username'), props: { id: 'username', - placeholder: this.$i18n.t('placeholder.username'), + placeholder: this.$t('placeholder.username'), }, }, fullname: { - label: this.$i18n.t('user_fullname'), + label: this.$t('user_fullname'), props: { id: 'fullname', - placeholder: this.$i18n.t('placeholder.fullname'), + placeholder: this.$t('placeholder.fullname'), }, }, domain: { id: 'mail', - label: this.$i18n.t('user_email'), - description: this.$i18n.t('tip_about_user_email'), + label: this.$t('user_email'), + description: this.$t('tip_about_user_email'), descriptionVariant: 'info', props: { choices: [] }, }, password: { - label: this.$i18n.t('password'), - description: this.$i18n.t('good_practices_about_user_password'), + label: this.$t('password'), + description: this.$t('good_practices_about_user_password'), descriptionVariant: 'warning', props: { id: 'password', @@ -146,7 +146,7 @@ export default { }, confirmation: { - label: this.$i18n.t('password_confirmation'), + label: this.$t('password_confirmation'), props: { id: 'confirmation', placeholder: '••••••••', diff --git a/app/src/views/user/UserEdit.vue b/app/src/views/user/UserEdit.vue index e8ae18b6..93b04015 100644 --- a/app/src/views/user/UserEdit.vue +++ b/app/src/views/user/UserEdit.vue @@ -167,51 +167,51 @@ export default { fields: { username: { - label: this.$i18n.t('user_username'), + label: this.$t('user_username'), value: this.name, props: { id: 'username', disabled: true }, }, fullname: { - label: this.$i18n.t('user_fullname'), + label: this.$t('user_fullname'), props: { id: 'fullname', - placeholder: this.$i18n.t('placeholder.fullname'), + placeholder: this.$t('placeholder.fullname'), }, }, mail: { - label: this.$i18n.t('user_email'), + label: this.$t('user_email'), props: { id: 'mail', choices: [] }, }, mailbox_quota: { - label: this.$i18n.t('user_mailbox_quota'), - description: this.$i18n.t('mailbox_quota_description'), - example: this.$i18n.t('mailbox_quota_example'), + label: this.$t('user_mailbox_quota'), + description: this.$t('mailbox_quota_description'), + example: this.$t('mailbox_quota_example'), props: { id: 'mailbox-quota', - placeholder: this.$i18n.t('mailbox_quota_placeholder'), + placeholder: this.$t('mailbox_quota_placeholder'), }, }, mail_aliases: { props: { - placeholder: this.$i18n.t('placeholder.username'), + placeholder: this.$t('placeholder.username'), choices: [], }, }, mail_forward: { props: { - placeholder: this.$i18n.t('user_new_forward'), + placeholder: this.$t('user_new_forward'), type: 'email', }, }, change_password: { - label: this.$i18n.t('password'), - description: this.$i18n.t('good_practices_about_user_password'), + label: this.$t('password'), + description: this.$t('good_practices_about_user_password'), descriptionVariant: 'warning', props: { id: 'change_password', @@ -222,7 +222,7 @@ export default { }, confirmation: { - label: this.$i18n.t('password_confirmation'), + label: this.$t('password_confirmation'), props: { id: 'confirmation', type: 'password', @@ -315,7 +315,7 @@ export default { } if (Object.keys(data).length === 0) { - this.serverError = this.$i18n.t('error_modify_something') + this.serverError = this.$t('error_modify_something') return } diff --git a/app/src/views/user/UserImport.vue b/app/src/views/user/UserImport.vue index b0286b7f..03ba1357 100644 --- a/app/src/views/user/UserImport.vue +++ b/app/src/views/user/UserImport.vue @@ -49,19 +49,19 @@ export default { fields: { csvfile: { - label: this.$i18n.t('users_import_csv_file'), - description: this.$i18n.t('users_import_csv_file_desc'), + label: this.$t('users_import_csv_file'), + description: this.$t('users_import_csv_file_desc'), component: 'FileItem', props: { id: 'csvfile', accept: 'text/csv', - placeholder: this.$i18n.t('placeholder.file'), + placeholder: this.$t('placeholder.file'), }, }, update: { - label: this.$i18n.t('users_import_update'), - description: this.$i18n.t('users_import_update_desc'), + label: this.$t('users_import_update'), + description: this.$t('users_import_update_desc'), component: 'CheckboxItem', props: { id: 'update', @@ -69,8 +69,8 @@ export default { }, delete: { - label: this.$i18n.t('users_import_delete'), - description: this.$i18n.t('users_import_delete_desc'), + label: this.$t('users_import_delete'), + description: this.$t('users_import_delete_desc'), component: 'CheckboxItem', props: { id: 'delete', @@ -90,8 +90,8 @@ export default { async onSubmit() { if (this.form.delete) { const confirmed = await this.$askConfirmation( - this.$i18n.t('users_import_confirm_destructive'), - { okTitle: this.$i18n.t('users_import_delete_others') }, + this.$t('users_import_confirm_destructive'), + { okTitle: this.$t('users_import_delete_others') }, ) if (!confirmed) return }