init
This commit is contained in:
72
src/i18n/ui.ts
Normal file
72
src/i18n/ui.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
export const languages = {
|
||||
en: 'English',
|
||||
ru: 'Русский',
|
||||
}
|
||||
|
||||
export const ui = {
|
||||
ru: {
|
||||
'home.title': 'The real skill studio',
|
||||
// Header
|
||||
'header.logo': 'THEREAL<span class="text-brand">SKILL</span>',
|
||||
'nav.coaches': 'Тренера',
|
||||
'nav.slider': 'Галерея',
|
||||
'nav.services': 'Услуги',
|
||||
'nav.reviews': 'Отзывы',
|
||||
'nav.contact': 'Контакты',
|
||||
// Hero Section
|
||||
'hero.cta.getStarted': 'Записаться',
|
||||
// Ticker Section
|
||||
'ticker.healthy': 'ВОТ И ВСЕ ЕБАТЬ',
|
||||
'ticker.shapeBody': 'ТЫ СЛАБ',
|
||||
// Coaches Section
|
||||
'coaches.title': 'НАШИ <span class="text-brand">ТРЕНЕРА</span>',
|
||||
'coaches.subtitle': 'Профессиональные тренеры с многолетним опытом',
|
||||
// Slider Section
|
||||
'slider.title':
|
||||
'ПОСМОТРИТЕ, ГДЕ МЫ <br /> <span class="text-brand">ВЫПОЛНЯЕМ УПРАЖНЕНИЯ</span>',
|
||||
'slider.subtitle': 'Современное оборудование в просторном зале',
|
||||
// Services Section
|
||||
'services.title': 'НАШИ <span class="text-brand">УСЛУГИ</span>',
|
||||
'services.subtitle': 'Широкий спектр услуг для достижения ваших целей',
|
||||
// Reviews Section
|
||||
'reviews.title': 'ЧТО О НАС <span class="text-brand">ГОВОРЯТ</span>',
|
||||
'reviews.viewMore.title': 'Посмотреть все отзывы',
|
||||
'reviews.viewMore.description':
|
||||
'Мы рады видеть, как наши клиенты достигли своих целей и превзошли ожидания.',
|
||||
// Footer
|
||||
'footer.logo': 'THEREAL<span class="text-brand">SKILL</span>',
|
||||
'footer.copyright': 'Все права защищены. Политика конфиденциальности.',
|
||||
},
|
||||
en: {
|
||||
'home.title': 'Home Page',
|
||||
// Header
|
||||
'header.logo': 'THEREAL<span class="text-brand">SKILL</span>',
|
||||
'nav.coaches': 'Coaches',
|
||||
'nav.slider': 'Gallery',
|
||||
'nav.services': 'Services',
|
||||
'nav.reviews': 'Reviews',
|
||||
'nav.contact': 'Contact',
|
||||
// Hero Section
|
||||
'hero.cta.getStarted': 'Get Started',
|
||||
// Ticker Section
|
||||
'ticker.healthy': "THAT'S ALL FOLKS",
|
||||
'ticker.shapeBody': 'YOU ARE WEAK',
|
||||
// Coaches Section
|
||||
'coaches.title': 'OUR <span class="text-brand">COACHES</span>',
|
||||
'coaches.subtitle': 'Professional trainers with years of experience',
|
||||
// Slider Section
|
||||
'slider.title': 'TAKE A LOOK WHERE WE <br /> <span class="text-brand">EXERCISE</span>',
|
||||
'slider.subtitle': 'Modern equipment in a spacious gym',
|
||||
// Services Section
|
||||
'services.title': 'OUR <span class="text-brand">SERVICES</span>',
|
||||
'services.subtitle': 'Wide range of services to achieve your goals',
|
||||
// Reviews Section
|
||||
'reviews.title': 'WHAT THEY <span class="text-brand">SAY</span>',
|
||||
'reviews.viewMore.title': 'View all reviews',
|
||||
'reviews.viewMore.description':
|
||||
'We are proud to see how our clients achieved their goals and exceeded expectations.',
|
||||
// Footer
|
||||
'footer.logo': 'THEREAL<span class="text-brand">SKILL</span>',
|
||||
'footer.copyright': 'All rights reserved. Privacy Policy.',
|
||||
},
|
||||
} as const
|
||||
17
src/i18n/utils.ts
Normal file
17
src/i18n/utils.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { ui } from './ui';
|
||||
|
||||
import { i18n } from 'astro:config/client';
|
||||
|
||||
export function getLangFromUrl(url: URL) {
|
||||
const [, lang] = url.pathname.split('/');
|
||||
|
||||
if (lang in ui) return lang as keyof typeof ui;
|
||||
|
||||
return i18n!.defaultLocale;
|
||||
}
|
||||
|
||||
export function useTranslations(lang?: string) {
|
||||
return function t(key: keyof (typeof ui)[keyof typeof ui]) {
|
||||
return ui[lang as keyof typeof ui]?.[key] || ui[i18n!.defaultLocale as keyof typeof ui][key];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user