99 :checked =" enableDefaultContact"
1010 type =" switch"
1111 @update:model-value =" updateEnableDefaultContact" >
12- {{ $ t('dav', "Add example contact to user's address book when they first log in") }}
12+ {{ t('dav', "Add example contact to user's address book when they first log in") }}
1313 </NcCheckboxRadioSwitch >
1414 <div v-if =" enableDefaultContact" class =" example-contact-settings__buttons" >
1515 <ExampleContentDownloadButton :href =" downloadUrl" >
2424 <template #icon >
2525 <IconUpload :size =" 20" />
2626 </template >
27- {{ $ t('dav', 'Import contact') }}
27+ {{ t('dav', 'Import contact') }}
2828 </NcButton >
2929 <NcButton
3030 v-if =" hasCustomDefaultContact"
3333 <template #icon >
3434 <IconRestore :size =" 20" />
3535 </template >
36- {{ $ t('dav', 'Reset to default') }}
36+ {{ t('dav', 'Reset to default') }}
3737 </NcButton >
3838 </div >
3939 <NcDialog
40- :open.sync =" isModalOpen"
41- :name =" $ t('dav', 'Import contacts')"
40+ v-model :open =" isModalOpen"
41+ :name =" t('dav', 'Import contacts')"
4242 :buttons =" buttons" >
4343 <div >
44- <p >{{ $ t('dav', 'Importing a new .vcf file will delete the existing default contact and replace it with the new one. Do you want to continue?') }}</p >
44+ <p >{{ t('dav', 'Importing a new .vcf file will delete the existing default contact and replace it with the new one. Do you want to continue?') }}</p >
4545 </div >
4646 </NcDialog >
4747 <input
@@ -61,6 +61,7 @@ import IconCheck from '@mdi/svg/svg/check.svg?raw'
6161import axios from ' @nextcloud/axios'
6262import { showError , showSuccess } from ' @nextcloud/dialogs'
6363import { loadState } from ' @nextcloud/initial-state'
64+ import { t } from ' @nextcloud/l10n'
6465import { generateUrl } from ' @nextcloud/router'
6566import { NcButton , NcCheckboxRadioSwitch , NcDialog } from ' @nextcloud/vue'
6667import IconAccount from ' vue-material-design-icons/Account.vue'
@@ -69,8 +70,8 @@ import IconUpload from 'vue-material-design-icons/TrayArrowUp.vue'
6970import ExampleContentDownloadButton from ' ./ExampleContentDownloadButton.vue'
7071import { logger } from ' ../service/logger.ts'
7172
72- const enableDefaultContact = loadState (' dav' , ' enableDefaultContact' )
73- const hasCustomDefaultContact = loadState (' dav' , ' hasCustomDefaultContact' )
73+ const enableDefaultContact = loadState (' dav' , ' enableDefaultContact' , false )
74+ const hasCustomDefaultContact = loadState (' dav' , ' hasCustomDefaultContact' , false )
7475
7576export default {
7677 name: ' ExampleContactSettings' ,
@@ -84,6 +85,10 @@ export default {
8485 ExampleContentDownloadButton,
8586 },
8687
88+ setup () {
89+ return { t }
90+ },
91+
8792 data () {
8893 return {
8994 enableDefaultContact,
@@ -92,12 +97,12 @@ export default {
9297 loading: false ,
9398 buttons: [
9499 {
95- label: this . $ t (' dav' , ' Cancel' ),
100+ label: t (' dav' , ' Cancel' ),
96101 icon: IconCancel,
97102 callback : () => { this .isModalOpen = false },
98103 },
99104 {
100- label: this . $ t (' dav' , ' Import' ),
105+ label: t (' dav' , ' Import' ),
101106 icon: IconCheck,
102107 variant: ' primary' ,
103108 callback : () => { this .clickImportInput () },
@@ -119,7 +124,7 @@ export default {
119124 }).then (() => {
120125 this .enableDefaultContact = ! this .enableDefaultContact
121126 }).catch (() => {
122- showError (this . $ t (' dav' , ' Error while saving settings' ))
127+ showError (t (' dav' , ' Error while saving settings' ))
123128 })
124129 },
125130
@@ -136,11 +141,11 @@ export default {
136141 axios .put (generateUrl (' /apps/dav/api/defaultcontact/contact' ))
137142 .then (() => {
138143 this .hasCustomDefaultContact = false
139- showSuccess (this . $ t (' dav' , ' Contact reset successfully' ))
144+ showSuccess (t (' dav' , ' Contact reset successfully' ))
140145 })
141146 .catch ((error ) => {
142147 logger .error (' Error importing contact:' , { error })
143- showError (this . $ t (' dav' , ' Error while resetting contact' ))
148+ showError (t (' dav' , ' Error while resetting contact' ))
144149 })
145150 .finally (() => {
146151 this .loading = false
@@ -158,10 +163,10 @@ export default {
158163 try {
159164 await axios .put (generateUrl (' /apps/dav/api/defaultcontact/contact' ), { contactData: reader .result })
160165 this .hasCustomDefaultContact = true
161- showSuccess (this . $ t (' dav' , ' Contact imported successfully' ))
166+ showSuccess (t (' dav' , ' Contact imported successfully' ))
162167 } catch (error) {
163168 logger .error (' Error importing contact:' , { error })
164- showError (this . $ t (' dav' , ' Error while importing contact' ))
169+ showError (t (' dav' , ' Error while importing contact' ))
165170 } finally {
166171 this .loading = false
167172 event .target .value = ' '
0 commit comments