mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 07:55:47 +01:00
Migrate react-i18next translate components
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import React from "react";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { Repository } from "@scm-manager/ui-types";
|
||||
import { NavLink } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
repository: Repository;
|
||||
editUrl: string;
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
class EditRepoNavLink extends React.Component<Props> {
|
||||
@@ -24,4 +23,4 @@ class EditRepoNavLink extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("repos")(EditRepoNavLink);
|
||||
export default withTranslation("repos")(EditRepoNavLink);
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import React from "react";
|
||||
import { NavLink } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { Repository } from "@scm-manager/ui-types";
|
||||
import { NavLink } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
permissionUrl: string;
|
||||
t: (p: string) => string;
|
||||
repository: Repository;
|
||||
};
|
||||
|
||||
@@ -22,4 +21,4 @@ class PermissionsNavLink extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("repos")(PermissionsNavLink);
|
||||
export default withTranslation("repos")(PermissionsNavLink);
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import React from "react";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { Repository } from "@scm-manager/ui-types";
|
||||
import { MailLink, DateFromNow } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
repository: Repository;
|
||||
// context props
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
class RepositoryDetailTable extends React.Component<Props> {
|
||||
@@ -51,4 +49,4 @@ class RepositoryDetailTable extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("repos")(RepositoryDetailTable);
|
||||
export default withTranslation("repos")(RepositoryDetailTable);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from "react";
|
||||
import { Interpolate, translate } from "react-i18next";
|
||||
import { Trans, WithTranslation, withTranslation } from "react-i18next";
|
||||
import classNames from "classnames";
|
||||
import styled from "styled-components";
|
||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
@@ -17,12 +17,9 @@ import {
|
||||
Button
|
||||
} from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
changeset: Changeset;
|
||||
repository: Repository;
|
||||
|
||||
// context props
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
type State = {
|
||||
@@ -85,7 +82,7 @@ class ChangesetDetails extends React.Component<Props, State> {
|
||||
<ChangesetAuthor changeset={changeset} />
|
||||
</p>
|
||||
<p>
|
||||
<Interpolate i18nKey="changeset.summary" id={id} time={date} />
|
||||
<Trans i18nKey="changeset.summary" values={{ id, time: date }} />
|
||||
</p>
|
||||
</div>
|
||||
<div className="media-right">{this.renderTags()}</div>
|
||||
@@ -154,4 +151,4 @@ class ChangesetDetails extends React.Component<Props, State> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("repos")(ChangesetDetails);
|
||||
export default withTranslation("repos")(ChangesetDetails);
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { Subtitle, InputField, Select, SubmitButton, Textarea } from "@scm-manager/ui-components";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
import { Repository, RepositoryType } from "@scm-manager/ui-types";
|
||||
import { Subtitle, InputField, Select, SubmitButton, Textarea } from "@scm-manager/ui-components";
|
||||
import * as validator from "./repositoryValidation";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
submitForm: (p: Repository) => void;
|
||||
repository?: Repository;
|
||||
repositoryTypes: RepositoryType[];
|
||||
namespaceStrategy: string;
|
||||
loading?: boolean;
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
type State = {
|
||||
@@ -54,10 +53,8 @@ class RepositoryForm extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
isFalsy(value) {
|
||||
if (!value) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return !value;
|
||||
|
||||
}
|
||||
|
||||
isValid = () => {
|
||||
@@ -236,4 +233,4 @@ class RepositoryForm extends React.Component<Props, State> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("repos")(RepositoryForm);
|
||||
export default withTranslation("repos")(RepositoryForm);
|
||||
|
||||
Reference in New Issue
Block a user