mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 23:15:43 +01:00
Migrate react-i18next translate components
This commit is contained in:
@@ -2,7 +2,7 @@ import React from "react";
|
||||
import { compose } from "redux";
|
||||
import { connect } from "react-redux";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import styled from "styled-components";
|
||||
import { binder } from "@scm-manager/ui-extensions";
|
||||
import { Repository, File } from "@scm-manager/ui-types";
|
||||
@@ -10,7 +10,7 @@ import { ErrorNotification, Loading, Notification } from "@scm-manager/ui-compon
|
||||
import { getFetchSourcesFailure, isFetchSourcesPending, getSources } from "../modules/sources";
|
||||
import FileTreeLeaf from "./FileTreeLeaf";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
loading: boolean;
|
||||
error: Error;
|
||||
tree: File;
|
||||
@@ -20,7 +20,6 @@ type Props = {
|
||||
baseUrl: string;
|
||||
|
||||
// context props
|
||||
t: (p: string) => string;
|
||||
match: any;
|
||||
};
|
||||
|
||||
@@ -142,4 +141,4 @@ const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
export default compose(
|
||||
withRouter,
|
||||
connect(mapStateToProps)
|
||||
)(translate("repos")(FileTree));
|
||||
)(withTranslation("repos")(FileTree));
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { File } from "@scm-manager/ui-types";
|
||||
import { DownloadButton } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
t: (p: string) => string;
|
||||
type Props = WithTranslation & {
|
||||
file: File;
|
||||
};
|
||||
|
||||
@@ -19,4 +18,4 @@ class DownloadViewer extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("repos")(DownloadViewer);
|
||||
export default withTranslation("repos")(DownloadViewer);
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { ButtonAddons, Button } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
className?: string;
|
||||
t: (p: string) => string;
|
||||
historyIsSelected: boolean;
|
||||
showHistory: (p: boolean) => void;
|
||||
};
|
||||
@@ -46,4 +45,4 @@ class FileButtonAddons extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("repos")(FileButtonAddons);
|
||||
export default withTranslation("repos")(FileButtonAddons);
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { File } from "@scm-manager/ui-types";
|
||||
|
||||
type Props = {
|
||||
t: (p: string) => string;
|
||||
type Props = WithTranslation & {
|
||||
file: File;
|
||||
};
|
||||
|
||||
@@ -20,4 +19,4 @@ class ImageViewer extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("repos")(ImageViewer);
|
||||
export default withTranslation("repos")(ImageViewer);
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { apiClient, SyntaxHighlighter } from "@scm-manager/ui-components";
|
||||
import { File } from "@scm-manager/ui-types";
|
||||
import { ErrorNotification, Loading } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
t: (p: string) => string;
|
||||
type Props = WithTranslation & {
|
||||
file: File;
|
||||
language: string;
|
||||
};
|
||||
@@ -85,4 +84,4 @@ export function getContent(url: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export default translate("repos")(SourcecodeViewer);
|
||||
export default withTranslation("repos")(SourcecodeViewer);
|
||||
|
||||
Reference in New Issue
Block a user