Migrate react-i18next translate components

This commit is contained in:
Florian Scholdei
2019-10-23 15:47:08 +02:00
parent e4668ae304
commit db075974db
121 changed files with 498 additions and 740 deletions

View File

@@ -1,14 +1,11 @@
import React from "react";
import { WithTranslation, withTranslation } from "react-i18next";
import { Repository, Branch } from "@scm-manager/ui-types";
import { ButtonAddons, Button } from "@scm-manager/ui-components";
import { translate } from "react-i18next";
type Props = {
type Props = WithTranslation & {
repository: Repository;
branch: Branch;
// context props
t: (p: string) => string;
};
class BranchButtonGroup extends React.Component<Props> {
@@ -29,4 +26,4 @@ class BranchButtonGroup extends React.Component<Props> {
}
}
export default translate("repos")(BranchButtonGroup);
export default withTranslation("repos")(BranchButtonGroup);

View File

@@ -1,14 +1,12 @@
import React from "react";
import { Repository, Branch } from "@scm-manager/ui-types";
import { translate } from "react-i18next";
import { WithTranslation, withTranslation } from "react-i18next";
import BranchButtonGroup from "./BranchButtonGroup";
import DefaultBranchTag from "./DefaultBranchTag";
type Props = {
type Props = WithTranslation & {
repository: Repository;
branch: Branch;
// context props
t: (p: string) => string;
};
class BranchDetail extends React.Component<Props> {
@@ -28,4 +26,4 @@ class BranchDetail extends React.Component<Props> {
}
}
export default translate("repos")(BranchDetail);
export default withTranslation("repos")(BranchDetail);

View File

@@ -1,17 +1,16 @@
import React from "react";
import { translate } from "react-i18next";
import { WithTranslation, withTranslation } from "react-i18next";
import { Repository, Branch, BranchRequest } from "@scm-manager/ui-types";
import { Select, InputField, SubmitButton, validation as validator } from "@scm-manager/ui-components";
import { orderBranches } from "../util/orderBranches";
type Props = {
type Props = WithTranslation & {
submitForm: (p: BranchRequest) => void;
repository: Repository;
branches: Branch[];
loading?: boolean;
transmittedName?: string;
disabled?: boolean;
t: (p: string) => string;
};
type State = {
@@ -112,4 +111,4 @@ class BranchForm extends React.Component<Props, State> {
};
}
export default translate("repos")(BranchForm);
export default withTranslation("repos")(BranchForm);

View File

@@ -1,11 +1,10 @@
import React from "react";
import { translate } from "react-i18next";
import { WithTranslation, withTranslation } from "react-i18next";
import BranchRow from "./BranchRow";
import { Branch } from "@scm-manager/ui-types";
type Props = {
type Props = WithTranslation & {
baseUrl: string;
t: (p: string) => string;
branches: Branch[];
};
@@ -36,4 +35,4 @@ class BranchTable extends React.Component<Props> {
}
}
export default translate("repos")(BranchTable);
export default withTranslation("repos")(BranchTable);

View File

@@ -1,13 +1,10 @@
import React from "react";
import { translate } from "react-i18next";
import { WithTranslation, withTranslation } from "react-i18next";
import styled from "styled-components";
import { Tag } from "@scm-manager/ui-components";
type Props = {
type Props = WithTranslation & {
defaultBranch?: boolean;
// context props
t: (p: string) => string;
};
const LeftMarginTag = styled(Tag)`
@@ -26,4 +23,4 @@ class DefaultBranchTag extends React.Component<Props> {
}
}
export default translate("repos")(DefaultBranchTag);
export default withTranslation("repos")(DefaultBranchTag);