migration(vue-i18n): legacy mode off

This commit is contained in:
axolotle 2024-03-12 18:36:14 +01:00
parent bba1aa85c2
commit ccc7298213
31 changed files with 156 additions and 159 deletions

View file

@ -48,7 +48,7 @@ export default {
errorFeedback() { errorFeedback() {
if (this.serverError) return this.serverError if (this.serverError) return this.serverError
else if (this.validation && this.validation.$errors.length) { 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 '' } else return ''
}, },
}, },

View file

@ -53,7 +53,7 @@ export default {
errorFeedback() { errorFeedback() {
if (this.serverError) return this.serverError if (this.serverError) return this.serverError
else if (this.validation && this.validation.$errors.length) { 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 '' } else return ''
}, },
}, },

View file

@ -119,7 +119,7 @@ export default {
const err = this.error const err = this.error
if (err) { if (err) {
if (err.$message) return err.$message if (err.$message) return err.$message
return this.$i18n.t('form_errors.' + err.$validator, { return this.$t('form_errors.' + err.$validator, {
value: err.$model, value: err.$model,
...err.$params, ...err.$params,
}) })

View file

@ -38,15 +38,13 @@ export default {
parseValue(value) { parseValue(value) {
const item = this.component const item = this.component
if (item === 'FileItem') value = value.file ? value.file.name : null 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', '<br>') if (item === 'TextAreaItem') value = value.replaceAll('\n', '<br>')
if (Array.isArray(value)) { if (Array.isArray(value)) {
value = value.length value = value.length ? value.join(this.$t('words.separator')) : null
? value.join(this.$i18n.t('words.separator'))
: null
} }
if ([null, undefined, ''].includes(this.value)) if ([null, undefined, ''].includes(this.value))
value = this.$i18n.t('words.none') value = this.$t('words.none')
return value return value
}, },
}, },

View file

@ -14,7 +14,7 @@
:value="search" :value="search"
@input="$emit('update:search', $event)" @input="$emit('update:search', $event)"
:placeholder=" :placeholder="
$t('search.for', { items: $tc('items.' + itemsName, 2) }) $t('search.for', { items: $t('items.' + itemsName, 2) })
" "
:disabled="!items" :disabled="!items"
/> />
@ -33,10 +33,12 @@
<slot name="alert-message"> <slot name="alert-message">
<YIcon iname="exclamation-triangle" /> <YIcon iname="exclamation-triangle" />
{{ {{
$tc( $t(
items === null ? 'items_verbose_count' : 'search.not_found', items === null ? 'items_verbose_count' : 'search.not_found',
{
items: $t('items.' + itemsName, 0),
},
0, 0,
{ items: $tc('items.' + itemsName, 0) },
) )
}} }}
</slot> </slot>

View file

@ -49,9 +49,13 @@
label-size="sm" label-size="sm"
:label-for="id + '-search-input'" :label-for="id + '-search-input'"
:invalid-feedback=" :invalid-feedback="
$tc('search.not_found', 0, { $t(
items: $tc('items.' + itemsName, 0), 'search.not_found',
}) {
items: $t('items.' + itemsName, 0),
},
0,
)
" "
:state="searchState" :state="searchState"
:disabled="disabled" :disabled="disabled"
@ -80,9 +84,13 @@
<BDropdownText v-if="!criteria && availableOptions.length === 0"> <BDropdownText v-if="!criteria && availableOptions.length === 0">
<YIcon iname="exclamation-triangle" /> <YIcon iname="exclamation-triangle" />
{{ {{
$tc('items_verbose_items_left', 0, { $t(
items: $tc('items.' + itemsName, 0), 'items_verbose_items_left',
}) {
items: $t('items.' + itemsName, 0),
},
0,
)
}} }}
</BDropdownText> </BDropdownText>
</BDropdown> </BDropdown>

View file

@ -6,6 +6,5 @@
import { createI18n } from 'vue-i18n' import { createI18n } from 'vue-i18n'
export default createI18n({ export default createI18n({
// FIXME legacy: false,
legacy: true,
}) })

View file

@ -36,8 +36,8 @@ app.use(VueShowdownPlugin, {
// FIXME find or wait for a better way // FIXME find or wait for a better way
app.config.globalProperties.$askConfirmation = function (message, props) { app.config.globalProperties.$askConfirmation = function (message, props) {
return this.$bvModal.msgBoxConfirm(message, { return this.$bvModal.msgBoxConfirm(message, {
okTitle: this.$i18n.t('ok'), okTitle: this.$t('ok'),
cancelTitle: this.$i18n.t('cancel'), cancelTitle: this.$t('cancel'),
bodyBgVariant: 'warning', bodyBgVariant: 'warning',
centered: true, centered: true,
bodyClass: [ bodyClass: [
@ -58,8 +58,8 @@ app.config.globalProperties.$askMdConfirmation = function (
props: { markdown, flavor: 'github', options: { headerLevelStart: 4 } }, props: { markdown, flavor: 'github', options: { headerLevelStart: 4 } },
}) })
return this.$bvModal['msgBox' + (ok ? 'Ok' : 'Confirm')](content, { return this.$bvModal['msgBox' + (ok ? 'Ok' : 'Confirm')](content, {
okTitle: this.$i18n.t('yes'), okTitle: this.$t('yes'),
cancelTitle: this.$i18n.t('cancel'), cancelTitle: this.$t('cancel'),
headerBgVariant: 'warning', headerBgVariant: 'warning',
headerClass: store.state.theme ? 'text-white' : 'text-black', headerClass: store.state.theme ? 'text-white' : 'text-black',
centered: true, centered: true,

View file

@ -60,14 +60,14 @@ export default {
}, },
fields: { fields: {
username: { username: {
label: this.$i18n.t('user_username'), label: this.$t('user_username'),
props: { props: {
id: 'username', id: 'username',
autocomplete: 'username', autocomplete: 'username',
}, },
}, },
password: { password: {
label: this.$i18n.t('password'), label: this.$t('password'),
props: { props: {
id: 'password', id: 'password',
type: 'password', type: 'password',
@ -109,7 +109,7 @@ export default {
}) })
.catch((err) => { .catch((err) => {
if (err.name !== 'APIUnauthorizedError') throw err if (err.name !== 'APIUnauthorizedError') throw err
this.serverError = this.$i18n.t('wrong_password_or_username') this.serverError = this.$t('wrong_password_or_username')
}) })
}, },
}, },

View file

@ -132,30 +132,30 @@ export default {
fields: { fields: {
username: { username: {
label: this.$i18n.t('user_username'), label: this.$t('user_username'),
props: { props: {
id: 'username', id: 'username',
placeholder: this.$i18n.t('placeholder.username'), placeholder: this.$t('placeholder.username'),
}, },
}, },
fullname: { fullname: {
label: this.$i18n.t('user_fullname'), label: this.$t('user_fullname'),
props: { props: {
id: 'fullname', id: 'fullname',
placeholder: this.$i18n.t('placeholder.fullname'), placeholder: this.$t('placeholder.fullname'),
}, },
}, },
password: { password: {
label: this.$i18n.t('password'), label: this.$t('password'),
description: this.$i18n.t('good_practices_about_admin_password'), description: this.$t('good_practices_about_admin_password'),
descriptionVariant: 'warning', descriptionVariant: 'warning',
props: { id: 'password', placeholder: '••••••••', type: 'password' }, props: { id: 'password', placeholder: '••••••••', type: 'password' },
}, },
confirmation: { confirmation: {
label: this.$i18n.t('password_confirmation'), label: this.$t('password_confirmation'),
props: { props: {
id: 'confirmation', id: 'confirmation',
placeholder: '••••••••', placeholder: '••••••••',
@ -180,7 +180,7 @@ export default {
async setUser() { async setUser() {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_postinstall', { domain: this.domain }), this.$t('confirm_postinstall', { domain: this.domain }),
) )
if (!confirmed) return if (!confirmed) return
this.performPostInstall() this.performPostInstall()

View file

@ -157,26 +157,26 @@ export default {
fields: { fields: {
domain: { domain: {
label: this.$i18n.t('domain_name'), label: this.$t('domain_name'),
props: { props: {
id: 'domain', id: 'domain',
placeholder: this.$i18n.t('placeholder.domain'), placeholder: this.$t('placeholder.domain'),
}, },
}, },
dynDomain: { dynDomain: {
label: this.$i18n.t('domain_name'), label: this.$t('domain_name'),
props: { props: {
id: 'dyn-domain', id: 'dyn-domain',
placeholder: this.$i18n.t('placeholder.domain').split('.')[0], placeholder: this.$t('placeholder.domain').split('.')[0],
type: 'domain', type: 'domain',
choices: ['nohost.me', 'noho.st', 'ynh.fr'], choices: ['nohost.me', 'noho.st', 'ynh.fr'],
}, },
}, },
dynDomainPassword: { dynDomainPassword: {
label: this.$i18n.t('domain.add.dyn_dns_password'), label: this.$t('domain.add.dyn_dns_password'),
description: this.$i18n.t('domain.add.dyn_dns_password_desc'), description: this.$t('domain.add.dyn_dns_password_desc'),
props: { props: {
id: 'dyn-dns-password', id: 'dyn-dns-password',
placeholder: '••••••••', placeholder: '••••••••',
@ -185,7 +185,7 @@ export default {
}, },
dynDomainPasswordConfirmation: { dynDomainPasswordConfirmation: {
label: this.$i18n.t('password_confirmation'), label: this.$t('password_confirmation'),
props: { props: {
id: 'dyn-dns-password-confirmation', id: 'dyn-dns-password-confirmation',
placeholder: '••••••••', placeholder: '••••••••',
@ -194,10 +194,10 @@ export default {
}, },
localDomain: { localDomain: {
label: this.$i18n.t('domain_name'), label: this.$t('domain_name'),
props: { props: {
id: 'dyn-domain', id: 'dyn-domain',
placeholder: this.$i18n.t('placeholder.domain').split('.')[0], placeholder: this.$t('placeholder.domain').split('.')[0],
type: 'domain', type: 'domain',
choices: ['local', 'test'], choices: ['local', 'test'],
}, },

View file

@ -15,7 +15,7 @@
</BInputGroupPrepend> </BInputGroupPrepend>
<BFormInput <BFormInput
id="search-input" id="search-input"
:placeholder="$t('search.for', { items: $tc('items.apps', 2) })" :placeholder="$t('search.for', { items: $t('items.apps', 2) })"
:value="search" :value="search"
@input="updateQuery('search', $event)" @input="updateQuery('search', $event)"
/> />
@ -257,24 +257,24 @@ export default {
// Filtering options // Filtering options
qualityOptions: [ qualityOptions: [
{ value: 'high_quality', text: this.$i18n.t('only_highquality_apps') }, { value: 'high_quality', text: this.$t('only_highquality_apps') },
{ {
value: 'decent_quality', 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: 'working', text: this.$t('only_working_apps') },
{ value: 'all', text: this.$i18n.t('all_apps') }, { value: 'all', text: this.$t('all_apps') },
], ],
categories: [ categories: [
{ text: this.$i18n.t('app_choose_category'), value: null }, { text: this.$t('app_choose_category'), value: null },
{ text: this.$i18n.t('all_apps'), value: 'all', icon: 'search' }, { text: this.$t('all_apps'), value: 'all', icon: 'search' },
// The rest is filled from api data // The rest is filled from api data
], ],
// Custom install form // Custom install form
customInstall: { customInstall: {
field: { field: {
label: this.$i18n.t('url'), label: this.$t('url'),
props: { props: {
id: 'custom-install', id: 'custom-install',
placeholder: 'https://some.git.forge.tld/USER/REPOSITORY', placeholder: 'https://some.git.forge.tld/USER/REPOSITORY',
@ -321,11 +321,11 @@ export default {
(cat) => cat.value === this.category, (cat) => cat.value === this.category,
) )
if (category.subtags) { if (category.subtags) {
const subtags = [{ text: this.$i18n.t('all'), value: 'all' }] const subtags = [{ text: this.$t('all'), value: 'all' }]
category.subtags.forEach((subtag) => { category.subtags.forEach((subtag) => {
subtags.push({ text: subtag.title, value: subtag.id }) 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 return subtags
} }
} }
@ -404,7 +404,7 @@ export default {
const app = this.apps.find((app) => app.id === appId) const app = this.apps.find((app) => app.id === appId)
if (!app.decent_quality) { if (!app.decent_quality) {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_install_app_' + app.state), this.$t('confirm_install_app_' + app.state),
) )
if (!confirmed) return if (!confirmed) return
} }
@ -414,7 +414,7 @@ export default {
// INSTALL CUSTOM APP // INSTALL CUSTOM APP
async onCustomInstallClick() { async onCustomInstallClick() {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_install_custom_app'), this.$t('confirm_install_custom_app'),
) )
if (!confirmed) return if (!confirmed) return

View file

@ -411,7 +411,7 @@ export default {
{ {
hasApplyButton: false, hasApplyButton: false,
id: 'operations', id: 'operations',
name: this.$i18n.t('operations'), name: this.$t('operations'),
}, },
], ],
validations: {}, validations: {},
@ -467,7 +467,7 @@ export default {
const mainPermission = app.permissions[this.id + '.main'] const mainPermission = app.permissions[this.id + '.main']
mainPermission.name = this.id + '.main' mainPermission.name = this.id + '.main'
mainPermission.title = this.$i18n.t('permission_main') mainPermission.title = this.$t('permission_main')
mainPermission.tileAvailable = mainPermission.tileAvailable =
mainPermission.url !== null && !mainPermission.url.startsWith('re:') mainPermission.url !== null && !mainPermission.url.startsWith('re:')
form.labels.push({ form.labels.push({
@ -507,7 +507,7 @@ export default {
domain: app.settings.domain, domain: app.settings.domain,
alternativeTo: app.from_catalog.potential_alternative_to?.length alternativeTo: app.from_catalog.potential_alternative_to?.length
? app.from_catalog.potential_alternative_to.join( ? app.from_catalog.potential_alternative_to.join(
this.$i18n.t('words.separator'), this.$t('words.separator'),
) )
: null, : null,
description: DESCRIPTION description: DESCRIPTION
@ -517,7 +517,7 @@ export default {
app.manifest.packaging_format >= 2 app.manifest.packaging_format >= 2
? { ? {
archs: Array.isArray(archs) archs: Array.isArray(archs)
? archs.join(this.$i18n.t('words.separator')) ? archs.join(this.$t('words.separator'))
: archs, : archs,
ldap: ldap === 'not_relevant' ? null : ldap, ldap: ldap === 'not_relevant' ? null : ldap,
sso: sso === 'not_relevant' ? null : sso, sso: sso === 'not_relevant' ? null : sso,
@ -647,7 +647,7 @@ export default {
async changeUrl() { async changeUrl() {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_app_change_url'), this.$t('confirm_app_change_url'),
) )
if (!confirmed) return if (!confirmed) return
@ -663,7 +663,7 @@ export default {
async setAsDefaultDomain(undo = false) { async setAsDefaultDomain(undo = false) {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_app_default'), this.$t('confirm_app_default'),
) )
if (!confirmed) return if (!confirmed) return

View file

@ -313,9 +313,7 @@ export default {
name, name,
alternativeTo: alternativeTo:
_app.potential_alternative_to && _app.potential_alternative_to.length _app.potential_alternative_to && _app.potential_alternative_to.length
? _app.potential_alternative_to.join( ? _app.potential_alternative_to.join(this.$t('words.separator'))
this.$i18n.t('words.separator'),
)
: null, : null,
description: formatI18nField(_app.doc.DESCRIPTION || _app.description), description: formatI18nField(_app.doc.DESCRIPTION || _app.description),
screenshot: _app.screenshot, screenshot: _app.screenshot,
@ -326,7 +324,7 @@ export default {
_app.packaging_format >= 2 _app.packaging_format >= 2
? { ? {
archs: Array.isArray(archs) archs: Array.isArray(archs)
? archs.join(this.$i18n.t('words.separator')) ? archs.join(this.$t('words.separator'))
: archs, : archs,
ldap: ldap === 'not_relevant' ? null : ldap, ldap: ldap === 'not_relevant' ? null : ldap,
sso: sso === 'not_relevant' ? null : sso, sso: sso === 'not_relevant' ? null : sso,
@ -382,7 +380,7 @@ export default {
async performInstall() { async performInstall() {
if ('path' in this.form && this.form.path === '/') { if ('path' in this.form && this.form.path === '/') {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_install_domain_root', { this.$t('confirm_install_domain_root', {
domain: this.form.domain, domain: this.form.domain,
}), }),
) )
@ -406,16 +404,14 @@ export default {
const postInstall = this.formatAppNotifs(notifications) const postInstall = this.formatAppNotifs(notifications)
if (postInstall) { if (postInstall) {
const message = const message =
this.$i18n.t('app.install.notifs.post.alert') + this.$t('app.install.notifs.post.alert') + '\n\n' + postInstall
'\n\n' +
postInstall
await this.$askMdConfirmation( await this.$askMdConfirmation(
message, message,
{ {
title: this.$i18n.t('app.install.notifs.post.title', { title: this.$t('app.install.notifs.post.title', {
name: this.app.name, name: this.app.name,
}), }),
okTitle: this.$i18n.t('ok'), okTitle: this.$t('ok'),
}, },
true, true,
) )

View file

@ -155,12 +155,12 @@ export default {
: hook : hook
if (groupId in data) { if (groupId in data) {
data[groupId].value.push(hook) data[groupId].value.push(hook)
data[groupId].description += ', ' + this.$i18n.t('hook_' + hook) data[groupId].description += ', ' + this.$t('hook_' + hook)
} else { } else {
data[groupId] = { data[groupId] = {
name: this.$i18n.t('hook_' + groupId), name: this.$t('hook_' + groupId),
value: [hook], value: [hook],
description: this.$i18n.t( description: this.$t(
groupId === hook ? `hook_${hook}_desc` : 'hook_' + hook, groupId === hook ? `hook_${hook}_desc` : 'hook_' + hook,
), ),
} }

View file

@ -177,13 +177,13 @@ export default {
: hook : hook
if (groupId in data) { if (groupId in data) {
data[groupId].value.push(hook) data[groupId].value.push(hook)
data[groupId].description += ', ' + this.$i18n.t('hook_' + hook) data[groupId].description += ', ' + this.$t('hook_' + hook)
data[groupId].size += size data[groupId].size += size
} else { } else {
data[groupId] = { data[groupId] = {
name: this.$i18n.t('hook_' + groupId), name: this.$t('hook_' + groupId),
value: [hook], value: [hook],
description: this.$i18n.t( description: this.$t(
groupId === hook ? `hook_${hook}_desc` : 'hook_' + hook, groupId === hook ? `hook_${hook}_desc` : 'hook_' + hook,
), ),
size, size,
@ -216,7 +216,7 @@ export default {
async restoreBackup() { async restoreBackup() {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_restore', { name: this.name }), this.$t('confirm_restore', { name: this.name }),
) )
if (!confirmed) return if (!confirmed) return
@ -246,7 +246,7 @@ export default {
async deleteBackup() { async deleteBackup() {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_delete', { name: this.name }), this.$t('confirm_delete', { name: this.name }),
) )
if (!confirmed) return if (!confirmed) return

View file

@ -16,7 +16,7 @@
<BAlert v-if="!archives" variant="warning"> <BAlert v-if="!archives" variant="warning">
<YIcon iname="exclamation-triangle" /> <YIcon iname="exclamation-triangle" />
{{ $tc('items_verbose_count', 0, { items: $tc('items.backups', 0) }) }} {{ $t('items_verbose_count', { items: $t('items.backups', 0) }, 0) }}
</BAlert> </BAlert>
<BListGroup v-else> <BListGroup v-else>

View file

@ -31,7 +31,7 @@ export default {
storages: [ storages: [
{ {
id: 'local', id: 'local',
name: this.$i18n.t('local_archives'), name: this.$t('local_archives'),
uri: '/home/yunohost.backup/', uri: '/home/yunohost.backup/',
}, },
], ],

View file

@ -247,7 +247,7 @@ export default {
async pushDnsChanges() { async pushDnsChanges() {
if (this.force) { if (this.force) {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('domain.dns.push_force_confirm'), this.$t('domain.dns.push_force_confirm'),
) )
if (!confirmed) return if (!confirmed) return
} }

View file

@ -53,7 +53,7 @@
<span class="text-secondary px-2"> <span class="text-secondary px-2">
({{ ({{
$t('domain.cert.valid_for', { $t('domain.cert.valid_for', {
days: $tc('day_validity', cert.validity), days: $t('day_validity', cert.validity),
}) })
}}) }})
</span> </span>
@ -280,7 +280,7 @@ export default {
async setAsDefaultDomain() { async setAsDefaultDomain() {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_change_maindomain'), this.$t('confirm_change_maindomain'),
) )
if (!confirmed) return if (!confirmed) return

View file

@ -37,11 +37,11 @@ export default {
}, },
serverError: '', serverError: '',
groupname: { groupname: {
label: this.$i18n.t('group_name'), label: this.$t('group_name'),
description: this.$i18n.t('group_format_name_help'), description: this.$t('group_format_name_help'),
props: { props: {
id: 'groupname', id: 'groupname',
placeholder: this.$i18n.t('placeholder.groupname'), placeholder: this.$t('placeholder.groupname'),
}, },
}, },
} }

View file

@ -265,7 +265,7 @@ export default {
const permId = this.permissions.find((perm) => perm.label === option).id const permId = this.permissions.find((perm) => perm.label === option).id
if (action === 'add' && ['sftp.main', 'ssh.main'].includes(permId)) { if (action === 'add' && ['sftp.main', 'ssh.main'].includes(permId)) {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_group_add_access_permission', { this.$t('confirm_group_add_access_permission', {
name: groupName, name: groupName,
perm: option, perm: option,
}), }),
@ -311,7 +311,7 @@ export default {
async deleteGroup(groupName) { async deleteGroup(groupName) {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_delete', { name: groupName }), this.$t('confirm_delete', { name: groupName }),
) )
if (!confirmed) return if (!confirmed) return

View file

@ -133,7 +133,7 @@ export default {
async updateService(action) { async updateService(action) {
const confirmed = await this.$askConfirmation( 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 if (!confirmed) return

View file

@ -140,27 +140,27 @@ export default {
// Ports tables data // Ports tables data
fields: [ fields: [
{ key: 'port', label: this.$i18n.t('port') }, { key: 'port', label: this.$t('port') },
{ key: 'ipv4', label: this.$i18n.t('ipv4') }, { key: 'ipv4', label: this.$t('ipv4') },
{ key: 'ipv6', label: this.$i18n.t('ipv6') }, { key: 'ipv6', label: this.$t('ipv6') },
{ key: 'uPnP', label: this.$i18n.t('upnp') }, { key: 'uPnP', label: this.$t('upnp') },
], ],
protocols: undefined, protocols: undefined,
portToToggle: undefined, portToToggle: undefined,
// Ports form data // Ports form data
actionChoices: [ actionChoices: [
{ value: 'allow', text: this.$i18n.t('open') }, { value: 'allow', text: this.$t('open') },
{ value: 'disallow', text: this.$i18n.t('close') }, { value: 'disallow', text: this.$t('close') },
], ],
connectionChoices: [ connectionChoices: [
{ value: 'ipv4', text: this.$i18n.t('ipv4') }, { value: 'ipv4', text: this.$t('ipv4') },
{ value: 'ipv6', text: this.$i18n.t('ipv6') }, { value: 'ipv6', text: this.$t('ipv6') },
], ],
protocolChoices: [ protocolChoices: [
{ value: 'TCP', text: this.$i18n.t('tcp') }, { value: 'TCP', text: this.$t('tcp') },
{ value: 'UDP', text: this.$i18n.t('udp') }, { value: 'UDP', text: this.$t('udp') },
{ value: 'Both', text: this.$i18n.t('both') }, { value: 'Both', text: this.$t('both') },
], ],
form: { form: {
action: 'allow', action: 'allow',
@ -216,7 +216,7 @@ export default {
async togglePort({ action, port, protocol, connection }) { async togglePort({ action, port, protocol, connection }) {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_firewall_' + action, { this.$t('confirm_firewall_' + action, {
port, port,
protocol, protocol,
connection, connection,
@ -226,9 +226,7 @@ export default {
return Promise.resolve(confirmed) return Promise.resolve(confirmed)
} }
const actionTrad = this.$i18n.t( const actionTrad = this.$t({ allow: 'open', disallow: 'close' }[action])
{ allow: 'open', disallow: 'close' }[action],
)
return api return api
.put( .put(
`firewall/${protocol}/${action}/${port}?${connection}_only`, `firewall/${protocol}/${action}/${port}?${connection}_only`,
@ -248,7 +246,7 @@ export default {
async toggleUpnp(value) { async toggleUpnp(value) {
const action = this.upnpEnabled ? 'disable' : 'enable' const action = this.upnpEnabled ? 'disable' : 'enable'
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_upnp_' + action), this.$t('confirm_upnp_' + action),
) )
if (!confirmed) return if (!confirmed) return
@ -256,7 +254,7 @@ export default {
.put( .put(
'firewall/upnp/' + action, 'firewall/upnp/' + action,
{}, {},
{ key: 'firewall.upnp', action: this.$i18n.t(action) }, { key: 'firewall.upnp', action: this.$t(action) },
) )
.then(() => { .then(() => {
// FIXME Couldn't test when it works. // FIXME Couldn't test when it works.

View file

@ -137,7 +137,7 @@ export default {
async skipMigration(id) { async skipMigration(id) {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_migrations_skip'), this.$t('confirm_migrations_skip'),
) )
if (!confirmed) return if (!confirmed) return
api api

View file

@ -42,7 +42,7 @@ export default {
methods: { methods: {
async triggerAction(action) { async triggerAction(action) {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_reboot_action_' + action), this.$t('confirm_reboot_action_' + action),
) )
if (!confirmed) return if (!confirmed) return

View file

@ -36,38 +36,36 @@ export default {
fields: { fields: {
locale: { locale: {
label: this.$i18n.t('tools_webadmin.language'), label: this.$t('tools_webadmin.language'),
component: 'SelectItem', component: 'SelectItem',
props: { id: 'locale', choices: [] }, props: { id: 'locale', choices: [] },
}, },
fallbackLocale: { fallbackLocale: {
label: this.$i18n.t('tools_webadmin.fallback_language'), label: this.$t('tools_webadmin.fallback_language'),
description: this.$i18n.t( description: this.$t('tools_webadmin.fallback_language_description'),
'tools_webadmin.fallback_language_description',
),
component: 'SelectItem', component: 'SelectItem',
props: { id: 'fallback-locale', choices: [] }, props: { id: 'fallback-locale', choices: [] },
}, },
cache: { cache: {
id: 'cache', id: 'cache',
label: this.$i18n.t('tools_webadmin.cache'), label: this.$t('tools_webadmin.cache'),
description: this.$i18n.t('tools_webadmin.cache_description'), description: this.$t('tools_webadmin.cache_description'),
component: 'CheckboxItem', component: 'CheckboxItem',
props: { labels: { true: 'enabled', false: 'disabled' } }, props: { labels: { true: 'enabled', false: 'disabled' } },
}, },
transitions: { transitions: {
id: 'transitions', id: 'transitions',
label: this.$i18n.t('tools_webadmin.transitions'), label: this.$t('tools_webadmin.transitions'),
component: 'CheckboxItem', component: 'CheckboxItem',
props: { labels: { true: 'enabled', false: 'disabled' } }, props: { labels: { true: 'enabled', false: 'disabled' } },
}, },
theme: { theme: {
id: 'theme', id: 'theme',
label: this.$i18n.t('tools_webadmin.theme'), label: this.$t('tools_webadmin.theme'),
component: 'CheckboxItem', component: 'CheckboxItem',
props: { labels: { true: '🌙', false: '☀️' } }, props: { labels: { true: '🌙', false: '☀️' } },
}, },
@ -90,8 +88,8 @@ export default {
if (import.meta.env.DEV) { if (import.meta.env.DEV) {
this.fields.experimental = { this.fields.experimental = {
id: 'experimental', id: 'experimental',
label: this.$i18n.t('tools_webadmin.experimental'), label: this.$t('tools_webadmin.experimental'),
description: this.$i18n.t('tools_webadmin.experimental_description'), description: this.$t('tools_webadmin.experimental_description'),
component: 'CheckboxItem', component: 'CheckboxItem',
props: { labels: { true: 'enabled', false: 'disabled' } }, props: { labels: { true: 'enabled', false: 'disabled' } },
} }

View file

@ -223,17 +223,15 @@ export default {
if (postMessage) { if (postMessage) {
const message = const message =
this.$i18n.t('app.upgrade.notifs.post.alert') + this.$t('app.upgrade.notifs.post.alert') + '\n\n' + postMessage
'\n\n' +
postMessage
return this.$askMdConfirmation( return this.$askMdConfirmation(
message, message,
{ {
title: this.$i18n.t('app.upgrade.notifs.post.title', { title: this.$t('app.upgrade.notifs.post.title', {
name: app.name, name: app.name,
}), }),
okTitle: this.$i18n.t(isLast ? 'ok' : 'app.upgrade.continue'), okTitle: this.$t(isLast ? 'ok' : 'app.upgrade.continue'),
cancelTitle: this.$i18n.t('app.upgrade.stop'), cancelTitle: this.$t('app.upgrade.stop'),
}, },
isLast, isLast,
) )
@ -251,7 +249,7 @@ export default {
async performSystemUpgrade() { async performSystemUpgrade() {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('confirm_update_system'), this.$t('confirm_update_system'),
) )
if (!confirmed) return if (!confirmed) return

View file

@ -111,32 +111,32 @@ export default {
fields: { fields: {
username: { username: {
label: this.$i18n.t('user_username'), label: this.$t('user_username'),
props: { props: {
id: 'username', id: 'username',
placeholder: this.$i18n.t('placeholder.username'), placeholder: this.$t('placeholder.username'),
}, },
}, },
fullname: { fullname: {
label: this.$i18n.t('user_fullname'), label: this.$t('user_fullname'),
props: { props: {
id: 'fullname', id: 'fullname',
placeholder: this.$i18n.t('placeholder.fullname'), placeholder: this.$t('placeholder.fullname'),
}, },
}, },
domain: { domain: {
id: 'mail', id: 'mail',
label: this.$i18n.t('user_email'), label: this.$t('user_email'),
description: this.$i18n.t('tip_about_user_email'), description: this.$t('tip_about_user_email'),
descriptionVariant: 'info', descriptionVariant: 'info',
props: { choices: [] }, props: { choices: [] },
}, },
password: { password: {
label: this.$i18n.t('password'), label: this.$t('password'),
description: this.$i18n.t('good_practices_about_user_password'), description: this.$t('good_practices_about_user_password'),
descriptionVariant: 'warning', descriptionVariant: 'warning',
props: { props: {
id: 'password', id: 'password',
@ -146,7 +146,7 @@ export default {
}, },
confirmation: { confirmation: {
label: this.$i18n.t('password_confirmation'), label: this.$t('password_confirmation'),
props: { props: {
id: 'confirmation', id: 'confirmation',
placeholder: '••••••••', placeholder: '••••••••',

View file

@ -167,51 +167,51 @@ export default {
fields: { fields: {
username: { username: {
label: this.$i18n.t('user_username'), label: this.$t('user_username'),
value: this.name, value: this.name,
props: { id: 'username', disabled: true }, props: { id: 'username', disabled: true },
}, },
fullname: { fullname: {
label: this.$i18n.t('user_fullname'), label: this.$t('user_fullname'),
props: { props: {
id: 'fullname', id: 'fullname',
placeholder: this.$i18n.t('placeholder.fullname'), placeholder: this.$t('placeholder.fullname'),
}, },
}, },
mail: { mail: {
label: this.$i18n.t('user_email'), label: this.$t('user_email'),
props: { id: 'mail', choices: [] }, props: { id: 'mail', choices: [] },
}, },
mailbox_quota: { mailbox_quota: {
label: this.$i18n.t('user_mailbox_quota'), label: this.$t('user_mailbox_quota'),
description: this.$i18n.t('mailbox_quota_description'), description: this.$t('mailbox_quota_description'),
example: this.$i18n.t('mailbox_quota_example'), example: this.$t('mailbox_quota_example'),
props: { props: {
id: 'mailbox-quota', id: 'mailbox-quota',
placeholder: this.$i18n.t('mailbox_quota_placeholder'), placeholder: this.$t('mailbox_quota_placeholder'),
}, },
}, },
mail_aliases: { mail_aliases: {
props: { props: {
placeholder: this.$i18n.t('placeholder.username'), placeholder: this.$t('placeholder.username'),
choices: [], choices: [],
}, },
}, },
mail_forward: { mail_forward: {
props: { props: {
placeholder: this.$i18n.t('user_new_forward'), placeholder: this.$t('user_new_forward'),
type: 'email', type: 'email',
}, },
}, },
change_password: { change_password: {
label: this.$i18n.t('password'), label: this.$t('password'),
description: this.$i18n.t('good_practices_about_user_password'), description: this.$t('good_practices_about_user_password'),
descriptionVariant: 'warning', descriptionVariant: 'warning',
props: { props: {
id: 'change_password', id: 'change_password',
@ -222,7 +222,7 @@ export default {
}, },
confirmation: { confirmation: {
label: this.$i18n.t('password_confirmation'), label: this.$t('password_confirmation'),
props: { props: {
id: 'confirmation', id: 'confirmation',
type: 'password', type: 'password',
@ -315,7 +315,7 @@ export default {
} }
if (Object.keys(data).length === 0) { if (Object.keys(data).length === 0) {
this.serverError = this.$i18n.t('error_modify_something') this.serverError = this.$t('error_modify_something')
return return
} }

View file

@ -49,19 +49,19 @@ export default {
fields: { fields: {
csvfile: { csvfile: {
label: this.$i18n.t('users_import_csv_file'), label: this.$t('users_import_csv_file'),
description: this.$i18n.t('users_import_csv_file_desc'), description: this.$t('users_import_csv_file_desc'),
component: 'FileItem', component: 'FileItem',
props: { props: {
id: 'csvfile', id: 'csvfile',
accept: 'text/csv', accept: 'text/csv',
placeholder: this.$i18n.t('placeholder.file'), placeholder: this.$t('placeholder.file'),
}, },
}, },
update: { update: {
label: this.$i18n.t('users_import_update'), label: this.$t('users_import_update'),
description: this.$i18n.t('users_import_update_desc'), description: this.$t('users_import_update_desc'),
component: 'CheckboxItem', component: 'CheckboxItem',
props: { props: {
id: 'update', id: 'update',
@ -69,8 +69,8 @@ export default {
}, },
delete: { delete: {
label: this.$i18n.t('users_import_delete'), label: this.$t('users_import_delete'),
description: this.$i18n.t('users_import_delete_desc'), description: this.$t('users_import_delete_desc'),
component: 'CheckboxItem', component: 'CheckboxItem',
props: { props: {
id: 'delete', id: 'delete',
@ -90,8 +90,8 @@ export default {
async onSubmit() { async onSubmit() {
if (this.form.delete) { if (this.form.delete) {
const confirmed = await this.$askConfirmation( const confirmed = await this.$askConfirmation(
this.$i18n.t('users_import_confirm_destructive'), this.$t('users_import_confirm_destructive'),
{ okTitle: this.$i18n.t('users_import_delete_others') }, { okTitle: this.$t('users_import_delete_others') },
) )
if (!confirmed) return if (!confirmed) return
} }