mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
Migrate react-i18next translate components
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user