Remove all *.intl.json files. Move strings to the corresponding views. Implement custom command to build i18n/en.json file

This commit is contained in:
ErickSkrauch
2020-06-04 19:41:27 +03:00
parent 57cf6b3776
commit bf6a76d006
107 changed files with 1122 additions and 972 deletions

View File

@@ -1,6 +0,0 @@
{
"title": "Page not found",
"nothingHere": "This is not a place that you are looking for",
"returnToTheHomePage": "Try to go back to the {link}",
"homePage": "main page"
}

View File

@@ -5,12 +5,13 @@ import { Helmet } from 'react-helmet-async';
import { FooterMenu } from 'app/components/footerMenu';
import styles from './404.scss';
import messages from './PageNotFound.intl.json';
import profileStyles from '../profile/profile.scss';
const PageNotFound: ComponentType = () => (
<div className={styles.page}>
<Message {...messages.title}>{(pageTitle) => <Helmet title={pageTitle as string} />}</Message>
<Message key="title" defaultMessage="Page not found">
{(pageTitle) => <Helmet title={pageTitle as string} />}
</Message>
<div className={styles.loading}>
<div className={styles.cube} />
@@ -29,15 +30,16 @@ const PageNotFound: ComponentType = () => (
</div>
</div>
<p className={styles.text}>
<Message {...messages.nothingHere} />
<Message key="nothingHere" defaultMessage="This is not a place that you are looking for" />
</p>
<p className={styles.subText}>
<Message
{...messages.returnToTheHomePage}
key="returnToTheHomePage"
defaultMessage="Try to go back to the {link}"
values={{
link: (
<Link to="/">
<Message {...messages.homePage} />
<Message key="homePage" defaultMessage="main page" />
</Link>
),
}}

View File

@@ -1,7 +0,0 @@
{
"title": "Authorization successful",
"applicationAuth": "Application authorization",
"authorizationSuccessful": "Authorization has been successfully completed.",
"authorizationForAppSuccessful": "Authorization for {appName} has been successfully completed.",
"youCanCloseThisPage": "You can close this window and return to your application."
}

View File

@@ -5,9 +5,8 @@ import { Helmet } from 'react-helmet-async';
import * as loader from 'app/services/loader';
import { Query } from 'app/services/request';
import rootMessages from '../root/RootPage.intl.json';
import siteName from 'app/pages/root/siteName.intl';
import styles from './success-oauth.scss';
import messages from './SuccessOauthPage.intl.json';
export default class SuccessOauthPage extends React.Component<{
location: {
@@ -41,15 +40,17 @@ export default class SuccessOauthPage extends React.Component<{
return (
<div className={styles.page}>
<Message {...messages.title}>{(pageTitle) => <Helmet title={pageTitle as string} />}</Message>
<Message key="title" defaultMessage="Authorization successful">
{(pageTitle) => <Helmet title={pageTitle as string} />}
</Message>
<div className={styles.wrapper}>
<Link to="/" className={styles.logo}>
<Message {...rootMessages.siteName} />
<Message {...siteName} />
</Link>
<div className={styles.title}>
<Message {...messages.applicationAuth} />
<Message key="applicationAuth" defaultMessage="Application authorization" />
</div>
<div className={styles.checkmark} />
@@ -57,16 +58,23 @@ export default class SuccessOauthPage extends React.Component<{
<div className={styles.description}>
{appName ? (
<Message
{...messages.authorizationForAppSuccessful}
key="authorizationForAppSuccessful"
defaultMessage="Authorization for {appName} has been successfully completed."
values={{
appName: <b>{appName}</b>,
}}
/>
) : (
<Message {...messages.authorizationSuccessful} />
<Message
key="authorizationSuccessful"
defaultMessage="Authorization has been successfully completed."
/>
)}
&nbsp;
<Message {...messages.youCanCloseThisPage} />
<Message
key="youCanCloseThisPage"
defaultMessage="You can close this window and return to your application."
/>
</div>
</div>
</div>

View File

@@ -1,3 +0,0 @@
{
"siteName": "Ely.by"
}

View File

@@ -19,7 +19,7 @@ import { RootState } from 'app/reducers';
import { ComponentLoader } from 'app/components/ui/loader';
import styles from './root.scss';
import messages from './RootPage.intl.json';
import siteName from './siteName.intl';
const ProfilePage = React.lazy(() =>
import(/* webpackChunkName: "page-profile-all" */ 'app/pages/profile/ProfilePage'),
@@ -76,7 +76,7 @@ class RootPage extends React.PureComponent<{
<div className={styles.header} data-testid="toolbar">
<div className={styles.headerContent}>
<Link to="/" className={styles.logo} onClick={onLogoClick} data-testid="home-page">
<Message {...messages.siteName} />
<Message {...siteName} />
</Link>
<div className={styles.userbar}>
<Userbar account={account} guestAction={isRegisterPage ? 'login' : 'register'} />

View File

@@ -0,0 +1,7 @@
import { defineMessages } from 'react-intl';
const { siteName } = defineMessages({
siteName: 'Ely.by',
});
export default siteName;

View File

@@ -1,24 +0,0 @@
{
"title": "Site rules",
"mainProvisions": "Main provisions",
"mainProvision1": "{name} service was created for the organization of safety access to Ely.by's users accounts, his partners and any side project that wish to use one of the our's services.",
"mainProvision2": "We (here and in the next points) — Ely.by project developers team that make creating qualitative services for Minecraft community.",
"mainProvision3": "Ely.by is side project, that has nothing to do with Mojang and Microsoft companies. We don't provide support to Minecraft premium accounts, and we have nothing to do with servers that use or don't use our services.",
"mainProvision4": "The registration of the users account at server is free. Account creation Ely.by is only possible at that page {link}.",
"emailAndNickname": "Email and nickname",
"emailAndNickname1": "Account registration with usage of temporary mail services is prohibited. We speak about services that gives random Email in any quantity.",
"emailAndNickname2": "We try to counteract it, but if you succesed in registration of account with usage of temporary mail services, there wont be any technical support for it and later, during of update of ours filters, account will be blocked with your nickname.",
"emailAndNickname3": "There are no any moral restrictions for users nickname that will be used in game.",
"emailAndNickname4": "Nicknames, belonging to famous persons, can be released at their favor for requirement and proves of that persons.",
"emailAndNickname5": "Minecraft premium account owner has right to require a control restore of his nickname an if it happened you have to change your nickname in 3 days or it will be done automatically.",
"emailAndNickname6": "If there is no any activity at your account during last 3 month, your nickname can be occupied by any user.",
"emailAndNickname7": "We aren't responsible for losing your game progress at servers if it was result of nickname changing, including changes on our demand.",
"elyAccountsAsService": "{name} as service",
"elyAccountsAsServiceDesc1": "{name} has free providing to any project, that interested in it usage for Minecraft.",
"elyAccountsAsServiceDesc2": "Despite we do our utmost to provide fast and stable work of service, we are not saved from DDOS-attack, hosters links work interruptions, electricity disorders or any cases, that impossible to be predicted. For avoiding possible incomprehension, we obliged to discuss next agreements, that will work in case of situations mentioned before:",
"elyAccountsAsService1": "We don't have any guarantee about fault free work time of this service.",
"elyAccountsAsService2": "We are not responsible for delays and lost income as the result of ours service inoperability."
}

View File

@@ -3,31 +3,36 @@ import { Link } from 'react-router-dom';
import { FormattedMessage as Message } from 'react-intl';
import { Helmet } from 'react-helmet-async';
import { FooterMenu } from 'app/components/footerMenu';
import appInfo from 'app/components/auth/appInfo/AppInfo.intl.json';
import appName from 'app/components/auth/appInfo/appName.intl';
import styles from './rules.scss';
import messages from './RulesPage.intl.json';
const projectName = <Message {...appInfo.appName} />;
const projectName = <Message {...appName} />;
import clsx from 'clsx';
const rules = [
{
title: <Message {...messages.mainProvisions} />,
title: <Message key="mainProvisions" defaultMessage="Main provisions" />,
items: [
<Message
key="0"
{...messages.mainProvision1}
key="mainProvision1"
defaultMessage="{name} service was created for the organization of safety access to Ely.by's users accounts, his partners and any side project that wish to use one of the our's services."
values={{
name: <b>{projectName}</b>,
}}
/>,
<Message key="1" {...messages.mainProvision2} />,
<Message key="2" {...messages.mainProvision3} />,
<Message
key="3"
{...messages.mainProvision4}
key="mainProvision2"
defaultMessage="We (here and in the next points) — Ely.by project developers team that make creating qualitative services for Minecraft community."
/>,
<Message
key="mainProvision3"
defaultMessage="Ely.by is side project, that has nothing to do with Mojang and Microsoft companies. We don't provide support to Minecraft premium accounts, and we have nothing to do with servers that use or don't use our services."
/>,
<Message
key="mainProvision4"
defaultMessage="The registration of the users account at server is free. Account creation Ely.by is only possible at that page {link}."
values={{
link: <Link to="/register">https://account.ely.by/register</Link>,
}}
@@ -35,21 +40,43 @@ const rules = [
],
},
{
title: <Message {...messages.emailAndNickname} />,
title: <Message key="emailAndNickname" defaultMessage="Email and nickname" />,
items: [
<Message key="0" {...messages.emailAndNickname1} />,
<Message key="1" {...messages.emailAndNickname2} />,
<Message key="2" {...messages.emailAndNickname3} />,
<Message key="3" {...messages.emailAndNickname4} />,
<Message key="4" {...messages.emailAndNickname5} />,
<Message key="5" {...messages.emailAndNickname6} />,
<Message key="6" {...messages.emailAndNickname7} />,
<Message
key="emailAndNickname1"
defaultMessage="Account registration with usage of temporary mail services is prohibited. We speak about services that gives random Email in any quantity."
/>,
<Message
key="emailAndNickname2"
defaultMessage="We try to counteract it, but if you succesed in registration of account with usage of temporary mail services, there wont be any technical support for it and later, during of update of ours filters, account will be blocked with your nickname."
/>,
<Message
key="emailAndNickname3"
defaultMessage="There are no any moral restrictions for users nickname that will be used in game."
/>,
<Message
key="emailAndNickname4"
defaultMessage="Nicknames, belonging to famous persons, can be released at their favor for requirement and proves of that persons."
/>,
<Message
key="emailAndNickname5"
defaultMessage="Minecraft premium account owner has right to require a control restore of his nickname an if it happened you have to change your nickname in 3 days or it will be done automatically."
/>,
<Message
key="emailAndNickname6"
defaultMessage="If there is no any activity at your account during last 3 month, your nickname can be occupied by any user."
/>,
<Message
key="emailAndNickname7"
defaultMessage="We aren't responsible for losing your game progress at servers if it was result of nickname changing, including changes on our demand."
/>,
],
},
{
title: (
<Message
{...messages.elyAccountsAsService}
key="elyAccountsAsService"
defaultMessage="{name} as service"
values={{
name: projectName,
}}
@@ -59,20 +86,30 @@ const rules = [
<div>
<p>
<Message
{...messages.elyAccountsAsServiceDesc1}
key="elyAccountsAsServiceDesc1"
defaultMessage="{name} has free providing to any project, that interested in it usage for Minecraft."
values={{
name: <b>{projectName}</b>,
}}
/>
</p>
<p>
<Message {...messages.elyAccountsAsServiceDesc2} />
<Message
key="elyAccountsAsServiceDesc2"
defaultMessage="Despite we do our utmost to provide fast and stable work of service, we are not saved from DDOS-attack, hosters links work interruptions, electricity disorders or any cases, that impossible to be predicted. For avoiding possible incomprehension, we obliged to discuss next agreements, that will work in case of situations mentioned before:"
/>
</p>
</div>
),
items: [
<Message key="0" {...messages.elyAccountsAsService1} />,
<Message key="1" {...messages.elyAccountsAsService2} />,
<Message
key="elyAccountsAsService1"
defaultMessage="We don't have any guarantee about fault free work time of this service."
/>,
<Message
key="elyAccountsAsService2"
defaultMessage="We are not responsible for delays and lost income as the result of ours service inoperability."
/>,
],
},
];
@@ -97,7 +134,9 @@ export default class RulesPage extends Component<{
return (
<div>
<Message {...messages.title}>{(pageTitle) => <Helmet title={pageTitle as string} />}</Message>
<Message key="title" defaultMessage="Site rules">
{(pageTitle) => <Helmet title={pageTitle as string} />}
</Message>
<div className={styles.rules}>
{rules.map((block, sectionIndex) => (