Skip to content

Commit 80a5f2e

Browse files
committed
fix: fix translations support
1 parent 79b03ce commit 80a5f2e

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

custom/ImageCompare.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
<svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
1111
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"/>
1212
</svg>
13-
<span class="sr-only">Close modal</span>
13+
<span class="sr-only">{{ $t('Close modal') }}</span>
1414
</button>
1515
</div>
1616
<div class="flex gap-4 items-start justify-between">
17-
<h3 class="text-sm font-medium text-gray-700 mb-2">Old Image</h3>
18-
<h3 class="text-sm font-medium text-gray-700 mb-2">New Image</h3>
17+
<h3 class="text-sm font-medium text-gray-700 mb-2">{{ $t('Old Image') }}</h3>
18+
<h3 class="text-sm font-medium text-gray-700 mb-2">{{ $t('New Image') }}</h3>
1919
</div>
2020
<div class="flex gap-4 items-center">
2121
<!-- Old Image -->
@@ -29,7 +29,7 @@
2929
class="w-full max-w-sm h-auto object-cover rounded-lg cursor-pointer border hover:border-blue-500 transition-colors duration-200"
3030
/>
3131
<div v-else class="w-full max-w-sm h-48 bg-gray-100 rounded-lg flex items-center justify-center">
32-
<p class="text-gray-500">No old image</p>
32+
<p class="text-gray-500">{{ $t('No old image') }}</p>
3333
</div>
3434
</div>
3535
</div>
@@ -54,7 +54,7 @@
5454
class="w-full max-w-sm h-auto object-cover rounded-lg cursor-pointer border hover:border-blue-500 transition-colors duration-200"
5555
/>
5656
<div v-else class="w-full max-w-sm h-48 bg-gray-100 rounded-lg flex items-center justify-center">
57-
<p class="text-gray-500">No new image</p>
57+
<p class="text-gray-500">{{ $t('No new image') }}</p>
5858
</div>
5959
</div>
6060
</div>

