visuddhinanda пре 3 година
родитељ
комит
c96ec97ff8

+ 26 - 28
dashboard-fluent/src/locales/index.ts

@@ -1,4 +1,5 @@
 import Cookies from "js-cookie";
+
 import "moment/locale/zh-cn";
 import "moment/locale/zh-tw";
 import "moment/locale/es";
@@ -13,48 +14,45 @@ import zhHant from "./zh-Hant";
 
 const KEY = "locale";
 
-export const DEFAULT: string =
-  process.env.REACT_APP_DEFAULT_LOCALE || "zh-Hans";
-export const LANGUAGES: string[] = process.env.REACT_APP_LANGUAGES?.split(
-  ","
-) || ["en-US", "zh-Hans"];
+export const DEFAULT: string = process.env.REACT_APP_DEFAULT_LOCALE || "zh-Hans";
+export const LANGUAGES: string[] = process.env.REACT_APP_LANGUAGES?.split(",") || ["en-US", "zh-Hans"];
 
 export const get = (): string => {
-  return localStorage.getItem(KEY) || Cookies.get(KEY) || DEFAULT;
+	return localStorage.getItem(KEY) || Cookies.get(KEY) || DEFAULT;
 };
 
 export const set = (lang: string, reload: boolean) => {
-  Cookies.set(KEY, lang);
-  localStorage.setItem(KEY, lang);
-  if (reload) {
-    window.location.reload();
-  }
+	Cookies.set(KEY, lang);
+	localStorage.setItem(KEY, lang);
+	if (reload) {
+		window.location.reload();
+	}
 };
 
 export const remove = () => {
-  Cookies.remove(KEY);
-  localStorage.removeItem(KEY);
+	Cookies.remove(KEY);
+	localStorage.removeItem(KEY);
 };
 
 interface ILocale {
-  messages: Record<string, string>;
+	messages: Record<string, string>;
 }
 
 const messages = (lang: string): ILocale => {
-  switch (lang) {
-    case "en-US":
-      return {
-        messages: { ...enUS, ...languages },
-      };
-    case "zh-Hant":
-      return {
-        messages: { ...zhHant, ...languages },
-      };
-    default:
-      return {
-        messages: { ...zhHans, ...languages },
-      };
-  }
+	switch (lang) {
+		case "en-US":
+			return {
+				messages: { ...enUS, ...languages },
+			};
+		case "zh-Hant":
+			return {
+				messages: { ...zhHant, ...languages },
+			};
+		default:
+			return {
+				messages: { ...zhHans, ...languages },
+			};
+	}
 };
 
 export default messages;

+ 50 - 1
dashboard-fluent/src/locales/zh-Hans/index.ts

@@ -1,3 +1,52 @@
-const items = {};
+import forms from "./forms";
+import buttons from "./buttons";
+import tables from "./tables";
+import nut from "./nut";
+import channel from "./channel";
+import dict from "./dict";
+import term from "./term";
+import group from "./group";
+import article from "./article";
+import utilities from "./utilities";
+
+const items = {
+	"flashes.success": "操作成功",
+	"columns.library.title": "藏经阁",
+	"columns.library.community.title": "社区",
+	"columns.library.palicanon.title": "圣典",
+	"columns.library.course.title": "课程",
+	"columns.library.term.title": "术语百科",
+	"columns.library.dict.title": "字典",
+	"columns.library.anthology.title": "文集",
+	"columns.library.help.title": "帮助",
+	"columns.library.more.title": "更多",
+	"columns.library.calendar.title": "佛历",
+	"columns.library.convertor.title": "巴利字符转换器",
+	"columns.library.palihandbook.title": "语法手册",
+	"columns.library.statistics.title": "单词统计",
+	"columns.studio.title": "译经楼",
+	"columns.studio.palicanon.title": "圣典",
+	"columns.studio.recent.title": "最近编辑",
+	"columns.studio.channel.title": "版本风格",
+	"columns.studio.group.title": "群组",
+	"columns.studio.userdict.title": "用户字典",
+	"columns.studio.term.title": "术语",
+	"columns.studio.article.title": "文章",
+	"columns.studio.anthology.title": "文集",
+	"columns.studio.analysis.title": "分析",
+	"columns.studio.collaboration.title": "协作",
+	"columns.studio.basic.title": "常用",
+	"columns.studio.advance.title": "高级",
+	...buttons,
+	...forms,
+	...tables,
+	...nut,
+	...channel,
+	...dict,
+	...term,
+	...group,
+	...article,
+	...utilities,
+};
 
 export default items;

+ 17 - 14
dashboard-fluent/src/pages/Home.tsx

@@ -1,20 +1,23 @@
 import { PrimaryButton } from "@fluentui/react";
+import HeadBar from "../components/library/HeadBar";
 
 const Widget = () => {
-  return (
-    <div>
-      <h1>home</h1>
-      <div>
-        <PrimaryButton
-          onClick={() => {
-            alert("aaa");
-          }}
-        >
-          Demo
-        </PrimaryButton>
-      </div>
-    </div>
-  );
+	return (
+		<div>
+			<div>
+				<HeadBar />
+			</div>
+			<div>
+				<PrimaryButton
+					onClick={() => {
+						alert("aaa");
+					}}
+				>
+					Demo
+				</PrimaryButton>
+			</div>
+		</div>
+	);
 };
 
 export default Widget;