web: Client: Added translation of About page

This commit is contained in:
Alexey Safronov 2019-09-30 12:42:04 +03:00
parent 51a39a34d1
commit b5c18d8058
3 changed files with 29 additions and 7 deletions

View File

@ -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
}
});
}

View File

@ -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 (
<BodyStyle>
<p style={{ textAlign: "center", margin: "0px" }}>
@ -153,8 +158,12 @@ const Body = () => {
);
};
const About = () => {
return <PageLayout sectionBodyContent={<Body />} />;
};
const About = ({language}) => <PageLayout sectionBodyContent={<Body language={language} />} />;
export default About;
function mapStateToProps(state) {
return {
language: state.auth.user.cultureName || state.auth.settings.culture,
};
}
export default connect(mapStateToProps)(About);

View File

@ -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"
}