Refactoring and added Trans from "react-i18next"

This commit is contained in:
TatianaLopaeva 2020-09-28 16:03:43 +03:00
parent 8139997ada
commit a09953ff73
7 changed files with 89 additions and 64 deletions

View File

@ -119,10 +119,12 @@ PaymentsEnterprise.propTypes = {
function mapStateToProps({ auth, payments }) {
const { isLoaded } = auth;
const { organizationName } = auth.settings;
const { licenseUpload } = payments;
return {
isLoaded,
licenseUpload,
organizationName,
};
}
export default connect(mapStateToProps, {

View File

@ -1,29 +1,29 @@
{
"contactEmail": "For any purchase questions, contact us at ",
"contactUrl": "For for solving technical issues, use",
"PaymentsTitle": "Payments",
"subscriptionRenewedLicense": "Renew subscription to get:",
"ContactEmail": "For any purchase questions, contact us at ",
"ContactUrl": "For for solving technical issues, use",
"advantageEditor": "ONLYOFFICE editors with pro features",
"advantagePrivateRooom": "Private Rooom for encrypted collaboretion",
"advantageWebEditors": "Mobile web editors",
"advantageUpdates": "Regular functionality and security updates during 1 year",
"advantageProfessionalTechSupport": "1 year of professional tech support service",
"SubscriptionRenewedLicense": "Renew subscription to get:",
"headerLicense": " You are using ONLYOFFICE Enterprise Edition",
"headerExpiredTrialLicense": "Free trial period has expired",
"AdvantageEditor": "{{organizationName}} editors with pro features",
"AdvantagePrivateRooom": "Private Rooom for encrypted collaboretion",
"AdvantageWebEditors": "Mobile web editors",
"AdvantageUpdates": "Regular functionality and security updates during 1 year",
"AdvantageProfessionalTechSupport": "1 year of professional tech support service",
"buttonBuyLicense": "Buy now",
"buttonUploadLicense": "Upload license",
"HeaderLicense": "You are using {{organizationName}} Enterprise Edition",
"HeaderExpiredTrialLicense": "Free trial period has expired",
"paymentsTitle": "Payments",
"AccessSubscription": "Your subscription for support and updates expires on",
"ExpiryPaidLicense": "Support is no longer available for your license since",
"ExpiryTrialLicense": "Thank you for having checked out {{organizationName}}!",
"RenewalLicense": "If you have already purchased the renewal, upload the license file.",
"errorLicense": "Licence is not valid",
"errorLoadingLicense": "Make sure you choose the right file",
"successLoadingLicense": "License activated successfully",
"ButtonBuyLicense": "Buy now",
"ButtonUploadLicense": "Upload license",
"accessSubscription": "Your subscription for support and updates expires on",
"expiryPaidLicense": "Support is no longer available for your license since",
"expiryTrialLicense": "Thank you for having checked out ONLYOFFICE!",
"renewalLicense": "If you have already purchased the renewal, upload the license file."
"ErrorLicense": "Licence is not valid",
"ErrorLoadingLicense": "Make sure you choose the right file",
"SuccessLoadingLicense": "License activated successfully"
}

View File

@ -1,29 +1,29 @@
{
"contactEmail": "По вопросам покупки свяжитесь с нами по адресу",
"contactUrl": "Для решения технических проблем используйте",
"PaymentsTitle": "Платежи",
"subscriptionRenewedLicense": "Обновите подписку, чтобы получить:",
"ContactEmail": "По вопросам покупки свяжитесь с нами по адресу",
"ContactUrl": "Для решения технических проблем используйте",
"advantageEditor": "Редакторы ONLYOFFICE с профессиональными возможностями",
"advantagePrivateRooom": "Приватная комната для зашифрованной совместной работы",
"advantageWebEditors": "Мобильные веб-редакторы",
"advantageUpdates": "Регулярные обновления функциональных возможностей и безопасности в течение 1 года",
"advantageProfessionalTechSupport": "1 год услуг профессиональной технической поддержки",
"SubscriptionRenewedLicense": "Обновите подписку, чтобы получить:",
"headerLicense": "Вы используете ONLYOFFICE Enterprise Edition",
"headerExpiredTrialLicense": "Бесплатный пробный период истек",
"AdvantageEditor": "Редакторы {{organizationName}} с профессиональными возможностями",
"AdvantagePrivateRooom": "Приватная комната для зашифрованной совместной работы",
"AdvantageWebEditors": "Мобильные веб-редакторы",
"AdvantageUpdates": "Регулярные обновления функциональных возможностей и безопасности в течение 1 года",
"AdvantageProfessionalTechSupport": "1 год услуг профессиональной технической поддержки",
"buttonBuyLicense": "Купить сейчас",
"buttonUploadLicense": "Загрузить лицензию",
"HeaderLicense": "Вы используете {{organizationName}} Enterprise Edition",
"HeaderExpiredTrialLicense": "Бесплатный пробный период истек",
"paymentsTitle": "Платежи",
"AccessSubscription": "Техническая поддержка и обновления недоступны для вашей лицензии с",
"ExpiryPaidLicense": "Техническая поддержка больше не доступна для вашей лицензии с",
"ExpiryTrialLicense": "Благодарим Вас за то, что опробовали {{organizationName}}!",
"RenewalLicense": " Если вы уже купили обновление, загрузите файл лицензии.",
"errorLicense": "Лицензия не действительна",
"errorLoadingLicense": "Проверьте загружаемый файл",
"successLoadingLicense": "Лицензия успешно активирована",
"ButtonBuyLicense": "Купить сейчас",
"ButtonUploadLicense": "Загрузить лицензию",
"accessSubscription": "Техническая поддержка и обновления недоступны для вашей лицензии с",
"expiryPaidLicense": "Техническая поддержка больше не доступна для вашей лицензии с",
"expiryTrialLicense": "Благодарим Вас за то, что опробовали ONLYOFFICE!",
"renewalLicense": " Если вы уже купили обновление, загрузите файл лицензии."
"ErrorLicense": "Лицензия не действительна",
"ErrorLoadingLicense": "Проверьте загружаемый файл",
"SuccessLoadingLicense": "Лицензия успешно активирована"
}

View File

@ -1,10 +1,11 @@
import React, { useEffect } from "react";
import { connect } from "react-redux";
import styled from "styled-components";
import { utils } from "asc-web-common";
import { Text, utils as Utils, Box } from "asc-web-components";
import { createI18N } from "../../../../helpers/i18n";
import { useTranslation } from "react-i18next";
import { useTranslation, Trans } from "react-i18next";
const { changeLanguage } = utils;
const { tablet } = Utils.device;
@ -41,7 +42,7 @@ const StyledBodyAdvantages = styled.div`
}
`;
const AdvantagesContainer = () => {
const AdvantagesContainer = ({ organizationName }) => {
useEffect(() => {
changeLanguage(i18n);
}, []);
@ -50,7 +51,7 @@ const AdvantagesContainer = () => {
return (
<StyledBodyAdvantages>
<Text className="header-advantages" fontSize="22px" isBold={true}>
{t("subscriptionRenewedLicense")}
{t("SubscriptionRenewedLicense")}
</Text>
<Box className="row-advantages">
@ -61,7 +62,11 @@ const AdvantagesContainer = () => {
alt="Icon_cubes"
/>
<Box className="wrapper" marginProp="0 0 0 8px">
<Text isBold={true}>{t("advantageEditor")}</Text>
<Text isBold={true}>
<Trans i18nKey="AdvantageEditor" i18n={i18n}>
{{ organizationName }}
</Trans>
</Text>
</Box>
</Box>
@ -73,7 +78,7 @@ const AdvantagesContainer = () => {
alt="Icon_lock"
/>
<Box className="wrapper" marginProp="0 0 0 8px">
<Text isBold={true}>{t("advantagePrivateRooom")}</Text>
<Text isBold={true}>{t("AdvantagePrivateRooom")}</Text>
</Box>
</Box>
@ -85,7 +90,7 @@ const AdvantagesContainer = () => {
alt="Icon_smartphone"
/>
<Box className="wrapper" marginProp="0 0 0 8px">
<Text isBold={true}>{t("advantageWebEditors")}</Text>
<Text isBold={true}>{t("AdvantageWebEditors")}</Text>
</Box>
</Box>
@ -97,7 +102,7 @@ const AdvantagesContainer = () => {
alt="Icon_update"
/>
<Box className="wrapper" marginProp="0 0 0 8px">
<Text isBold={true}>{t("advantageUpdates")}</Text>
<Text isBold={true}>{t("AdvantageUpdates")}</Text>
</Box>
</Box>
@ -109,11 +114,17 @@ const AdvantagesContainer = () => {
alt="Icon_help"
/>
<Box className="wrapper" marginProp="0 0 0 8px">
<Text isBold={true}>{t("advantageProfessionalTechSupport")}</Text>
<Text isBold={true}>{t("AdvantageProfessionalTechSupport")}</Text>
</Box>
</Box>
</StyledBodyAdvantages>
);
};
export default AdvantagesContainer;
function mapStateToProps({ auth }) {
const { organizationName } = auth.settings;
return {
organizationName,
};
}
export default connect(mapStateToProps)(AdvantagesContainer);

View File

@ -56,7 +56,7 @@ const ButtonContainer = ({ buyUrl, onClickBuy, onClickUpload }) => {
return (
<StyledButtonContainer>
<Button
label={t("buttonBuyLicense")}
label={t("ButtonBuyLicense")}
value={`${buyUrl}`}
size="large"
primary={true}
@ -72,7 +72,7 @@ const ButtonContainer = ({ buyUrl, onClickBuy, onClickUpload }) => {
<Button
type="submit"
label={t("buttonUploadLicense")}
label={t("ButtonUploadLicense")}
size="large"
primary={true}
onClick={onClickSubmit}

View File

@ -30,14 +30,14 @@ const ContactContainer = ({ salesEmail, helpUrl }) => {
return (
<StyledContactContainer>
<Text>
{t("contactEmail")}{" "}
{t("ContactEmail")}{" "}
<Link href={`mailto:${salesEmail}`} color="#316daa">
{salesEmail}
</Link>
</Text>
<Text>
{t("contactUrl")}{" "}
{t("ContactUrl")}{" "}
<Link target="_blank" href={`${helpUrl}`} color="#316daa">
{helpUrl}
</Link>

View File

@ -6,7 +6,7 @@ import { withRouter } from "react-router";
import { Text } from "asc-web-components";
import { utils } from "asc-web-common";
import { useTranslation } from "react-i18next";
import { useTranslation, Trans } from "react-i18next";
import { createI18N } from "../../../../helpers/i18n";
import moment from "moment";
const { changeLanguage } = utils;
@ -38,7 +38,12 @@ const StyledHeader = styled.div`
}
`;
const HeaderContainer = ({ culture, trialMode, expiresDate }) => {
const HeaderContainer = ({
culture,
trialMode,
expiresDate,
organizationName,
}) => {
useEffect(() => {
changeLanguage(i18n);
const moment = require("moment");
@ -56,35 +61,41 @@ const HeaderContainer = ({ culture, trialMode, expiresDate }) => {
return licenseDate.isAfter(now, "day") ? (
<StyledHeader>
<Text className="payments-header" fontSize="27px" isBold={true}>
{t("headerLicense")}
<Trans i18nKey="HeaderLicense" i18n={i18n}>
{{ organizationName }}
</Trans>
</Text>
<Text className="payments-header-additional_support">
{t("accessSubscription")} {licenseDateString}
{t("AccessSubscription")} {licenseDateString}
{"."}
</Text>
</StyledHeader>
) : !trialMode ? (
<StyledHeader>
<Text className="payments-header" fontSize="27px" isBold={true}>
{t("headerLicense")}
<Trans i18nKey="HeaderLicense" i18n={i18n}>
{{ organizationName }}
</Trans>
</Text>
<Text
className="payments-header-additional_support"
color="#C96C27"
fontWeight="600"
>
{t("expiryPaidLicense")} {licenseDateString}
{t("ExpiryPaidLicense")} {licenseDateString}
{". "}
{t("renewalLicense")}
{t("RenewalLicense")}
</Text>
</StyledHeader>
) : (
<StyledHeader>
<Text className="payments-header" fontSize="27px" isBold={true}>
{t("headerExpiredTrialLicense")}
{t("HeaderExpiredTrialLicense")}
</Text>
<Text className="payments-header-additional_support">
{t("expiryTrialLicense")}
<Trans i18nKey="ExpiryTrialLicense" i18n={i18n}>
{{ organizationName }}
</Trans>
</Text>
</StyledHeader>
);
@ -96,12 +107,13 @@ HeaderContainer.propTypes = {
trialMode: PropTypes.bool,
};
function mapStateToProps({ auth, payments }) {
const { culture } = auth.settings;
const { culture, organizationName } = auth.settings;
const { expiresDate, trialMode } = payments.currentLicense;
return {
culture,
expiresDate,
trialMode,
organizationName,
};
}
export default connect(mapStateToProps)(withRouter(HeaderContainer));