custom/VisionAction.vue

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ async function getRecords() {
302302
} catch (error) {
303303
console.error('Failed to get records:', error);
304304
isError.value = true;
305-
errorMessage.value = `Failed to fetch records. Please, try to re-run the action.`;
305+
errorMessage.value = t(`Failed to fetch records. Please, try to re-run the action.`);
306306
}
307307
}
308308
@@ -319,7 +319,7 @@ async function getImages() {
319319
} catch (error) {
320320
console.error('Failed to get images:', error);
321321
isError.value = true;
322-
errorMessage.value = `Failed to fetch images. Please, try to re-run the action.`;
322+
errorMessage.value = t(`Failed to fetch images. Please, try to re-run the action.`);
323323
}
324324
}
325325
@@ -375,7 +375,7 @@ async function convertImages(fieldName, img) {
375375
376376
async function saveData() {
377377
if (!selected.value?.length) {
378-
adminforth.alert({ message: 'No items selected', variant: 'warning' });
378+
adminforth.alert({ message: t('No items selected'), variant: 'warning' });
379379
return;
380380
}
381381
try {
@@ -420,16 +420,16 @@ async function saveData() {
420420
timeout: 'unlimited',
421421
});
422422
isError.value = true;
423-
errorMessage.value = `Failed to save data. You are not allowed to save.`;
423+
errorMessage.value = t(`Failed to save data. You are not allowed to save.`);
424424
} else {
425425
console.error('Error saving data:', res);
426426
isError.value = true;
427-
errorMessage.value = `Failed to save data. Please, try to re-run the action.`;
427+
errorMessage.value = t(`Failed to save data. Please, try to re-run the action.`);
428428
}
429429
} catch (error) {
430430
console.error('Error saving data:', error);
431431
isError.value = true;
432-
errorMessage.value = `Failed to save data. Please, try to re-run the action.`;
432+
errorMessage.value = t(`Failed to save data. Please, try to re-run the action.`);
433433
} finally {
434434
isLoading.value = false;
435435
}
@@ -474,15 +474,15 @@ async function runAiAction({
474474
if (rateLimitRes?.error) {
475475
isRateLimitExceeded = true;
476476
adminforth.alert({
477-
message: `Rate limit exceeded for "${actionType.replace('_', ' ')}" action. Please try again later.`,
477+
message: t(`Rate limit exceeded for "${actionType.replace('_', ' ')}" action. Please try again later.`),
478478
variant: 'danger',
479479
timeout: 'unlimited',
480480
});
481481
return;
482482
}
483483
} catch (e) {
484484
adminforth.alert({
485-
message: `Error checking rate limit for "${actionType.replace('_', ' ')}" action.`,
485+
message: t(`Error checking rate limit for "${actionType.replace('_', ' ')}" action.`),
486486
variant: 'danger',
487487
timeout: 'unlimited',
488488
});
@@ -516,7 +516,7 @@ async function runAiAction({
516516
} catch (e) {
517517
console.error(`Error during ${actionType} for item ${i}:`, e);
518518
hasError = true;
519-
errorMessage = `Failed to ${actionType.replace('_', ' ')}. Please, try to re-run the action.`;
519+
errorMessage = t(`Failed to ${actionType.replace('_', ' ')}. Please, try to re-run the action.`);
520520
return { success: false, index: i, error: e };
521521
}
522522
});
@@ -591,7 +591,7 @@ async function runAiAction({
591591
}
592592
isAtLeastOneInProgress = true;
593593
adminforth.alert({
594-
message: `Generation action "${actionType.replace('_', ' ')}" failed for record: ${recordId}. Error: ${jobResponse.job?.error || 'Unknown error'}`,
594+
message: t(`Generation action "${actionType.replace('_', ' ')}" failed for record: ${recordId}. Error: ${jobResponse.job?.error || 'Unknown error'}`),
595595
variant: 'danger',
596596
timeout: 'unlimited',
597597
});

custom/VisionTable.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
>
77
<!-- HEADER TEMPLATE -->
88
<template #header:checkboxes="{ item }">
9-
MARK FOR SAVE
9+
{{ $t('MARK FOR SAVE') }}
1010
</template>
1111
<!-- CHECKBOX CELL TEMPLATE -->
1212
<template #cell:checkboxes="{ item }">
@@ -28,12 +28,12 @@
2828
@click="zoomImage(image)"
2929
/>
3030
<div v-else class="w-20 h-20">
31-
<p>Invalid source image</p>
31+
<p>{{ $t('Invalid source image') }}</p>
3232
</div>
3333
</div>
3434
</div>
3535
<div class="flex items-center justify-center text-center w-20 h-20" v-else>
36-
<p>No images found</p>
36+
<p>{{ $t('No images found') }}</p>
3737
</div>
3838
<transition name="fade">
3939
<div
@@ -66,7 +66,7 @@
6666
</Select>
6767
<Tooltip>
6868
<div class="mt-2 flex items-center justify-start gap-1 hover:text-blue-500" :class="{ 'opacity-0': !hovers[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] }">
69-
<p class="text-sm ">old value</p>
69+
<p class="text-sm ">{{ $t('old value') }}</p>
7070
</div>
7171
<template #tooltip>
7272
{{ oldData[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] }}
@@ -82,7 +82,7 @@
8282
</Textarea>
8383
<Tooltip>
8484
<div class="mt-2 flex items-center justify-start gap-1 hover:text-blue-500" :class="{ 'opacity-0': !hovers[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] }">
85-
<p class="text-sm ">old value</p>
85+
<p class="text-sm ">{{ $t('old value') }}</p>
8686
</div>
8787
<template #tooltip>
8888
<p class="max-w-[200px]">{{ oldData[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] }}</p>
@@ -97,7 +97,7 @@
9797
</Toggle>
9898
<Tooltip>
9999
<div class="mt-2 flex items-center justify-start gap-1 hover:text-blue-500" :class="{ 'opacity-0': !hovers[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] }">
100-
<p class="text-sm ">old value</p>
100+
<p class="text-sm ">{{ $t('old value') }}</p>
101101
</div>
102102
<template #tooltip>
103103
{{ oldData[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] }}
@@ -113,7 +113,7 @@
113113
/>
114114
<Tooltip>
115115
<div class="mt-2 flex items-center justify-start gap-1 hover:text-blue-500" :class="{ 'opacity-0': !hovers[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] }">
116-
<p class="text-sm ">old value</p>
116+
<p class="text-sm ">{{ $t('old value') }}</p>
117117
</div>
118118
<template #tooltip>
119119
{{ oldData[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] }}
@@ -137,14 +137,14 @@
137137
:class="{ 'opacity-0': !hovers[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] }"
138138
@click="() => {openImageCompare[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] = true}"
139139
>
140-
old image
140+
{{ $t('old image') }}
141141
</p>
142142
</div>
143143
<div v-else class="flex items-center justify-center text-center w-20 h-20">
144144
<Tooltip v-if="imageGenerationErrorMessage[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])] === 'No source images found'">
145145
<p
146146
>
147-
Can't generate image.
147+
{{ $t("Can't generate image.") }}
148148
</p>
149149
<template #tooltip>
150150
{{ imageGenerationErrorMessage[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])] }}

0 commit comments

Comments
 (0)