File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22import PageLayout from ' ~/layouts/PageLayout.astro' ;
33import Header from ' ~/components/widgets/Header.astro' ;
44
5- import { headerData } from ' ~/navigation' ;
5+ import { getHeaderData } from ' ~/navigation' ;
6+ import { getLangFromUrl } from ' ~/i18n/utils' ;
67import type { MetaData } from ' ~/types' ;
78
89export interface Props {
910 metadata? : MetaData ;
1011}
1112
1213const { metadata } = Astro .props ;
14+ const currentLang = getLangFromUrl (Astro .url );
15+ const headerData = getHeaderData (currentLang );
1316---
1417
1518<PageLayout metadata ={ metadata } >
Original file line number Diff line number Diff line change 11import { getPermalink } from './utils/permalinks' ;
22import { useTranslations } from './i18n/utils' ;
3+ import type { ui } from './i18n/ui' ;
34import favIcon from '~/assets/favicons/favicon.svg' ;
45
56// Function to get locale-aware navigation
6- export const getHeaderData = ( locale : string = 'fr' ) => {
7- const t = useTranslations ( locale as 'fr' | 'en' ) ;
7+ export const getHeaderData = ( locale : keyof typeof ui ) => {
8+ const t = useTranslations ( locale ) ;
89
910 return {
1011 links : [
@@ -24,8 +25,8 @@ export const getHeaderData = (locale: string = 'fr') => {
2425 } ;
2526} ;
2627
27- export const getFooterData = ( locale : string = 'fr' ) => {
28- const t = useTranslations ( locale as 'fr' | 'en' ) ;
28+ export const getFooterData = ( locale : keyof typeof ui ) => {
29+ const t = useTranslations ( locale ) ;
2930
3031 return {
3132 links : [
@@ -58,7 +59,3 @@ export const getFooterData = (locale: string = 'fr') => {
5859 } ;
5960} ;
6061
61- // Keep backward compatibility - default to French
62- export const headerData = getHeaderData ( 'fr' ) ;
63- export const footerData = getFooterData ( 'fr' ) ;
64-
Original file line number Diff line number Diff line change @@ -8,10 +8,14 @@ import Steps2 from '~/components/widgets/Steps2.astro';
88import Content from ' ~/components/widgets/Content.astro' ;
99import Pricing from ' ~/components/widgets/Pricing.astro' ;
1010
11- import { headerData } from ' ~/navigation' ;
11+ import { getHeaderData } from ' ~/navigation' ;
12+ import { getLangFromUrl } from ' ~/i18n/utils' ;
1213import FAQs from ' ~/components/widgets/FAQs.astro' ;
1314import BlogLatestPosts from ' ~/components/widgets/BlogLatestPosts.astro' ;
1415
16+ const currentLang = getLangFromUrl (Astro .url );
17+ const headerData = getHeaderData (currentLang );
18+
1519const metadata = {
1620 title: ' SaaS Landing Page' ,
1721};
You can’t perform that action at this time.
0 commit comments