Skip to content

Commit 260773b

Browse files
committed
mroe translations
1 parent 8c23d34 commit 260773b

File tree

12 files changed

+56
-37
lines changed

12 files changed

+56
-37
lines changed

adminforth/plugins/foreign-inline-list/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

adminforth/plugins/foreign-inline-list/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adminforth/foreign-inline-list",
3-
"version": "1.0.24",
3+
"version": "1.0.25",
44
"description": "AdminForth plugin for adding list of children items to the parent item show page",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

adminforth/plugins/open-signup/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

adminforth/plugins/open-signup/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adminforth/open-signup",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"main": "dist/index.js",
55
"types": "dist/index.d.ts",
66
"type": "module",

adminforth/plugins/two-factors-auth/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

adminforth/plugins/two-factors-auth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adminforth/two-factors-auth",
3-
"version": "1.0.32",
3+
"version": "1.0.33",
44
"description": "AdminForth plugin for two factors authentication",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11

22

3-
## [1.0.23] - 2021-10-07
3+
## [1.0.24] - 2023-12-24
4+
5+
### Fixed
6+
- Add translation
7+
8+
## [1.0.23] - 2023-10-07
49

510
### Fixed
611
- preview maxWidth to limit max width of image
7-
- Added accept attribute to input
12+
- Added accept attribute to input

adminforth/plugins/upload/custom/imageGenerator.vue

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
<!-- Modal header -->
99
<div class="flex items-center justify-between p-3 md:p-4 border-b rounded-t dark:border-gray-600">
1010
<h3 class="text-xl font-semibold text-gray-900 dark:text-white">
11-
Generate image with AI
11+
{{ $('Generate image with AI') }}
1212
</h3>
1313
<button type="button"
1414
@click="emit('close')"
1515
class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white" >
1616
<svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
1717
<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"/>
1818
</svg>
19-
<span class="sr-only">Close modal</span>
19+
<span class="sr-only">{{ $('Close modal') }}</span>
2020
</button>
2121
</div>
2222
<!-- Modal body -->
@@ -33,7 +33,7 @@
3333
>
3434
<div role="status" class="absolute -translate-x-1/2 -translate-y-1/2 top-2/4 left-1/2">
3535
<svg aria-hidden="true" class="w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/><path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/></svg>
36-
<span class="sr-only">Loading...</span>
36+
<span class="sr-only">{{ $('Loading...') }}</span>
3737
</div>
3838
</div>
3939

@@ -49,7 +49,7 @@
4949

5050
<button @click="generateImages" type="button" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4
5151
focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center
52-
dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800 ms-2">Generate images</button>
52+
dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800 ms-2">{{ $('Generate images') }}</button>
5353

5454
</div>
5555

@@ -62,7 +62,7 @@
6262
<svg class="w-4 h-4 text-white dark:text-gray-800 rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 6 10">
6363
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 1 1 5l4 4"/>
6464
</svg>
65-
<span class="sr-only">Previous</span>
65+
<span class="sr-only">{{ $('Previous') }}</span>
6666
</span>
6767
</button>
6868
<button type="button" class="absolute top-0 end-0 z-30 flex items-center justify-center h-full px-4 cursor-pointer group focus:outline-none"
@@ -72,7 +72,7 @@
7272
<svg class="w-4 h-4 text-white dark:text-gray-800 rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 6 10">
7373
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 9 4-4-4-4"/>
7474
</svg>
75-
<span class="sr-only">Next</span>
75+
<span class="sr-only">{{ $('Next') }}</span>
7676
</span>
7777
</button>
7878

