Merge branch 'master' of github.com:ONLYOFFICE/CommunityServer-AspNetCore
This commit is contained in:
commit
b9bc94b145
@ -11,6 +11,8 @@ import {
|
|||||||
} from "asc-web-components";
|
} from "asc-web-components";
|
||||||
import submit from "./submit";
|
import submit from "./submit";
|
||||||
import validate from "./validate";
|
import validate from "./validate";
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { department, headOfDepartment, typeUser } from './../../../../../../helpers/customNames';
|
||||||
|
|
||||||
const generateItems = numItems =>
|
const generateItems = numItems =>
|
||||||
Array(numItems)
|
Array(numItems)
|
||||||
@ -22,6 +24,7 @@ const generateItems = numItems =>
|
|||||||
|
|
||||||
const GroupForm = props => {
|
const GroupForm = props => {
|
||||||
const { error, handleSubmit, submitting, initialValues, history } = props;
|
const { error, handleSubmit, submitting, initialValues, history } = props;
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const selectedList = generateItems(100);
|
const selectedList = generateItems(100);
|
||||||
|
|
||||||
@ -35,7 +38,7 @@ const GroupForm = props => {
|
|||||||
<form onSubmit={handleSubmit(submit)}>
|
<form onSubmit={handleSubmit(submit)}>
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="group-name">
|
<label htmlFor="group-name">
|
||||||
<Text.Body as="span" isBold={true}>Department name:</Text.Body>
|
<Text.Body as="span" isBold={true}>{t('CustomDepartmentName', { department })}:</Text.Body>
|
||||||
</label>
|
</label>
|
||||||
<div style={{width: "320px"}}>
|
<div style={{width: "320px"}}>
|
||||||
<TextInput id="group-name" name="group-name" scale={true} />
|
<TextInput id="group-name" name="group-name" scale={true} />
|
||||||
@ -43,11 +46,11 @@ const GroupForm = props => {
|
|||||||
</div>
|
</div>
|
||||||
<div style={{ marginTop: "16px" }}>
|
<div style={{ marginTop: "16px" }}>
|
||||||
<label htmlFor="head-selector">
|
<label htmlFor="head-selector">
|
||||||
<Text.Body as="span" isBold={true}>Head of department:</Text.Body>
|
<Text.Body as="span" isBold={true}>{t('CustomHeadOfDepartment', { headOfDepartment })}:</Text.Body>
|
||||||
</label>
|
</label>
|
||||||
<InputBlock
|
<InputBlock
|
||||||
id="head-selector"
|
id="head-selector"
|
||||||
value="Add employee"
|
value={t('CustomAddEmployee', { typeUser })}
|
||||||
iconName="ExpanderDownIcon"
|
iconName="ExpanderDownIcon"
|
||||||
iconSize={8}
|
iconSize={8}
|
||||||
isIconFill={true}
|
isIconFill={true}
|
||||||
@ -64,7 +67,7 @@ const GroupForm = props => {
|
|||||||
</label>
|
</label>
|
||||||
<InputBlock
|
<InputBlock
|
||||||
id="employee-selector"
|
id="employee-selector"
|
||||||
value="Add employee"
|
value={t('CustomAddEmployee', { typeUser })}
|
||||||
iconName="ExpanderDownIcon"
|
iconName="ExpanderDownIcon"
|
||||||
iconSize={8}
|
iconSize={8}
|
||||||
isIconFill={true}
|
isIconFill={true}
|
||||||
@ -87,9 +90,9 @@ const GroupForm = props => {
|
|||||||
</div>
|
</div>
|
||||||
<div>{error && <strong>{error}</strong>}</div>
|
<div>{error && <strong>{error}</strong>}</div>
|
||||||
<div style={{ marginTop: "60px" }}>
|
<div style={{ marginTop: "60px" }}>
|
||||||
<Button label="Save" primary type="submit" isDisabled={submitting} size="big" />
|
<Button label={t('SaveButton')} primary type="submit" isDisabled={submitting} size="big" />
|
||||||
<Button
|
<Button
|
||||||
label="Cancel"
|
label={t('CancelButton')}
|
||||||
style={{ marginLeft: "8px" }}
|
style={{ marginLeft: "8px" }}
|
||||||
size="big"
|
size="big"
|
||||||
isDisabled={submitting}
|
isDisabled={submitting}
|
||||||
|
@ -3,6 +3,8 @@ import { connect } from 'react-redux';
|
|||||||
import { withRouter } from "react-router";
|
import { withRouter } from "react-router";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import { IconButton, Text } from 'asc-web-components';
|
import { IconButton, Text } from 'asc-web-components';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { department } from './../../../../../helpers/customNames';
|
||||||
|
|
||||||
|
|
||||||
const wrapperStyle = {
|
const wrapperStyle = {
|
||||||
@ -16,8 +18,9 @@ const textStyle = {
|
|||||||
|
|
||||||
const SectionHeaderContent = (props) => {
|
const SectionHeaderContent = (props) => {
|
||||||
const {group, history, settings} = props;
|
const {group, history, settings} = props;
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const headerText = "New department";
|
const headerText = t('CustomNewDepartment', { department });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={wrapperStyle}>
|
<div style={wrapperStyle}>
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
import i18n from "i18next";
|
||||||
|
import Backend from "i18next-xhr-backend";
|
||||||
|
import config from "../../../../package.json";
|
||||||
|
|
||||||
|
const newInstance = i18n.createInstance();
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === "production") {
|
||||||
|
newInstance
|
||||||
|
.use(Backend)
|
||||||
|
.init({
|
||||||
|
lng: 'en',
|
||||||
|
fallbackLng: "en",
|
||||||
|
debug: true,
|
||||||
|
|
||||||
|
interpolation: {
|
||||||
|
escapeValue: false, // not needed for react as it escapes by default
|
||||||
|
format: function (value, format) {
|
||||||
|
if (format === 'lowercase') return value.toLowerCase();
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
react: {
|
||||||
|
useSuspense: true
|
||||||
|
},
|
||||||
|
backend: {
|
||||||
|
loadPath: `${config.homepage}/locales/GroupAction/{{lng}}/{{ns}}.json`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (process.env.NODE_ENV === "development") {
|
||||||
|
|
||||||
|
const resources = {
|
||||||
|
en: {
|
||||||
|
translation: require("./locales/en/translation.json")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
newInstance.init({
|
||||||
|
resources: resources,
|
||||||
|
lng: 'en',
|
||||||
|
fallbackLng: "en",
|
||||||
|
debug: true,
|
||||||
|
|
||||||
|
interpolation: {
|
||||||
|
escapeValue: false, // not needed for react as it escapes by default
|
||||||
|
format: function (value, format) {
|
||||||
|
if (format === 'lowercase') return value.toLowerCase();
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
react: {
|
||||||
|
useSuspense: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default newInstance;
|
@ -3,6 +3,8 @@ import { connect } from "react-redux";
|
|||||||
import { PageLayout } from "asc-web-components";
|
import { PageLayout } from "asc-web-components";
|
||||||
import { ArticleHeaderContent, ArticleMainButtonContent, ArticleBodyContent } from '../../Article';
|
import { ArticleHeaderContent, ArticleMainButtonContent, ArticleBodyContent } from '../../Article';
|
||||||
import { SectionHeaderContent, SectionBodyContent } from './Section';
|
import { SectionHeaderContent, SectionBodyContent } from './Section';
|
||||||
|
import i18n from "./i18n";
|
||||||
|
import { I18nextProvider } from "react-i18next";
|
||||||
|
|
||||||
class GroupAction extends React.Component {
|
class GroupAction extends React.Component {
|
||||||
|
|
||||||
@ -10,6 +12,7 @@ class GroupAction extends React.Component {
|
|||||||
console.log("GroupAction render")
|
console.log("GroupAction render")
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<I18nextProvider i18n={i18n}>
|
||||||
<PageLayout
|
<PageLayout
|
||||||
articleHeaderContent={<ArticleHeaderContent />}
|
articleHeaderContent={<ArticleHeaderContent />}
|
||||||
articleMainButtonContent={<ArticleMainButtonContent />}
|
articleMainButtonContent={<ArticleMainButtonContent />}
|
||||||
@ -17,6 +20,7 @@ class GroupAction extends React.Component {
|
|||||||
sectionHeaderContent={<SectionHeaderContent />}
|
sectionHeaderContent={<SectionHeaderContent />}
|
||||||
sectionBodyContent={<SectionBodyContent />}
|
sectionBodyContent={<SectionBodyContent />}
|
||||||
/>
|
/>
|
||||||
|
</I18nextProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"SaveButton": "Save",
|
||||||
|
"CancelButton": "Cancel",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"CustomHeadOfDepartment": "{{headOfDepartment}}",
|
||||||
|
"CustomAddEmployee": "Add {{typeUser, lowercase}}",
|
||||||
|
"CustomNewDepartment": "New {{department, lowercase}}",
|
||||||
|
"CustomDepartmentName": "{{department}} name"
|
||||||
|
}
|
@ -45,7 +45,7 @@
|
|||||||
"CustomTypeUser": "{{typeUser}}",
|
"CustomTypeUser": "{{typeUser}}",
|
||||||
"CustomMakeUser": "Make {{typeUser, lowercase}}",
|
"CustomMakeUser": "Make {{typeUser, lowercase}}",
|
||||||
"CustomMakeGuest": "Make {{typeGuest, lowercase}}",
|
"CustomMakeGuest": "Make {{typeGuest, lowercase}}",
|
||||||
"CustomDepartment": "{{department}}" ,
|
"CustomDepartment": "{{department}}",
|
||||||
"CountPerPage": "{{count}} per page",
|
"CountPerPage": "{{count}} per page",
|
||||||
"PageOfTotalPage": "{{page}} of {{totalPage}}"
|
"PageOfTotalPage": "{{page}} of {{totalPage}}"
|
||||||
}
|
}
|
@ -97,5 +97,11 @@
|
|||||||
"AboutCompanyTitle",
|
"AboutCompanyTitle",
|
||||||
"LogoutButton"
|
"LogoutButton"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"GroupAction": {
|
||||||
|
"Resource": [
|
||||||
|
"SaveButton",
|
||||||
|
"CancelButton"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user