- one more time rework slider
- rework design system - fill trainer page
This commit is contained in:
@@ -46,6 +46,7 @@ export const ui = {
|
||||
// Footer
|
||||
'footer.logo': 'THEREAL<span class="text-brand">SKILL</span>',
|
||||
'footer.copyright': 'Все права защищены. Политика конфиденциальности.',
|
||||
'coaches.socialMedias.title': (name: string) => `${name} в соцсетях`,
|
||||
},
|
||||
en: {
|
||||
'seo.meta.description':
|
||||
@@ -86,5 +87,6 @@ export const ui = {
|
||||
// Footer
|
||||
'footer.logo': 'THEREAL<span class="text-brand">SKILL</span>',
|
||||
'footer.copyright': 'All rights reserved. Privacy Policy.',
|
||||
'coaches.socialMedias.title': (name: string) => `${name} in social medias`,
|
||||
},
|
||||
} as const
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { Primitive } from 'astro:schema'
|
||||
import { ui, type TranslationKey } from './ui'
|
||||
|
||||
import { i18n } from 'astro:config/client'
|
||||
@@ -11,7 +12,12 @@ export function getLangFromUrl(url: URL) {
|
||||
}
|
||||
|
||||
export function useTranslations(lang?: string) {
|
||||
return function t(key: TranslationKey) {
|
||||
return ui[lang as keyof typeof ui]?.[key] || ui[i18n!.defaultLocale as keyof typeof ui][key]
|
||||
return function t(key: TranslationKey, payload?: Primitive): string {
|
||||
const translation =
|
||||
ui[lang as keyof typeof ui]?.[key] || ui[i18n!.defaultLocale as keyof typeof ui][key]
|
||||
|
||||
if (typeof translation === 'function') return translation(String(payload))
|
||||
|
||||
return translation
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user