🌐(frontend) make Docs title translatable
The title of the docs page was not translatable. We now use the `t` function to translate the title.
This commit is contained in:
@@ -3,6 +3,7 @@ import { useQueryClient } from '@tanstack/react-query';
|
|||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { Box, Text, TextErrors } from '@/components';
|
import { Box, Text, TextErrors } from '@/components';
|
||||||
import { DocEditor } from '@/docs/doc-editor';
|
import { DocEditor } from '@/docs/doc-editor';
|
||||||
@@ -64,14 +65,15 @@ const DocPage = ({ id }: DocProps) => {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const { replace } = useRouter();
|
const { replace } = useRouter();
|
||||||
useCollaboration(doc?.id, doc?.content);
|
useCollaboration(doc?.id, doc?.content);
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (doc?.title) {
|
if (doc?.title) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.title = `${doc.title} - Docs`;
|
document.title = `${doc.title} - ${t('Docs')}`;
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
}, [doc?.title]);
|
}, [doc?.title, t]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!docQuery || isFetching) {
|
if (!docQuery || isFetching) {
|
||||||
|
|||||||
Reference in New Issue
Block a user