diff --git a/Dockerfile b/Dockerfile index d2364735..743d7d90 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ COPY .babelrc index.js nodemon.json ./ COPY ./webpack ./webpack COPY client ./client COPY server ./server +COPY translations/locales ./translations/locales CMD ["npm", "start"] FROM development as build diff --git a/client/components/Nav.jsx b/client/components/Nav.jsx index dd7c800e..4c27d6fa 100644 --- a/client/components/Nav.jsx +++ b/client/components/Nav.jsx @@ -4,6 +4,8 @@ import { connect } from 'react-redux'; import { withRouter } from 'react-router'; import { Link } from 'react-router'; import classNames from 'classnames'; +import { withTranslation } from 'react-i18next'; +import i18next from 'i18next'; import * as IDEActions from '../modules/IDE/actions/ide'; import * as toastActions from '../modules/IDE/actions/toast'; import * as projectActions from '../modules/IDE/actions/project'; @@ -55,6 +57,10 @@ class Nav extends React.PureComponent { this.handleFocusForHelp = this.handleFocus.bind(this, 'help'); this.toggleDropdownForAccount = this.toggleDropdown.bind(this, 'account'); this.handleFocusForAccount = this.handleFocus.bind(this, 'account'); + this.toggleDropdownForLang = this.toggleDropdown.bind(this, 'lang'); + this.handleFocusForLang = this.handleFocus.bind(this, 'lang'); + this.handleLangSelection = this.handleLangSelection.bind(this); + this.closeDropDown = this.closeDropDown.bind(this); } @@ -163,6 +169,13 @@ class Nav extends React.PureComponent { this.setDropdown('none'); } + handleLangSelection(event) { + i18next.changeLanguage(event.target.value); + this.props.showToast(1500); + this.props.setToastText('LangChange'); + this.setDropdown('none'); + } + handleLogout() { this.props.logoutUser(); this.setDropdown('none'); @@ -233,7 +246,7 @@ class Nav extends React.PureComponent { - Back to Editor + {this.props.t('BackEditor')} @@ -258,7 +271,7 @@ class Nav extends React.PureComponent { } }} > - File + {this.props.t('File')}
@@ -43,12 +44,12 @@ function About(props) { rel="noopener noreferrer" >
- Learn + {t('Learn')}- Libraries + {t('Libraries')}
@@ -66,7 +67,7 @@ function About(props) { rel="noopener noreferrer" >
- Reference + {t('Reference')}@@ -76,7 +77,7 @@ function About(props) { rel="noopener noreferrer" >
- Forum + {t('Forum')}@@ -94,7 +95,7 @@ function About(props) { href="https://github.com/processing/p5.js-web-editor/issues/new" target="_blank" rel="noopener noreferrer" - >Report a bug + >{t('Report')}
diff --git a/client/modules/IDE/components/FileNode.jsx b/client/modules/IDE/components/FileNode.jsx index bd077874..57238cf8 100644 --- a/client/modules/IDE/components/FileNode.jsx +++ b/client/modules/IDE/components/FileNode.jsx @@ -206,12 +206,14 @@ export class FileNode extends React.Component {
- Code editing keyboard shortcuts follow Sublime Text shortcuts. + {t('Code editing keyboard shortcuts follow')} {t('Sublime Text shortcuts')}.
- {props.text} + {t(props.text)}