From b03778fa73ab5db549342d514dc7c5d0b9286ba7 Mon Sep 17 00:00:00 2001 From: Dmitry Shemin Date: Sat, 1 Apr 2023 14:35:25 +0700 Subject: [PATCH] feat: update RU i18n locale (#1422) * feat: Fix i18n and RU locale * fix: eslint issues * change the position of deps --------- Co-authored-by: CorrectRoadH --- web/src/App.tsx | 2 + web/src/components/AskAIDialog.tsx | 10 ++- web/src/components/CreateResourceDialog.tsx | 32 ++++--- web/src/components/EmbedMemoDialog.tsx | 10 ++- web/src/components/Header.tsx | 2 +- web/src/components/Memo.tsx | 4 +- web/src/components/ResourceSearchBar.tsx | 4 +- web/src/components/SearchBar.tsx | 4 +- .../Settings/PreferencesSection.tsx | 4 +- web/src/components/base/DatePicker.tsx | 16 ++-- web/src/locales/en.json | 45 +++++++++- web/src/locales/ru.json | 83 +++++++++++++++---- web/src/main.tsx | 1 + web/src/pages/DailyReview.tsx | 11 +-- 14 files changed, 169 insertions(+), 59 deletions(-) diff --git a/web/src/App.tsx b/web/src/App.tsx index 88e541f4..1e090b4f 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -1,3 +1,4 @@ +import dayjs from "dayjs"; import { useColorScheme } from "@mui/joy"; import { useEffect, Suspense } from "react"; import { Toaster } from "react-hot-toast"; @@ -58,6 +59,7 @@ const App = () => { useEffect(() => { document.documentElement.setAttribute("lang", locale); i18n.changeLanguage(locale); + dayjs.locale(locale); storage.set({ locale: locale, }); diff --git a/web/src/components/AskAIDialog.tsx b/web/src/components/AskAIDialog.tsx index 4da1f07c..37db9ce7 100644 --- a/web/src/components/AskAIDialog.tsx +++ b/web/src/components/AskAIDialog.tsx @@ -8,10 +8,12 @@ import { useMessageStore } from "../store/zustand/message"; import Icon from "./Icon"; import { generateDialog } from "./Dialog"; import showSettingDialog from "./SettingDialog"; +import { useTranslation } from "react-i18next"; type Props = DialogProps; const AskAIDialog: React.FC = (props: Props) => { + const { t } = useTranslation(); const { destroy, hide } = props; const fetchingState = useLoading(false); const messageStore = useMessageStore(); @@ -79,7 +81,7 @@ const AskAIDialog: React.FC = (props: Props) => {

- Ask AI + {t("ask-ai.title")}

+

{t("ask-ai.not_enabled")}

+
)}