Skip to content

Commit c7c918e

Browse files
committed
add translations
1 parent e54d35a commit c7c918e

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

adminforth/documentation/docs/tutorial/03-Customization/07-alert.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,21 @@ Create a Vue component in the custom directory of your project, e.g. Alerts.vue:
1313
```html title="./custom/Alerts.vue"
1414
<template>
1515
<div class="ml-3 mt-16">
16-
<button @click="callAlert('Example success alert')" class="focus:outline-none text-white bg-green-700 hover:bg-green-800 focus:ring-4 focus:ring-green-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800">Call alert</button>
17-
<button @click="callConfirmation" class="focus:outline-none text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900">Confirmation</button>
18-
<button @click="callAlert('Example danger alert','warning')" class="focus:outline-none text-white bg-orange-500 hover:bg-orange-400 focus:ring-4 focus:ring-orange-100 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-orange-600 dark:hover:bg-orange-700 dark:focus:ring-orange-900">Danger alert</button>
16+
<button @click="callAlert('Example success alert')" class="focus:outline-none text-white bg-green-700 hover:bg-green-800 focus:ring-4 focus:ring-green-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800">{{$t('Call alert')}}</button>
17+
<button @click="callConfirmation" class="focus:outline-none text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900">{{$t('Confirmation')}}</button>
18+
<button @click="callAlert('Example danger alert','warning')" class="focus:outline-none text-white bg-orange-500 hover:bg-orange-400 focus:ring-4 focus:ring-orange-100 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-orange-600 dark:hover:bg-orange-700 dark:focus:ring-orange-900">{{$t('Danger alert')}}</button>
1919
</div>
2020
</template>
2121
<script setup>
22+
23+
import { useI18n } from 'vue-i18n';
24+
const { t } = useI18n();
25+
2226
function callAlert(message,variant='success'){
2327
window.adminforth.alert({message: message, variant: variant})
2428
};
2529
async function callConfirmation(){
26-
const isConfirmed = await window.adminforth.confirm({message: 'Are you sure?', yes: 'Yes', no: 'No'})
30+
const isConfirmed = await window.adminforth.confirm({message: t('Are you sure?'), yes: t('Yes'), no: t('No')})
2731
}
2832
</script>
2933
```

adminforth/documentation/docs/tutorial/05-Plugins/10-i18n.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ Also add the resource to main file and add menu item in `./index.ts`:
153153
154154
```ts title='./index.ts'
155155

156+
//diff-add
156157
import translations from "./resources/translations";
157158
...
158159

dev-demo/custom/Dash.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<div class="flex justify-between mb-5">
4747
<div>
4848
<p class="text-base font-normal text-gray-500 dark:text-gray-400">
49-
Unlisted vs Listed price
49+
{{ $('Unlisted vs Listed price' ) }}
5050
</p>
5151
</div>
5252
</div>
@@ -63,14 +63,16 @@ import dayjs from 'dayjs';
6363
import { callApi } from '@/utils';
6464
import { Input, Select, VerticalTabs, LinkButton, Dropzone } from '@/afcl';
6565
import { useCoreStore } from '@/stores/core';
66-
66+
import { useI18n } from 'vue-i18n';
6767
const coreStore = useCoreStore();
6868
6969
const selected = ref(null);
7070
const activeTab = ref('Dashboard');
7171
7272
const data = ref({});
7373
74+
const { t } = useI18n();
75+
7476
function onFileChange(file) {
7577
console.log(12, file);
7678
}
@@ -119,7 +121,7 @@ const optionsC1 = {
119121
},
120122
series: [
121123
{
122-
name: "Added apartments",
124+
name: t("Added apartments"),
123125
data: [],
124126
color: "#1A56DB",
125127
},
@@ -279,12 +281,12 @@ const optionsC3 = {
279281
},
280282
series: [
281283
{
282-
name: "Listed Price",
284+
name: t("Listed Price"),
283285
data: [],
284286
color: "#1A56DB",
285287
},
286288
{
287-
name: "Unlisted Price",
289+
name: t("Unlisted Price"),
288290
data: [],
289291
color: "#7E3BF2",
290292
},

0 commit comments

Comments
 (0)