Skip to content

Commit 9837030

Browse files
committed
Register $t & $tdate as globalProperties
1 parent 6a45865 commit 9837030

File tree

25 files changed

+456
-433
lines changed

25 files changed

+456
-433
lines changed

.vscode/settings.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
{
2-
"cSpell.words": ["axios", "pinia", "Sprunjer"]
2+
"cSpell.words": [
3+
"axios",
4+
"pinia",
5+
"Sprunjer",
6+
"tdate"
7+
]
38
}

package-lock.json

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

packages/skeleton/app/assets/components/NavBar.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
<script setup>
22
import { useRouter } from 'vue-router'
33
import { useAuthStore } from '@userfrosting/sprinkle-account/stores'
4-
import { useConfigStore, useTranslator } from '@userfrosting/sprinkle-core/stores'
4+
import { useConfigStore } from '@userfrosting/sprinkle-core/stores'
55
const router = useRouter()
66
const config = useConfigStore()
77
88
// Logout API variables
99
const auth = useAuthStore()
10-
11-
// Translator
12-
const { $t } = useTranslator()
1310
</script>
1411

1512
<template>

packages/skeleton/app/assets/views/AboutView.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<script setup lang="ts">
22
import { onMounted } from 'vue'
33
import { usePageMeta } from '@userfrosting/sprinkle-core/composables'
4-
import { useTranslator } from '@userfrosting/sprinkle-core/stores'
5-
const { $t } = useTranslator()
64
const page = usePageMeta()
75
86
// Hide the title on this page

packages/skeleton/app/assets/views/HomeView.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import { useConfigStore, useTranslator } from '@userfrosting/sprinkle-core/store
66
77
const auth = useAuthStore()
88
const config = useConfigStore()
9-
const { $t, $tdate } = useTranslator()
9+
const { translate } = useTranslator()
1010
1111
const helloMsg = computed(() => {
12-
return $t('WELCOME_TO', {
12+
return translate('WELCOME_TO', {
1313
title: config.get('site.title'),
1414
user: auth.user?.full_name ?? '&GUEST'
1515
})

packages/skeleton/env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference types="vite/client" />
2+
/// <reference types="@userfrosting/sprinkle-core" />
23
/// <reference types="@userfrosting/theme-pink-cupcake/components" />
34
/**
45
* This is required for webpack to correctly import vue file when using TypeScript.

packages/sprinkle-account/env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference types="vite/client" />
2+
/// <reference types="@userfrosting/sprinkle-core" />
23

34
import { createPinia } from 'pinia'
45
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

packages/sprinkle-admin/app/assets/components/SidebarMenuItems.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
<script setup lang="ts">
2-
import { useTranslator } from '@userfrosting/sprinkle-core/stores'
3-
const { $t } = useTranslator()
4-
</script>
5-
61
<template>
72
<UFSideBarItem :to="{ name: 'admin.dashboard' }" faIcon="gauge-high" :label="$t('DASHBOARD')" />
83
<UFSideBarItem :to="{ name: 'admin.users' }" faIcon="user" label="Users" />

packages/sprinkle-admin/env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference types="vite/client" />
2+
/// <reference types="@userfrosting/sprinkle-core" />
23

34
import { createPinia } from 'pinia'
45
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

packages/sprinkle-core/app/assets/composables/usePageMeta.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const usePageMeta = defineStore('pageMeta', () => {
1818
* Globally provided properties
1919
*/
2020
const route = useRoute()
21-
const { $t } = useTranslator()
21+
const { translate } = useTranslator()
2222

2323
/**
2424
* States
@@ -70,7 +70,7 @@ export const usePageMeta = defineStore('pageMeta', () => {
7070

7171
// Update Page Title & Description with current route
7272
title.value = route.meta.title || ''
73-
description.value = $t(route.meta.description || '')
73+
description.value = translate(route.meta.description || '')
7474
}
7575

7676
// Update the document title
@@ -92,7 +92,7 @@ export const usePageMeta = defineStore('pageMeta', () => {
9292
*/
9393
const siteTitle = computed<string>(() => useConfigStore().get('site.title') || '')
9494
const pageFullTitle = computed<string>(() => {
95-
return title.value ? $t(title.value) + ' | ' + siteTitle.value : siteTitle.value
95+
return title.value ? translate(title.value) + ' | ' + siteTitle.value : siteTitle.value
9696
})
9797

9898
/**

0 commit comments

Comments
 (0)