Add chinese docs (#17954)

* add docs chinese i18n

* fix some broken links

* update some i18n

* update chinese docs

* add chinese community docs

* Change docs i18n chinese label
This commit is contained in:
GuoQing Liu 2025-05-06 22:49:49 +08:00 committed by GitHub
parent 3a69273f0c
commit 83188e7ea4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 78 additions and 6 deletions

View File

@ -24,11 +24,9 @@
- 通过RTSP重新流传输以减少摄像头的连接数
- 支持WebRTC和MSE实现低延迟的实时观看
## 文档(英文)
## 社区中文翻译文档
你可以在这里查看文档 https://docs.frigate.video
文档还暂时没有提供翻译,将会在未来提供。
你可以在这里查看文档 https://docs.frigate-cn.video
## 赞助
@ -60,5 +58,7 @@
## 翻译
我们使用 [Weblate](https://hosted.weblate.org/projects/frigate-nvr/) 平台提供翻译支持,欢迎参与进来一起完善。
## 中文讨论社区
欢迎加入非官方中文讨论QQ群1043861059
## 非官方中文讨论社区
欢迎加入中文讨论QQ群1043861059
Bilibilihttps://space.bilibili.com/3546894915602564

View File

@ -17,6 +17,15 @@ const config: Config = {
markdown: {
mermaid: true,
},
i18n: {
defaultLocale: 'en',
locales: ['en'],
localeConfigs: {
en: {
label: 'English',
}
},
},
themeConfig: {
algolia: {
appId: 'WIURGBNBPY',
@ -82,6 +91,16 @@ const config: Config = {
label: 'Demo',
position: 'right',
},
{
type: 'localeDropdown',
position: 'right',
dropdownItemsAfter: [
{
label: '简体中文(社区翻译)',
href: 'https://docs.frigate-cn.video',
}
]
},
{
href: 'https://github.com/blakeblackshear/frigate',
label: 'GitHub',

View File

@ -0,0 +1,25 @@
import React, { useEffect, useState } from 'react';
import { useLocation } from '@docusaurus/router';
import styles from './styles.module.css';
export default function LanguageAlert() {
const [showAlert, setShowAlert] = useState(false);
const { pathname } = useLocation();
useEffect(() => {
const userLanguage = navigator?.language || 'en';
const isChineseUser = userLanguage.includes('zh');
setShowAlert(isChineseUser);
}, [pathname]);
if (!showAlert) return null;
return (
<div className={styles.alert}>
<span>检测到您的主要语言为中文您可以访问由中文社区翻译的</span>
<a href={'https://docs.frigate-cn.video'+pathname}>中文文档</a>
<span> 以获得更好的体验</span>
</div>
);
}

View File

@ -0,0 +1,13 @@
.alert {
padding: 12px;
background: #fff8e6;
border-bottom: 1px solid #ffd166;
text-align: center;
font-size: 15px;
}
.alert a {
color: #1890ff;
font-weight: 500;
margin-left: 6px;
}

View File

@ -0,0 +1,15 @@
import React from 'react';
import NavbarLayout from '@theme/Navbar/Layout';
import NavbarContent from '@theme/Navbar/Content';
import LanguageAlert from '../../components/LanguageAlert';
export default function Navbar() {
return (
<>
<NavbarLayout>
<NavbarContent />
</NavbarLayout>
<LanguageAlert />
</>
);
}