diff --git a/client/components/alert.js b/client/components/alert.js index e32ee872..49ae7afb 100644 --- a/client/components/alert.js +++ b/client/components/alert.js @@ -4,6 +4,7 @@ import PropTypes from 'prop-types'; import { Input, Button, Modal, NgIf } from './'; import { alert } from '../helpers/'; import { Popup } from './popup'; +import { t } from '../locales/'; export class ModalAlert extends Popup { constructor(props){ @@ -22,7 +23,7 @@ export class ModalAlert extends Popup { onSubmit(e){ this.setState({appear: false}, () => { - requestAnimationFrame(() => this.state.fn()) + requestAnimationFrame(() => this.state.fn && this.state.fn()); }); } @@ -36,7 +37,7 @@ export class ModalAlert extends Popup { modalContentFooter(){ return ( - + ); } } diff --git a/client/components/confirm.js b/client/components/confirm.js index e0404d6d..1cdc984c 100644 --- a/client/components/confirm.js +++ b/client/components/confirm.js @@ -4,6 +4,7 @@ import PropTypes from 'prop-types'; import { Input, Button, Modal, NgIf } from './'; import { confirm } from '../helpers/'; import { Popup } from './popup'; +import { t } from '../locales/'; export class ModalConfirm extends Popup{ constructor(props){ @@ -44,8 +45,8 @@ export class ModalConfirm extends Popup{ modalContentFooter(){ return (
- - + +
); } diff --git a/client/components/decorator.js b/client/components/decorator.js index 1c6fedc5..f7cec6fd 100644 --- a/client/components/decorator.js +++ b/client/components/decorator.js @@ -5,6 +5,7 @@ import { browserHistory, Redirect } from 'react-router'; import { Session, Admin } from '../model/'; import { Container, Loader, Icon, NgIf } from '../components/'; import { memory, currentShare } from '../helpers/'; +import { t } from '../locales/'; import '../pages/error.scss'; @@ -78,7 +79,7 @@ export function ErrorPage(WrappedComponent){ render(){ if(this.state.error !== null){ - const message = this.state.error.message || "There is nothing in here"; + const message = this.state.error.message || t("There is nothing in here"); return (
@@ -86,8 +87,8 @@ export function ErrorPage(WrappedComponent){
-

Oops!

-

{message}

+

{ t("Oops!") }

+

{ message }

diff --git a/client/components/formbuilder.js b/client/components/formbuilder.js index fb83a351..a74c26fd 100644 --- a/client/components/formbuilder.js +++ b/client/components/formbuilder.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import { Input, Textarea, Select, Enabler } from './'; import { FormObjToJSON, format, autocomplete, notify } from '../helpers/'; +import { t } from '../locales/'; import "./formbuilder.scss"; @@ -113,7 +114,7 @@ export class FormBuilder extends React.Component { const FormElement = (props) => { const id = props.id !== undefined ? {id: props.id} : {}; let struct = props.params; - let $input = ( props.onChange(e.target.value)} {...id} name={struct.label} type="text" defaultValue={struct.value} placeholder={struct.placeholder} /> ); + let $input = ( props.onChange(e.target.value)} {...id} name={struct.label} type="text" defaultValue={struct.value} placeholder={ t(struct.placeholder) } /> ); switch(props.params["type"]){ case "text": const onTextChange = (value) => { @@ -124,7 +125,7 @@ const FormElement = (props) => { }; const list_id = struct.datalist ? "list_"+Math.random() : null; - $input = ( onTextChange(e.target.value)} {...id} name={struct.label} type="text" value={struct.value || ""} placeholder={struct.placeholder} readOnly={struct.readonly}/> ); + $input = ( onTextChange(e.target.value)} {...id} name={struct.label} type="text" value={struct.value || ""} placeholder={ t(struct.placeholder) } readOnly={struct.readonly}/> ); if(list_id != null){ const filtered = function(multi, datalist, currentValue){ if(multi !== true || currentValue == null) return datalist; @@ -156,7 +157,7 @@ const FormElement = (props) => { value = value === "" ? null : parseInt(value); props.onChange(value); }; - $input = ( onNumberChange(e.target.value)} {...id} name={struct.label} type="number" value={struct.value === null ? "" : struct.value} placeholder={struct.placeholder} /> ); + $input = ( onNumberChange(e.target.value)} {...id} name={struct.label} type="number" value={struct.value === null ? "" : struct.value} placeholder={ t(struct.placeholder) } /> ); break; case "password": const onPasswordChange = (value) => { @@ -165,7 +166,7 @@ const FormElement = (props) => { } props.onChange(value); }; - $input = ( onPasswordChange(e.target.value)} {...id} name={struct.label} type="password" value={struct.value || ""} placeholder={struct.placeholder} /> ); + $input = ( onPasswordChange(e.target.value)} {...id} name={struct.label} type="password" value={struct.value || ""} placeholder={ t(struct.placeholder) } /> ); break; case "long_password": const onLongPasswordChange = (value) => { @@ -175,11 +176,11 @@ const FormElement = (props) => { props.onChange(value); }; $input = ( -