Skip to content

Commit d7d946a

Browse files
committed
feat: integrate i18n for error messages in file upload alerts
1 parent a413718 commit d7d946a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

custom/quillEditor.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ import adminforth from '@/adminforth';
2626
import AsyncQueue from './async-queue';
2727
import Quill from "quill";
2828
import "quill/dist/quill.snow.css";
29+
import { useI18n } from 'vue-i18n';
2930
31+
const { t } = useI18n();
3032
function dbg(title: string,...args: any[]) {
3133
// return; // comment for debug
3234
console.log(title, ...args.map(a =>JSON.stringify(a, null, 1)));
@@ -130,7 +132,7 @@ async function saveToServer(file: File) {
130132
131133
if (error) {
132134
adminforth.alert({
133-
message: `File was not uploaded because of error: ${error}`,
135+
message: `${t('File was not uploaded because of error:')} ${error}`,
134136
variant: 'danger'
135137
});
136138
return;
@@ -155,7 +157,7 @@ async function saveToServer(file: File) {
155157
});
156158
if (!success) {
157159
adminforth.alert({
158-
messageHtml: `<div>Sorry but the file was not uploaded because of S3 Request Error: </div>
160+
messageHtml: `<div>${t('Sorry but the file was not uploaded because of S3 Request Error:')} </div>
159161
<pre style="white-space: pre-wrap; word-wrap: break-word; overflow-wrap: break-word; max-width: 100%;">${
160162
xhr.responseText.replace(/</g, '&lt;').replace(/>/g, '&gt;')
161163
}</pre>`,

0 commit comments

Comments
 (0)