6
6
<FormControl >
7
7
<div class =" flex items-center space-x-2" >
8
8
<Checkbox :checked =" value" @update:checked =" handleChange" />
9
- <Label >Enabled </Label >
9
+ <Label >{{ $t('form.field.enabled') }} </Label >
10
10
</div >
11
11
</FormControl >
12
12
<FormMessage />
16
16
<!-- SMTP Host Field -->
17
17
<FormField v-slot =" { componentField }" name =" host" >
18
18
<FormItem >
19
- <FormLabel >SMTP Host </FormLabel >
19
+ <FormLabel >{{ $t('form.field.smtpHost') }} </FormLabel >
20
20
<FormControl >
21
21
<Input type =" text" placeholder =" smtp.gmail.com" v-bind =" componentField" />
22
22
</FormControl >
27
27
<!-- SMTP Port Field -->
28
28
<FormField v-slot =" { componentField }" name =" port" >
29
29
<FormItem >
30
- <FormLabel >SMTP Port </FormLabel >
30
+ <FormLabel >{{ $t('form.field.smtpPort') }} </FormLabel >
31
31
<FormControl >
32
32
<Input type =" number" placeholder =" 587" v-bind =" componentField" />
33
33
</FormControl >
38
38
<!-- Username Field -->
39
39
<FormField v-slot =" { componentField }" name =" username" >
40
40
<FormItem >
41
- <FormLabel >Username </FormLabel >
41
+ <FormLabel >{{ $t('form.field.username') }} </FormLabel >
42
42
<FormControl >
43
43
<
Input type =
" text" placeholder =
" [email protected] " v-bind =
" componentField" />
44
44
</FormControl >
49
49
<!-- Password Field -->
50
50
<FormField v-slot =" { componentField }" name =" password" >
51
51
<FormItem >
52
- <FormLabel >Password </FormLabel >
52
+ <FormLabel >{{ $t('form.field.password') }} </FormLabel >
53
53
<FormControl >
54
- <Input type =" password" placeholder =" Enter your password " v-bind =" componentField" />
54
+ <Input type =" password" placeholder =" " v-bind =" componentField" />
55
55
</FormControl >
56
56
<FormMessage />
57
57
</FormItem >
60
60
<!-- Max Connections Field -->
61
61
<FormField v-slot =" { componentField }" name =" max_conns" >
62
62
<FormItem >
63
- <FormLabel >Max Connections </FormLabel >
63
+ <FormLabel >{{ $t('admin.inbox.max_connections') }} </FormLabel >
64
64
<FormControl >
65
65
<Input type =" number" placeholder =" 2" v-bind =" componentField" />
66
66
</FormControl >
67
67
<FormMessage />
68
- <FormDescription > Maximum concurrent connections to the server. </FormDescription >
68
+ <FormDescription >{{ $t('admin.inbox.max_connections.description') }} </FormDescription >
69
69
</FormItem >
70
70
</FormField >
71
71
72
72
<!-- Idle Timeout Field -->
73
73
<FormField v-slot =" { componentField }" name =" idle_timeout" >
74
74
<FormItem >
75
- <FormLabel >Idle Timeout </FormLabel >
75
+ <FormLabel >{{ $t('admin.inbox.idle_timeout') }} </FormLabel >
76
76
<FormControl >
77
77
<Input type =" text" placeholder =" 15s" v-bind =" componentField" />
78
78
</FormControl >
79
79
<FormMessage />
80
80
<FormDescription >
81
- Time to wait for new activity on a connection before closing it and removing it from the
82
- pool (s for second, m for minute)
81
+ {{ $t('admin.inbox.idle_timeout.description') }}
83
82
</FormDescription >
84
83
</FormItem >
85
84
</FormField >
86
85
87
86
<!-- Wait Timeout Field -->
88
87
<FormField v-slot =" { componentField }" name =" wait_timeout" >
89
88
<FormItem >
90
- <FormLabel >Wait Timeout </FormLabel >
89
+ <FormLabel >{{ $t('admin.inbox.wait_timeout') }} </FormLabel >
91
90
<FormControl >
92
91
<Input type =" text" placeholder =" 5s" v-bind =" componentField" />
93
92
</FormControl >
94
93
<FormMessage />
95
94
<FormDescription >
96
- Time to wait for new activity on a connection before closing it and removing it from the
97
- pool (s for second, m for minute, h for hour).
95
+ {{ $t('admin.inbox.wait_timeout.description') }}
98
96
</FormDescription >
99
97
</FormItem >
100
98
</FormField >
101
99
102
100
<!-- Authentication Protocol Field -->
103
101
<FormField v-slot =" { componentField }" name =" auth_protocol" >
104
102
<FormItem >
105
- <FormLabel >Authentication Protocol </FormLabel >
103
+ <FormLabel >{{ $t('admin.inbox.auth_protocol') }} </FormLabel >
106
104
<FormControl >
107
105
<Select v-bind =" componentField" v-model =" componentField.modelValue" >
108
106
<SelectTrigger >
109
- <SelectValue placeholder =" Select an authentication protocol " />
107
+ <SelectValue : placeholder =" t('admin.inbox.auth_protocol.description') " />
110
108
</SelectTrigger >
111
109
<SelectContent >
112
110
<SelectGroup >
125
123
<!-- Email Address Field -->
126
124
<FormField v-slot =" { componentField }" name =" email_address" >
127
125
<FormItem >
128
- <FormLabel >From Email Address </FormLabel >
126
+ <FormLabel >{{ $t('form.field.from_email_address') }} </FormLabel >
129
127
<FormControl >
130
128
<Input
131
129
type =" text"
132
- placeholder =
" From email address. e.g. My Support <[email protected] > "
130
+ : placeholder =" t('admin.inbox.from_email_address.placeholder') "
133
131
v-bind =" componentField"
134
132
/>
135
133
</FormControl >
136
134
<FormMessage />
137
- <FormDescription
138
- >From email address. e.g. My Support
< ; [email protected] > ; </
FormDescription
139
- >
135
+ <FormDescription > {{ $t('admin.inbox.from_email_address.description') }}</FormDescription >
140
136
</FormItem >
141
137
</FormField >
142
138
143
139
<!-- Max Message Retries Field -->
144
140
<FormField v-slot =" { componentField }" name =" max_msg_retries" >
145
141
<FormItem >
146
- <FormLabel >Max Message Retries </FormLabel >
142
+ <FormLabel >{{ $t('admin.inbox.max_retries') }} </FormLabel >
147
143
<FormControl >
148
- <Input type =" number" placeholder =" 2 " v-bind =" componentField" />
144
+ <Input type =" number" placeholder =" 3 " v-bind =" componentField" />
149
145
</FormControl >
150
146
<FormMessage />
151
- <FormDescription > Number of times to retry when a message fails. </FormDescription >
147
+ <FormDescription > {{ $t('admin.inbox.max_retries.description') }} </FormDescription >
152
148
</FormItem >
153
149
</FormField >
154
150
155
151
<!-- HELO Hostname Field -->
156
152
<FormField v-slot =" { componentField }" name =" hello_hostname" >
157
153
<FormItem >
158
- <FormLabel >HELO Hostname </FormLabel >
154
+ <FormLabel >{{ $t('admin.inbox.helo_hostname') }} </FormLabel >
159
155
<FormControl >
160
- <Input type =" text" placeholder =" smtp.example.com " v-bind =" componentField" />
156
+ <Input type =" text" placeholder =" " v-bind =" componentField" />
161
157
</FormControl >
162
158
<FormDescription >
163
- The hostname to use in the HELO/EHLO command. If not set, defaults to localhost.
159
+ {{ $t('admin.inbox.helo_hostname.description') }}
164
160
</FormDescription >
165
161
<FormMessage />
166
162
</FormItem >
173
169
<FormControl >
174
170
<Select v-bind =" componentField" v-model =" componentField.modelValue" >
175
171
<SelectTrigger >
176
- <SelectValue placeholder =" Select a TLS type " />
172
+ <SelectValue : placeholder =" t('form.field.selectTLS') " />
177
173
</SelectTrigger >
178
174
<SelectContent >
179
175
<SelectGroup >
192
188
<FormField v-slot =" { componentField, handleChange }" name =" tls_skip_verify" >
193
189
<FormItem class =" flex flex-row items-center justify-between box p-4" >
194
190
<div class =" space-y-0.5" >
195
- <FormLabel class =" text-base" >Skip TLS Verification </FormLabel >
196
- <FormDescription > Skip hostname check on the TLS certificate. </FormDescription >
191
+ <FormLabel class =" text-base" >{{ $t('admin.inbox.skipTLSVerification') }} </FormLabel >
192
+ <FormDescription >{{ $t('admin.inbox.skipTLSVerification.description') }} </FormDescription >
197
193
</div >
198
194
<FormControl >
199
195
<Switch :checked =" componentField.modelValue" @update:checked =" handleChange" />
206
202
</template >
207
203
208
204
<script setup>
209
- import { watch , ref } from ' vue'
205
+ import { watch , ref , computed } from ' vue'
210
206
import { Button } from ' @/components/ui/button'
211
207
import { useForm } from ' vee-validate'
212
208
import { toTypedSchema } from ' @vee-validate/zod'
213
- import { smtpConfigSchema } from ' ./formSchema.js'
209
+ import { createFormSchema } from ' ./formSchema.js'
214
210
import {
215
211
FormControl ,
216
212
FormField ,
@@ -231,8 +227,10 @@ import { Checkbox } from '@/components/ui/checkbox'
231
227
import { Switch } from ' @/components/ui/switch'
232
228
import { Label } from ' @/components/ui/label'
233
229
import { Input } from ' @/components/ui/input'
230
+ import { useI18n } from ' vue-i18n'
234
231
235
232
const isLoading = ref (false )
233
+ const { t } = useI18n ()
236
234
const props = defineProps ({
237
235
initialValues: {
238
236
type: Object ,
@@ -245,12 +243,19 @@ const props = defineProps({
245
243
submitLabel: {
246
244
type: String ,
247
245
required: false ,
248
- default : () => ' Save'
246
+ default : () => ' '
247
+ }
248
+ })
249
+
250
+ const submitLabel = computed (() => {
251
+ if (props .submitLabel ) {
252
+ return props .submitLabel
249
253
}
254
+ return t (' globals.buttons.save' )
250
255
})
251
256
252
257
const smtpForm = useForm ({
253
- validationSchema: toTypedSchema (smtpConfigSchema )
258
+ validationSchema: toTypedSchema (createFormSchema (t) )
254
259
})
255
260
256
261
const onSmtpSubmit = smtpForm .handleSubmit (async (values ) => {
0 commit comments