chore: Move formatting out of translation strings

This commit is contained in:
Tom Moor
2020-12-14 21:16:02 -08:00
parent e2e66954b5
commit 2f7fca6106
22 changed files with 69 additions and 76 deletions

View File

@@ -102,7 +102,7 @@ function Editor(props: PropsWithRef) {
deleteTable: t("Delete table"),
em: t("Italic"),
embedInvalidLink: t("Sorry, that link wont work for this embed type"),
findOrCreateDoc: t("Find or create a doc"),
findOrCreateDoc: `${t("Find or create a doc")}`,
h1: t("Big heading"),
h2: t("Medium heading"),
h3: t("Small heading"),
@@ -115,18 +115,18 @@ function Editor(props: PropsWithRef) {
link: t("Link"),
linkCopied: t("Link copied to clipboard"),
mark: t("Highlight"),
newLineEmpty: t("Type '/' to insert"),
newLineWithSlash: t("Keep typing to filter"),
newLineEmpty: `${t("Type '/' to insert")}`,
newLineWithSlash: `${t("Keep typing to filter")}`,
noResults: t("No results"),
openLink: t("Open link"),
orderedList: t("Ordered list"),
pasteLink: t("Paste a link"),
pasteLink: `${t("Paste a link")}`,
pasteLinkWithTitle: (service: string) =>
t("Paste a {{service}} link…", { service }),
placeholder: t("Placeholder"),
quote: t("Quote"),
removeLink: t("Remove link"),
searchOrPasteLink: t("Search or paste a link"),
searchOrPasteLink: `${t("Search or paste a link")}`,
strikethrough: t("Strikethrough"),
strong: t("Bold"),
subheading: t("Subheading"),

View File

@@ -200,7 +200,7 @@ class IconPicker extends React.Component<Props> {
})}
</Icons>
<Flex onClick={preventEventBubble}>
<React.Suspense fallback={<Loading>{t("Loading")}</Loading>}>
<React.Suspense fallback={<Loading>{t("Loading")}</Loading>}>
<ColorPicker
color={this.props.color}
onChange={(color) =>

View File

@@ -54,7 +54,7 @@ class InputSearch extends React.Component<Props> {
render() {
const { t } = this.props;
const { theme, placeholder = t("Search") } = this.props;
const { theme, placeholder = `${t("Search")}` } = this.props;
return (
<InputMaxWidth

View File

@@ -72,7 +72,7 @@ class Collections extends React.Component<Props> {
to="/collections"
onClick={this.props.onCreateCollection}
icon={<PlusIcon color="currentColor" />}
label={t("New collection")}
label={`${t("New collection")}`}
exact
/>
</>

View File

@@ -159,22 +159,22 @@ class CollectionMenu extends React.Component<Props> {
type: "separator",
},
{
title: t("Edit"),
title: `${t("Edit")}`,
visible: !!(collection && can.update),
onClick: this.handleEditCollectionOpen,
},
{
title: t("Permissions"),
title: `${t("Permissions")}`,
visible: !!(collection && can.update),
onClick: this.handleMembersModalOpen,
},
{
title: t("Export"),
title: `${t("Export")}`,
visible: !!(collection && can.export),
onClick: this.handleExportCollectionOpen,
},
{
title: t("Delete"),
title: `${t("Delete")}`,
visible: !!(collection && can.delete),
onClick: this.handleDeleteCollectionOpen,
},

View File

@@ -200,7 +200,7 @@ class DocumentMenu extends React.Component<Props> {
onClick: this.handleRestore,
},
{
title: t("Restore"),
title: `${t("Restore")}`,
visible: !collection && !!can.restore,
style: {
left: -170,
@@ -251,7 +251,7 @@ class DocumentMenu extends React.Component<Props> {
visible: !document.isStarred && !!can.star,
},
{
title: t("Share link"),
title: `${t("Share link")}`,
onClick: this.handleShareLink,
visible: canShareDocuments,
},
@@ -274,7 +274,7 @@ class DocumentMenu extends React.Component<Props> {
visible: !!can.createChildDocument,
},
{
title: t("Create template"),
title: `${t("Create template")}`,
onClick: this.handleOpenTemplateModal,
visible: !!can.update && !document.isTemplate,
},
@@ -299,12 +299,12 @@ class DocumentMenu extends React.Component<Props> {
visible: !!can.archive,
},
{
title: t("Delete"),
title: `${t("Delete")}`,
onClick: this.handleDelete,
visible: !!can.delete,
},
{
title: t("Move"),
title: `${t("Move")}`,
onClick: this.handleMove,
visible: !!can.move,
},

View File

@@ -78,7 +78,7 @@ class GroupMenu extends React.Component<Props> {
<DropdownMenuItems
items={[
{
title: t("Members"),
title: `${t("Members")}`,
onClick: this.props.onMembers,
visible: !!(group && can.read),
},
@@ -86,12 +86,12 @@ class GroupMenu extends React.Component<Props> {
type: "separator",
},
{
title: t("Edit"),
title: `${t("Edit")}`,
onClick: this.onEdit,
visible: !!(group && can.update),
},
{
title: t("Delete"),
title: `${t("Delete")}`,
onClick: this.onDelete,
visible: !!(group && can.delete),
},

View File

@@ -2,7 +2,7 @@
import { observable } from "mobx";
import { observer, inject } from "mobx-react";
import * as React from "react";
import { withTranslation, type TFunction } from "react-i18next";
import { Trans, withTranslation, type TFunction } from "react-i18next";
import { Redirect } from "react-router-dom";
import CollectionsStore from "stores/CollectionsStore";
@@ -43,6 +43,7 @@ class NewChildDocumentMenu extends React.Component<Props> {
const { label, document, collections, t } = this.props;
const collection = collections.get(document.collectionId);
const collectionName = collection ? collection.name : t("collection");
return (
<DropdownMenu label={label}>
@@ -50,12 +51,9 @@ class NewChildDocumentMenu extends React.Component<Props> {
items={[
{
title: (
<span>
{t("New document in")}{" "}
<strong>
{collection ? collection.name : t("collection")}
</strong>
</span>
<Trans>
New document in <strong>{{ collectionName }}</strong>
</Trans>
),
onClick: this.handleNewDocument,
},

View File

@@ -45,7 +45,7 @@ class NewTemplateMenu extends React.Component<Props> {
label={
label || (
<Button icon={<PlusIcon />} small>
{t("New template")}
{t("New template")}
</Button>
)
}

View File

@@ -99,7 +99,7 @@ class UserMenu extends React.Component<Props> {
type: "separator",
},
{
title: t("Revoke invite"),
title: `${t("Revoke invite")}`,
onClick: this.handleRevoke,
visible: user.isInvited,
},
@@ -109,7 +109,7 @@ class UserMenu extends React.Component<Props> {
visible: !user.isInvited && user.isSuspended,
},
{
title: t("Suspend account"),
title: `${t("Suspend account")}`,
onClick: this.handleSuspend,
visible: !user.isInvited && !user.isSuspended,
},

View File

@@ -144,7 +144,7 @@ class CollectionScene extends React.Component<Props> {
<Action>
<InputSearch
source="collection"
placeholder={t("Search in collection")}
placeholder={`${t("Search in collection")}`}
collectionId={match.params.id}
/>
</Action>
@@ -207,7 +207,7 @@ class CollectionScene extends React.Component<Props> {
&nbsp;&nbsp;
{collection.private && (
<Button onClick={this.onPermissions} neutral>
{t("Manage members")}
{t("Manage members")}
</Button>
)}
</Wrapper>

View File

@@ -120,7 +120,7 @@ class CollectionEdit extends React.Component<Props> {
type="submit"
disabled={this.isSaving || !this.props.collection.name}
>
{this.isSaving ? t("Saving") : t("Save")}
{this.isSaving ? `${t("Saving")}` : t("Save")}
</Button>
</form>
</Flex>

View File

@@ -92,7 +92,7 @@ class AddGroupsToCollection extends React.Component<Props> {
<Input
type="search"
placeholder={t("Search by group name")}
placeholder={`${t("Search by group name")}`}
value={this.query}
onChange={this.handleFilter}
label={t("Search groups")}

View File

@@ -86,7 +86,7 @@ class AddPeopleToCollection extends React.Component<Props> {
<Input
type="search"
placeholder={t("Search by name")}
placeholder={`${t("Search by name")}`}
value={this.query}
onChange={this.handleFilter}
label={t("Search people")}

View File

@@ -52,7 +52,7 @@ const MemberListItem = ({
<ButtonWrap>
<DropdownMenu>
<DropdownMenuItem onClick={openMembersModal}>
{t("Members")}
{t("Members")}
</DropdownMenuItem>
<hr />
<DropdownMenuItem onClick={onRemove}>

View File

@@ -148,7 +148,7 @@ class CollectionNew extends React.Component<Props> {
</HelpText>
<Button type="submit" disabled={this.isSaving || !this.name}>
{this.isSaving ? t("Creating") : t("Create")}
{this.isSaving ? `${t("Creating")}` : t("Create")}
</Button>
</form>
);

View File

@@ -203,7 +203,7 @@ class Header extends React.Component<Props> {
<Wrapper align="center" justify="flex-end">
{isSaving && !isPublishing && (
<Action>
<Status>{t("Saving")}</Status>
<Status>{t("Saving")}</Status>
</Action>
)}
&nbsp;
@@ -331,7 +331,7 @@ class Header extends React.Component<Props> {
disabled={publishingIsDisabled}
small
>
{isPublishing ? t("Publishing") : t("Publish")}
{isPublishing ? `${t("Publishing")}` : t("Publish")}
</Button>
</Tooltip>
</Action>

View File

@@ -88,7 +88,7 @@ class AddPeopleToGroup extends React.Component<Props> {
<Input
type="search"
placeholder={t("Search by name")}
placeholder={`${t("Search by name")}`}
value={this.query}
onChange={this.handleFilter}
label={t("Search people")}

View File

@@ -82,7 +82,7 @@ class GroupMembers extends React.Component<Props> {
icon={<PlusIcon />}
neutral
>
{t("Add people")}
{t("Add people")}
</Button>
</span>
</>

View File

@@ -270,7 +270,7 @@ class Search extends React.Component<Props> {
)}
<ResultsWrapper pinToTop={this.pinToTop} column auto>
<SearchField
placeholder={t("Search")}
placeholder={`${t("Search")}`}
onKeyDown={this.handleKeyDown}
onChange={this.updateLocation}
defaultValue={this.query}

View File

@@ -146,7 +146,7 @@ class Profile extends React.Component<Props> {
.
</HelpText>
<Button type="submit" disabled={isSaving || !this.isValid}>
{isSaving ? t("Saving") : t("Save")}
{isSaving ? `${t("Saving")}` : t("Save")}
</Button>
</form>