mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 14:05:44 +01:00
Migrate react-i18next translate components
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { Checkbox, InputField, Subtitle } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
baseUrl: string;
|
||||
forceBaseUrl: boolean;
|
||||
t: (p: string) => string;
|
||||
onChange: (p1: boolean, p2: any, p3: string) => void;
|
||||
hasUpdatePermission: boolean;
|
||||
};
|
||||
@@ -49,4 +48,4 @@ class BaseUrlSettings extends React.Component<Props> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("config")(BaseUrlSettings);
|
||||
export default withTranslation("config")(BaseUrlSettings);
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { SubmitButton, Notification } from "@scm-manager/ui-components";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { NamespaceStrategies, Config } from "@scm-manager/ui-types";
|
||||
import { SubmitButton, Notification } from "@scm-manager/ui-components";
|
||||
import ProxySettings from "./ProxySettings";
|
||||
import GeneralSettings from "./GeneralSettings";
|
||||
import BaseUrlSettings from "./BaseUrlSettings";
|
||||
import LoginAttempt from "./LoginAttempt";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
submitForm: (p: Config) => void;
|
||||
config?: Config;
|
||||
loading?: boolean;
|
||||
configReadPermission: boolean;
|
||||
configUpdatePermission: boolean;
|
||||
namespaceStrategies?: NamespaceStrategies;
|
||||
// context props
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
type State = {
|
||||
@@ -189,4 +187,4 @@ class ConfigForm extends React.Component<Props, State> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("config")(ConfigForm);
|
||||
export default withTranslation("config")(ConfigForm);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { Checkbox, InputField } from "@scm-manager/ui-components";
|
||||
import { NamespaceStrategies } from "@scm-manager/ui-types";
|
||||
import NamespaceStrategySelect from "./NamespaceStrategySelect";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
realmDescription: string;
|
||||
loginInfoUrl: string;
|
||||
disableGroupingGrid: boolean;
|
||||
@@ -17,8 +17,6 @@ type Props = {
|
||||
namespaceStrategies?: NamespaceStrategies;
|
||||
onChange: (p1: boolean, p2: any, p3: string) => void;
|
||||
hasUpdatePermission: boolean;
|
||||
// context props
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
class GeneralSettings extends React.Component<Props> {
|
||||
@@ -122,4 +120,4 @@ class GeneralSettings extends React.Component<Props> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("config")(GeneralSettings);
|
||||
export default withTranslation("config")(GeneralSettings);
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { InputField, Subtitle, validation as validator } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
loginAttemptLimit: number;
|
||||
loginAttemptLimitTimeout: number;
|
||||
t: (p: string) => string;
|
||||
onChange: (p1: boolean, p2: any, p3: string) => void;
|
||||
hasUpdatePermission: boolean;
|
||||
};
|
||||
@@ -76,4 +75,4 @@ class LoginAttempt extends React.Component<Props, State> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("config")(LoginAttempt);
|
||||
export default withTranslation("config")(LoginAttempt);
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
import React from "react";
|
||||
import { translate, TFunction } from "react-i18next";
|
||||
import { Select } from "@scm-manager/ui-components";
|
||||
import { withTranslation, WithTranslation } from "react-i18next";
|
||||
import { NamespaceStrategies } from "@scm-manager/ui-types";
|
||||
import { Select } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
namespaceStrategies: NamespaceStrategies;
|
||||
label: string;
|
||||
value?: string;
|
||||
disabled?: boolean;
|
||||
helpText?: string;
|
||||
onChange: (value: string, name?: string) => void;
|
||||
// context props
|
||||
t: TFunction;
|
||||
};
|
||||
|
||||
class NamespaceStrategySelect extends React.Component<Props> {
|
||||
@@ -59,4 +57,4 @@ class NamespaceStrategySelect extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("plugins")(NamespaceStrategySelect);
|
||||
export default withTranslation("plugins")(NamespaceStrategySelect);
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { Checkbox, InputField, Subtitle, AddEntryToTableField } from "@scm-manager/ui-components";
|
||||
import ProxyExcludesTable from "../table/ProxyExcludesTable";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
proxyPassword: string;
|
||||
proxyPort: number;
|
||||
proxyServer: string;
|
||||
proxyUser: string;
|
||||
enableProxy: boolean;
|
||||
proxyExcludes: string[];
|
||||
t: (p: string) => string;
|
||||
onChange: (p1: boolean, p2: any, p3: string) => void;
|
||||
hasUpdatePermission: boolean;
|
||||
};
|
||||
@@ -131,4 +130,4 @@ class ProxySettings extends React.Component<Props> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("config")(ProxySettings);
|
||||
export default withTranslation("config")(ProxySettings);
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import ArrayConfigTable from "./ArrayConfigTable";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
proxyExcludes: string[];
|
||||
t: (p: string) => string;
|
||||
onChange: (p1: boolean, p2: any, p3: string) => void;
|
||||
disabled: boolean;
|
||||
};
|
||||
@@ -31,4 +30,4 @@ class ProxyExcludesTable extends React.Component<Props, State> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("config")(ProxyExcludesTable);
|
||||
export default withTranslation("config")(ProxyExcludesTable);
|
||||
|
||||
Reference in New Issue
Block a user