Skip to content

NVR with realtime local object detection for IP cameras

Add chinese docs (#17954)

GuoQing Liu83188e7ea469
diff --git a/README_CN.md b/README_CN.md
index ff72803a2b..efcea34805 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -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
+Bilibili:https://space.bilibili.com/3546894915602564
diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts
index 865cb53d2f..5e80e844ae 100644
--- a/docs/docusaurus.config.ts
+++ b/docs/docusaurus.config.ts
@@ -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',
diff --git a/docs/src/components/LanguageAlert/index.jsx b/docs/src/components/LanguageAlert/index.jsx
new file mode 100644
index 0000000000..b786c8a930
--- /dev/null
+++ b/docs/src/components/LanguageAlert/index.jsx
@@ -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>
+ );
+}
\ No newline at end of file
diff --git a/docs/src/components/LanguageAlert/styles.module.css b/docs/src/components/LanguageAlert/styles.module.css
new file mode 100644
index 0000000000..f8d1e8eb26
--- /dev/null
+++ b/docs/src/components/LanguageAlert/styles.module.css
@@ -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;
+ }
\ No newline at end of file
diff --git a/docs/src/theme/Navbar/index.js b/docs/src/theme/Navbar/index.js
new file mode 100644
index 0000000000..4dd3aee150
--- /dev/null
+++ b/docs/src/theme/Navbar/index.js
@@ -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 />
+ </>
+ );
+}
\ No newline at end of file