Fix translation descriptions

This commit is contained in:
Krzysztof Bialoglowicz 2019-08-30 16:15:32 +02:00
parent a940e45a4d
commit 834b60dbe2
6 changed files with 25 additions and 29 deletions

View file

@ -3,12 +3,13 @@ import CardContent from "@material-ui/core/CardContent";
import Typography from "@material-ui/core/Typography"; import Typography from "@material-ui/core/Typography";
import makeStyles from "@material-ui/styles/makeStyles"; import makeStyles from "@material-ui/styles/makeStyles";
import React from "react"; import React from "react";
import { useIntl } from "react-intl"; import { FormattedMessage, useIntl } from "react-intl";
import CardTitle from "@saleor/components/CardTitle"; import CardTitle from "@saleor/components/CardTitle";
import ControlledSwitch from "@saleor/components/ControlledSwitch"; import ControlledSwitch from "@saleor/components/ControlledSwitch";
import FormSpacer from "@saleor/components/FormSpacer"; import FormSpacer from "@saleor/components/FormSpacer";
import Hr from "@saleor/components/Hr"; import Hr from "@saleor/components/Hr";
import { commonMessages } from "@saleor/intl";
import { FormData } from "../PluginsDetailsPage"; import { FormData } from "../PluginsDetailsPage";
interface PluginInfoProps { interface PluginInfoProps {
@ -41,7 +42,7 @@ const PluginInfo: React.StatelessComponent<PluginInfoProps> = ({
<CardTitle <CardTitle
title={intl.formatMessage({ title={intl.formatMessage({
defaultMessage: "Plugin Information and Status", defaultMessage: "Plugin Information and Status",
description: "plugin title" description: "section header"
})} })}
/> />
<CardContent> <CardContent>
@ -55,10 +56,7 @@ const PluginInfo: React.StatelessComponent<PluginInfoProps> = ({
{description && ( {description && (
<> <>
<Typography className={classes.title} variant="h6"> <Typography className={classes.title} variant="h6">
{intl.formatMessage({ <FormattedMessage {...commonMessages.description} />
defaultMessage: "Plugin Description",
description: "plugin description"
})}
</Typography> </Typography>
<Typography>{description}</Typography> <Typography>{description}</Typography>
</> </>
@ -74,8 +72,7 @@ const PluginInfo: React.StatelessComponent<PluginInfoProps> = ({
<ControlledSwitch <ControlledSwitch
checked={data.active} checked={data.active}
label={intl.formatMessage({ label={intl.formatMessage({
defaultMessage: "Set plugin as Active", defaultMessage: "Set plugin as Active"
description: "plugin active label"
})} })}
name={"active" as keyof FormData} name={"active" as keyof FormData}
onChange={onChange} onChange={onChange}

View file

@ -46,7 +46,7 @@ const PluginSettings: React.StatelessComponent<PluginSettingsProps> = ({
<CardTitle <CardTitle
title={intl.formatMessage({ title={intl.formatMessage({
defaultMessage: "Plugin Settings", defaultMessage: "Plugin Settings",
description: "plugin section title" description: "section header"
})} })}
/> />
<CardContent> <CardContent>

View file

@ -73,24 +73,28 @@ const PluginsDetailsPage: React.StatelessComponent<PluginsDetailsPageProps> = ({
{intl.formatMessage(sectionNames.plugins)} {intl.formatMessage(sectionNames.plugins)}
</AppHeader> </AppHeader>
<PageHeader <PageHeader
title={`${maybe(() => plugin.name, "")} ${intl.formatMessage({ title={intl.formatMessage(
defaultMessage: "Details", {
description: "plugin page title" defaultMessage: "{pluginName} Details",
})}`} description: "header"
},
{
pluginName: maybe(() => plugin.name, "...")
}
)}
/> />
<Grid variant="inverted"> <Grid variant="inverted">
<div> <div>
<Typography variant="h6"> <Typography variant="h6">
{intl.formatMessage({ {intl.formatMessage({
defaultMessage: "Plugin Information and Status", defaultMessage: "Plugin Information and Status",
description: "plugin section title" description: "section header"
})} })}
</Typography> </Typography>
<Typography> <Typography>
{intl.formatMessage({ {intl.formatMessage({
defaultMessage: defaultMessage:
"These are general information about your store. They define what is the URL of your store and what is shown in brow sers taskbar.", "These are general information about your store. They define what is the URL of your store and what is shown in brow sers taskbar."
description: "plugin section description"
})} })}
</Typography> </Typography>
</div> </div>
@ -106,14 +110,13 @@ const PluginsDetailsPage: React.StatelessComponent<PluginsDetailsPageProps> = ({
<Typography variant="h6"> <Typography variant="h6">
{intl.formatMessage({ {intl.formatMessage({
defaultMessage: "Plugin Settings", defaultMessage: "Plugin Settings",
description: "plugin section title" description: "section header"
})} })}
</Typography> </Typography>
<Typography> <Typography>
{intl.formatMessage({ {intl.formatMessage({
defaultMessage: defaultMessage:
"This adress will be used to generate invoices and calculate shipping rates. Email adress you provide here will be used as a contact adress for your customers.", "This adress will be used to generate invoices and calculate shipping rates. Email adress you provide here will be used as a contact adress for your customers."
description: "plugin section description"
})} })}
</Typography> </Typography>
</div> </div>

View file

@ -73,19 +73,19 @@ const PluginList = withStyles(styles, { name: "PluginList" })(
<TableCell className={classes.colName} padding="dense"> <TableCell className={classes.colName} padding="dense">
{intl.formatMessage({ {intl.formatMessage({
defaultMessage: "Name", defaultMessage: "Name",
description: "plugin list table header" description: "plugin name"
})} })}
</TableCell> </TableCell>
<TableCell className={classes.colActive} padding="dense"> <TableCell className={classes.colActive} padding="dense">
{intl.formatMessage({ {intl.formatMessage({
defaultMessage: "Active", defaultMessage: "Active",
description: "plugin list table header" description: "plugin status"
})} })}
</TableCell> </TableCell>
<TableCell className={classes.colAction} padding="dense"> <TableCell className={classes.colAction} padding="dense">
{intl.formatMessage({ {intl.formatMessage({
defaultMessage: "Action", defaultMessage: "Action",
description: "plugin list table header" description: "user action bar"
})} })}
</TableCell> </TableCell>
</TableHead> </TableHead>
@ -143,8 +143,7 @@ const PluginList = withStyles(styles, { name: "PluginList" })(
<TableRow> <TableRow>
<TableCell colSpan={numberOfColumns}> <TableCell colSpan={numberOfColumns}>
{intl.formatMessage({ {intl.formatMessage({
defaultMessage: "No plugins found", defaultMessage: "No plugins found"
description: "plugin no found"
})} })}
</TableCell> </TableCell>
</TableRow> </TableRow>

View file

@ -29,10 +29,7 @@ const PluginsListPage: React.StatelessComponent<PluginsListPageProps> = ({
return ( return (
<Container> <Container>
<AppHeader onBack={onBack}> <AppHeader onBack={onBack}>
{intl.formatMessage({ {intl.formatMessage(sectionNames.configuration)}
defaultMessage: "Configuration",
description: "plugin back button"
})}
</AppHeader> </AppHeader>
<PageHeader title={intl.formatMessage(sectionNames.plugins)} /> <PageHeader title={intl.formatMessage(sectionNames.plugins)} />
<PluginsList <PluginsList

View file

@ -2,7 +2,7 @@ import { WindowTitle } from "@saleor/components/WindowTitle";
import useNavigator from "@saleor/hooks/useNavigator"; import useNavigator from "@saleor/hooks/useNavigator";
import useNotifier from "@saleor/hooks/useNotifier"; import useNotifier from "@saleor/hooks/useNotifier";
import React from "react"; import React from "react";
import { useIntl } from "react-intl"; import { FormattedMessage, useIntl } from "react-intl";
import { getMutationState, maybe } from "../../misc"; import { getMutationState, maybe } from "../../misc";
import PluginsDetailsPage from "../components/PluginsDetailsPage"; import PluginsDetailsPage from "../components/PluginsDetailsPage";