From b5c18d80586ff83e0d392fd0887d0cc412a7ec9d Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Mon, 30 Sep 2019 12:42:04 +0300 Subject: [PATCH] web: Client: Added translation of About page --- .../src/components/pages/About/i18n.js | 5 ++++- .../src/components/pages/About/index.js | 21 +++++++++++++------ .../pages/About/locales/ru/translation.json | 10 +++++++++ 3 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 web/ASC.Web.Client/src/components/pages/About/locales/ru/translation.json diff --git a/web/ASC.Web.Client/src/components/pages/About/i18n.js b/web/ASC.Web.Client/src/components/pages/About/i18n.js index 9da7cbdbb3..7a10fcab73 100644 --- a/web/ASC.Web.Client/src/components/pages/About/i18n.js +++ b/web/ASC.Web.Client/src/components/pages/About/i18n.js @@ -31,6 +31,9 @@ if (process.env.NODE_ENV === "production") { const resources = { en: { translation: require("./locales/en/translation.json") + }, + ru: { + translation: require("./locales/ru/translation.json") } }; @@ -49,7 +52,7 @@ if (process.env.NODE_ENV === "production") { }, react: { - useSuspense: true + useSuspense: false } }); } diff --git a/web/ASC.Web.Client/src/components/pages/About/index.js b/web/ASC.Web.Client/src/components/pages/About/index.js index b20783fffc..eced110b65 100644 --- a/web/ASC.Web.Client/src/components/pages/About/index.js +++ b/web/ASC.Web.Client/src/components/pages/About/index.js @@ -1,4 +1,5 @@ -import React from "react"; +import React, { useEffect } from "react"; +import { connect } from "react-redux"; import { PageLayout, Text, Link } from "asc-web-components"; import { useTranslation } from "react-i18next"; import i18n from "./i18n"; @@ -53,9 +54,13 @@ const VersionStyle = styled.div` padding: 8px 0px 20px 0px; `; -const Body = () => { +const Body = ({language}) => { const { t } = useTranslation("translation", { i18n }); + useEffect(() => { + i18n.changeLanguage(language); + }, [language]); + return (

@@ -153,8 +158,12 @@ const Body = () => { ); }; -const About = () => { - return } />; -}; +const About = ({language}) => } />; -export default About; +function mapStateToProps(state) { + return { + language: state.auth.user.cultureName || state.auth.settings.culture, + }; +} + +export default connect(mapStateToProps)(About); diff --git a/web/ASC.Web.Client/src/components/pages/About/locales/ru/translation.json b/web/ASC.Web.Client/src/components/pages/About/locales/ru/translation.json new file mode 100644 index 0000000000..e3f3e419b3 --- /dev/null +++ b/web/ASC.Web.Client/src/components/pages/About/locales/ru/translation.json @@ -0,0 +1,10 @@ +{ + "AboutCompanyTitle": "О программе", + "AboutCompanyVersion": "Версия", + "AboutCompanyLicensor": "АВТОРСКИЕ ПРАВА", + "AboutCompanyAddressTitle": "адрес", + "AboutCompanyEmailTitle": "email", + "AboutCompanyTelTitle": "тел.", + "LicensedUnder": "Это программное обеспечение лицензируется под", "_comment": "{0}GNU GPL v.3{1}", + "SourceCode": "Исходный код программы доступен по cсылке", "_comment": "{0}GNU GPL v.3{1}","_comment":"SYNTAX ERROR" +} \ No newline at end of file