mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
use useLocale
This commit is contained in:
parent
0c13f8d358
commit
703a1e13db
4 changed files with 13 additions and 21 deletions
|
|
@ -2,22 +2,19 @@ import React from 'react';
|
|||
import Head from 'next/head';
|
||||
import Header from 'components/layout/Header';
|
||||
import Footer from 'components/layout/Footer';
|
||||
import { useIntl } from 'react-intl';
|
||||
import useLocale from 'hooks/useLocale';
|
||||
|
||||
export default function Layout({ title, children, header = true, footer = true }) {
|
||||
const intl = useIntl();
|
||||
const [locale] = useLocale();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head dir={intl.formatMessage({ id: 'metrics.dir', defaultMessage: 'ltr' })}>
|
||||
<Head>
|
||||
<title>umami{title && ` - ${title}`}</title>
|
||||
</Head>
|
||||
|
||||
{header && <Header />}
|
||||
<main
|
||||
className="container"
|
||||
dir={intl.formatMessage({ id: 'metrics.dir', defaultMessage: 'ltr' })}
|
||||
>
|
||||
<main className="container" dir={locale === 'ar-SA' ? 'rtl' : 'ltr'}>
|
||||
{children}
|
||||
</main>
|
||||
{footer && <Footer />}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue