mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 08:55:44 +01:00
Migrate react-i18next translate components
This commit is contained in:
@@ -2,15 +2,12 @@ import React from "react";
|
||||
import PluginActionModal from "./PluginActionModal";
|
||||
import { PendingPlugins } from "@scm-manager/ui-types";
|
||||
import { apiClient } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
onClose: () => void;
|
||||
refresh: () => void;
|
||||
pendingPlugins: PendingPlugins;
|
||||
|
||||
// context props
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
class CancelPendingActionModal extends React.Component<Props> {
|
||||
@@ -37,4 +34,4 @@ class CancelPendingActionModal extends React.Component<Props> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("admin")(CancelPendingActionModal);
|
||||
export default withTranslation("admin")(CancelPendingActionModal);
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
import React from "react";
|
||||
import { Button } from "@scm-manager/ui-components";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { PendingPlugins } from "@scm-manager/ui-types";
|
||||
import { translate } from "react-i18next";
|
||||
import { Button } from "@scm-manager/ui-components";
|
||||
import ExecutePendingModal from "./ExecutePendingModal";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
pendingPlugins: PendingPlugins;
|
||||
|
||||
// context props
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
type State = {
|
||||
@@ -55,4 +52,4 @@ class ExecutePendingAction extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("admin")(ExecutePendingAction);
|
||||
export default withTranslation("admin")(ExecutePendingAction);
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
import React from "react";
|
||||
import PluginActionModal from "./PluginActionModal";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { PendingPlugins } from "@scm-manager/ui-types";
|
||||
import waitForRestart from "./waitForRestart";
|
||||
import { apiClient, Notification } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
import waitForRestart from "./waitForRestart";
|
||||
import PluginActionModal from "./PluginActionModal";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
onClose: () => void;
|
||||
pendingPlugins: PendingPlugins;
|
||||
|
||||
// context props
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
class ExecutePendingActionModal extends React.Component<Props> {
|
||||
@@ -36,4 +33,4 @@ class ExecutePendingActionModal extends React.Component<Props> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("admin")(ExecutePendingActionModal);
|
||||
export default withTranslation("admin")(ExecutePendingActionModal);
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
import React from "react";
|
||||
import { apiClient, Button, ButtonGroup, ErrorNotification, Modal, Notification } from "@scm-manager/ui-components";
|
||||
import { PendingPlugins } from "@scm-manager/ui-types";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import waitForRestart from "./waitForRestart";
|
||||
import SuccessNotification from "./SuccessNotification";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
onClose: () => void;
|
||||
pendingPlugins: PendingPlugins;
|
||||
|
||||
// context props
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
type State = {
|
||||
@@ -167,4 +164,4 @@ class ExecutePendingModal extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("admin")(ExecutePendingModal);
|
||||
export default withTranslation("admin")(ExecutePendingModal);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import * as React from "react";
|
||||
import { Button, ButtonGroup, ErrorNotification, Modal } from "@scm-manager/ui-components";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { PendingPlugins, PluginCollection } from "@scm-manager/ui-types";
|
||||
import { translate } from "react-i18next";
|
||||
import { Button, ButtonGroup, ErrorNotification, Modal } from "@scm-manager/ui-components";
|
||||
import SuccessNotification from "./SuccessNotification";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
onClose: () => void;
|
||||
actionType: string;
|
||||
pendingPlugins?: PendingPlugins;
|
||||
@@ -15,9 +15,6 @@ type Props = {
|
||||
label: string;
|
||||
|
||||
children?: React.Node;
|
||||
|
||||
// context props
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
type State = {
|
||||
@@ -199,4 +196,4 @@ class PluginActionModal extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("admin")(PluginActionModal);
|
||||
export default withTranslation("admin")(PluginActionModal);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import classNames from "classnames";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import styled from "styled-components";
|
||||
import { Plugin } from "@scm-manager/ui-types";
|
||||
import { CardColumn, Icon } from "@scm-manager/ui-components";
|
||||
@@ -13,12 +12,9 @@ export const PluginAction = {
|
||||
UNINSTALL: "uninstall"
|
||||
};
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
plugin: Plugin;
|
||||
refresh: () => void;
|
||||
|
||||
// context props
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
type State = {
|
||||
@@ -173,4 +169,4 @@ class PluginEntry extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("admin")(PluginEntry);
|
||||
export default withTranslation("admin")(PluginEntry);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import classNames from "classnames";
|
||||
import styled from "styled-components";
|
||||
import { Plugin } from "@scm-manager/ui-types";
|
||||
@@ -16,14 +16,11 @@ import waitForRestart from "./waitForRestart";
|
||||
import SuccessNotification from "./SuccessNotification";
|
||||
import { PluginAction } from "./PluginEntry";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
plugin: Plugin;
|
||||
pluginAction: string;
|
||||
refresh: () => void;
|
||||
onClose: () => void;
|
||||
|
||||
// context props
|
||||
t: (key: string, params?: object) => string;
|
||||
};
|
||||
|
||||
type State = {
|
||||
@@ -268,4 +265,4 @@ class PluginModal extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("admin")(PluginModal);
|
||||
export default withTranslation("admin")(PluginModal);
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { Notification } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
// context props
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
class InstallSuccessNotification extends React.Component<Props> {
|
||||
class InstallSuccessNotification extends React.Component<WithTranslation> {
|
||||
render() {
|
||||
const { t } = this.props;
|
||||
return (
|
||||
@@ -19,4 +14,4 @@ class InstallSuccessNotification extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("admin")(InstallSuccessNotification);
|
||||
export default withTranslation("admin")(InstallSuccessNotification);
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
import React from "react";
|
||||
import PluginActionModal from "./PluginActionModal";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { PluginCollection } from "@scm-manager/ui-types";
|
||||
import { apiClient } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
import PluginActionModal from "./PluginActionModal";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
onClose: () => void;
|
||||
refresh: () => void;
|
||||
installedPlugins: PluginCollection;
|
||||
|
||||
// context props
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
class UpdateAllActionModal extends React.Component<Props> {
|
||||
@@ -37,4 +34,4 @@ class UpdateAllActionModal extends React.Component<Props> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("admin")(UpdateAllActionModal);
|
||||
export default withTranslation("admin")(UpdateAllActionModal);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { compose } from "redux";
|
||||
import { PendingPlugins, PluginCollection } from "@scm-manager/ui-types";
|
||||
import {
|
||||
@@ -32,7 +32,7 @@ import ExecutePendingActionModal from "../components/ExecutePendingActionModal";
|
||||
import CancelPendingActionModal from "../components/CancelPendingActionModal";
|
||||
import UpdateAllActionModal from "../components/UpdateAllActionModal";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
loading: boolean;
|
||||
error: Error;
|
||||
collection: PluginCollection;
|
||||
@@ -43,9 +43,6 @@ type Props = {
|
||||
pendingPluginsLink: string;
|
||||
pendingPlugins: PendingPlugins;
|
||||
|
||||
// context objects
|
||||
t: (key: string, params?: object) => string;
|
||||
|
||||
// dispatched functions
|
||||
fetchPluginsByLink: (link: string) => void;
|
||||
fetchPendingPlugins: (link: string) => void;
|
||||
@@ -291,7 +288,7 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
|
||||
export default compose(
|
||||
translate("admin"),
|
||||
withTranslation("admin"),
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
|
||||
Reference in New Issue
Block a user