@@ -87,10 +87,10 @@
8787
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center
8888
dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800
8989
disabled:opacity-50 disabled:cursor-not-allowed"
90-
>Use image</button>
90+
>{{ $('Use image') }}</button>
9191
<button type="button" class="py-2.5 px-5 ms-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
9292
@click="emit('close')"
93-
>Cancel</button>
93+
>{{ $('Cancel') }}</button>
9494
</div>
9595
</div>
9696
</div>
@@ -106,6 +106,9 @@
106106
import { ref, onMounted, nextTick } from 'vue'
107107
import { Carousel } from 'flowbite';
108108
import { callAdminForthApi } from '@/utils';
109+
import { useI18n } from 'vue-i18n';
110+
111+
const { t: $t } = useI18n();
109112
110113
const prompt = ref('');
111114
const emit = defineEmits(['close', 'uploadImage']);
@@ -130,7 +133,10 @@ onMounted(() => {
130133
}).join('\n');
131134
}
132135
133-
prompt.value = `Generate image for field "${props.meta.pathColumnLabel}" in ${props.meta.resourceLabel}. No text should be on image.`
136+
prompt.value = $t('Generate image for field "{field}" in {resource}. No text should be on image.', {
137+
field: props.meta.pathColumnLabel,
138+
resource: props.meta.resourceLabel,
139+
});
134140
if (additionalContext) {
135141
prompt.value += ` ${additionalContext}`;
136142
}
@@ -180,7 +186,7 @@ async function generateImages() {
180186
181187
if (resp.error) {
182188
window.adminforth.alert({
183-
message: `error: ${JSON.stringify(resp.error)}`,
189+
message: $t('Error: {error}', { error: JSON.stringify(resp.error) }),
184190
variant: 'danger',
185191
timeout: 15,
186192
});

adminforth/plugins/upload/custom/preview.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<svg class="w-4 h-4 me-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
2626
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
2727
</svg>
28-
Download file
28+
{{ $('Download file') }}
2929
</a>
3030
</template>
3131

adminforth/plugins/upload/custom/uploader.vue

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
</svg>
3232

3333
<template v-if="!uploaded">
34-
<p class="mb-2 text-sm text-gray-500 dark:text-gray-400"><span class="font-semibold">Click to upload</span> or drag and drop</p>
34+
<p class="mb-2 text-sm text-gray-500 dark:text-gray-400"><span class="font-semibold">{{ $t('Click to upload') }}</span> {{ $t('or drag and drop') }}</p>
3535
<p class="text-xs text-gray-500 dark:text-gray-400">
36-
{{ allowedExtensionsLabel }} {{ meta.maxFileSize ? `(up to ${humanifySize(meta.maxFileSize)})` : '' }}
36+
{{ allowedExtensionsLabel }} {{ meta.maxFileSize ? $t(`(up to {size})`, { size: humanifySize(meta.maxFileSize) }) : '' }}
3737
</p>
3838
</template>
3939

@@ -50,12 +50,12 @@
5050
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
5151
</svg>
5252
<p class="ml-2 text-sm text-green-600 dark:text-green-400 flex items-center">
53-
File uploaded
53+
{{ $('File uploaded') }}
5454
<span class="text-xs text-gray-500 dark:text-gray-400">{{ humanifySize(uploadedSize) }}</span>
5555
</p>
5656

5757
<button @click.stop.prevent="clear" class="ml-2 text-xs text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-500
58-
hover:underline dark:hover:underline focus:outline-none">Clear</button>
58+
hover:underline dark:hover:underline focus:outline-none">{{ $t('Clear') }}</button>
5959
</div>
6060

6161
</div>
@@ -69,6 +69,9 @@
6969
import { computed, ref, onMounted, watch } from 'vue'
7070
import { callAdminForthApi } from '@/utils'
7171
import { IconMagic } from '@iconify-prerendered/vue-mdi';
72+
import { useI18n } from 'vue-i18n';
73+
74+
const { t } = useI18n();
7275
7376
const inputId = computed(() => `dropzone-file-${props.meta.pluginInstanceId}`);
7477
@@ -103,7 +106,6 @@ watch(() => uploaded, (value) => {
103106
104107
function uploadGeneratedImage(imgBlob) {
105108
// update the value
106-
console.log('⚓⚓ Generated image uploaded:', imgBlob);
107109
108110
const file = new File([imgBlob], 'generated.png', { type: imgBlob.type });
109111
onFileChange({
@@ -130,7 +132,7 @@ const allowedExtensionsLabel = computed(() => {
130132
// make upper case and write in format EXT1, EXT2 or EXT3
131133
let label = allowedExtensions.map(ext => ext.toUpperCase()).join(', ');
132134
// last comma to 'or'
133-
label = label.replace(/,([^,]*)$/, ' or$1')
135+
label = label.replace(/,([^,]*)$/, ` ${t('or')}$1`)
134136
return label
135137
});
136138
@@ -191,7 +193,10 @@ const onFileChange = async (e) => {
191193
const allowedExtensions = props.meta.allowedExtensions || []
192194
if (allowedExtensions.length > 0 && !allowedExtensions.includes(extension)) {
193195
window.adminforth.alert({
194-
message: `Sorry but the file type ${extension} is not allowed. Please upload a file with one of the following extensions: ${allowedExtensionsLabel.value}`,
196+
message: t('Sorry but the file type {extension} is not allowed. Please upload a file with one of the following extensions: {allowedExtensionsLabel}', {
197+
extension,
198+
allowedExtensionsLabel: allowedExtensionsLabel.value,
199+
}),
195200
variant: 'danger'
196201
});
197202
return;
@@ -200,13 +205,16 @@ const onFileChange = async (e) => {
200205
// validate file size
201206
if (props.meta.maxFileSize && size > props.meta.maxFileSize) {
202207
window.adminforth.alert({
203-
message: `Sorry but the file size ${humanifySize(size)} is too large. Please upload a file with a maximum size of ${humanifySize(props.meta.maxFileSize)}`,
208+
message: t('Sorry but the file size {size} is too large. Please upload a file with a maximum size of {maxFileSize}', {
209+
size: humanifySize(size),
210+
maxFileSize: humanifySize(props.meta.maxFileSize),
211+
}),
204212
variant: 'danger'
205213
});
206214
return;
207215
}
208216
209-
emit('update:inValidity', 'Upload in progress...');
217+
emit('update:inValidity', t('Upload in progress...'));
210218
try {
211219
// supports preview
212220
if (type.startsWith('image/')) {
@@ -230,7 +238,7 @@ const onFileChange = async (e) => {
230238
231239
if (error) {
232240
window.adminforth.alert({
233-
message: `File was not uploaded because of error: ${error}`,
241+
message: t('File was not uploaded because of error: {error}', { error }),
234242
variant: 'danger'
235243
});
236244
imgPreview.value = null;
@@ -258,7 +266,7 @@ const onFileChange = async (e) => {
258266
});
259267
if (!success) {
260268
window.adminforth.alert({
261-
messageHtml: `<div>Sorry but the file was not uploaded because of S3 Request Error: </div>
269+
messageHtml: `<div>${$t('Sorry but the file was not uploaded because of S3 Request Error:')}</div>
262270
<pre style="white-space: pre-wrap; word-wrap: break-word; overflow-wrap: break-word; max-width: 100%;">${
263271
xhr.responseText.replace(/</g, '&lt;').replace(/>/g, '&gt;')
264272
}</pre>`,
@@ -275,7 +283,7 @@ const onFileChange = async (e) => {
275283
} catch (error) {
276284
console.error('Error uploading file:', error);
277285
window.adminforth.alert({
278-
message: `Sorry but the file was not be uploaded. Please try again: ${error.message}`,
286+
message: t('Sorry but the file was not be uploaded. Please try again: {error}', { error: error.message }),
279287
variant: 'danger'
280288
});
281289
imgPreview.value = null;

0 commit comments

Comments
 (0)