+
{formatMessage(defaultMessages.comments)}
@@ -138,3 +106,35 @@ class SimpleCommentScreen extends BaseComponent {
);
}
}
+
+export default class I18nWrapper extends BaseComponent {
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ locale: defaultLocale,
+ };
+
+ _.bindAll(this, 'handleSetLocale');
+ }
+
+ handleSetLocale(locale) {
+ this.setState({ locale });
+ }
+
+ render() {
+ const { locale } = this.state;
+ const messages = translations[locale];
+ const InjectedSimpleCommentScreen = injectIntl(SimpleCommentScreen);
+
+ return (
+
+
+
+ );
+ }
+}
diff --git a/client/app/bundles/comments/containers/NonRouterCommentsContainer.jsx b/client/app/bundles/comments/containers/NonRouterCommentsContainer.jsx
index 72c753ff..eea52532 100644
--- a/client/app/bundles/comments/containers/NonRouterCommentsContainer.jsx
+++ b/client/app/bundles/comments/containers/NonRouterCommentsContainer.jsx
@@ -1,17 +1,16 @@
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
-
import BaseComponent from 'libs/components/BaseComponent';
-
-import CommentScreen from '../components/CommentScreen/CommentScreen';
-import * as commentsActionCreators from '../actions/commentsActionCreators';
import { IntlProvider } from 'react-intl';
import { translations } from 'libs/i18n/translations';
import { defaultLocale } from 'libs/i18n/default';
-
// polyfill for server-side rendering, required by react-intl
import Intl from 'intl';
+
+import CommentScreen from '../components/CommentScreen/CommentScreen';
+import * as commentsActionCreators from '../actions/commentsActionCreators';
+
global.Intl = Intl;
function select(state) {
diff --git a/client/app/bundles/comments/containers/RouterCommentsContainer.jsx b/client/app/bundles/comments/containers/RouterCommentsContainer.jsx
index 86e8e06a..eb01405f 100644
--- a/client/app/bundles/comments/containers/RouterCommentsContainer.jsx
+++ b/client/app/bundles/comments/containers/RouterCommentsContainer.jsx
@@ -1,16 +1,15 @@
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
-
-import BaseComponent from 'libs/components/BaseComponent';
import { IntlProvider } from 'react-intl';
+import Intl from 'intl';
+import { defaultLocale } from 'libs/i18n/default';
+import { translations } from 'libs/i18n/translations';
+import BaseComponent from 'libs/components/BaseComponent';
+
import CommentScreen from '../components/CommentScreen/CommentScreen';
import * as commentsActionCreators from '../actions/commentsActionCreators';
-import { translations } from 'libs/i18n/translations';
-import { defaultLocale } from 'libs/i18n/default';
-// polyfill for server-side rendering, required by react-intl
-import Intl from 'intl';
global.Intl = Intl;
function select(state) {
diff --git a/client/app/bundles/comments/startup/clientRegistration.jsx b/client/app/bundles/comments/startup/clientRegistration.jsx
index 9b09e9e2..ba445002 100644
--- a/client/app/bundles/comments/startup/clientRegistration.jsx
+++ b/client/app/bundles/comments/startup/clientRegistration.jsx
@@ -1,5 +1,11 @@
import ReactOnRails from 'react-on-rails';
+import { addLocaleData } from 'react-intl';
+import en from 'react-intl/locale-data/en';
+import de from 'react-intl/locale-data/de';
+import ja from 'react-intl/locale-data/ja';
+import zh from 'react-intl/locale-data/zh';
+
import App from './App';
import RouterApp from './ClientRouterApp';
import SimpleCommentScreen from '../components/SimpleCommentScreen/SimpleCommentScreen';
@@ -7,12 +13,6 @@ import routerCommentsStore from '../store/routerCommentsStore';
import commentsStore from '../store/commentsStore';
import NavigationBarApp from './NavigationBarApp';
-import { addLocaleData } from 'react-intl';
-import en from 'react-intl/locale-data/en';
-import de from 'react-intl/locale-data/de';
-import ja from 'react-intl/locale-data/ja';
-import zh from 'react-intl/locale-data/zh';
-
// Initizalize all locales for react-intl.
addLocaleData([...en, ...de, ...ja, ...zh]);
diff --git a/client/app/libs/components/BaseComponent.jsx b/client/app/libs/components/BaseComponent.jsx
index 1a8c6d0b..dfd6a159 100644
--- a/client/app/libs/components/BaseComponent.jsx
+++ b/client/app/libs/components/BaseComponent.jsx
@@ -1,4 +1,4 @@
import React from 'react';
-export default class BaseComponent extends React.PureComponent {
-};
+/* eslint-disable react/prefer-stateless-function */
+export default class BaseComponent extends React.PureComponent { }
diff --git a/client/app/libs/i18n/selectLanguage.jsx b/client/app/libs/i18n/selectLanguage.jsx
index 4c9f9e97..b7188ffd 100644
--- a/client/app/libs/i18n/selectLanguage.jsx
+++ b/client/app/libs/i18n/selectLanguage.jsx
@@ -1,13 +1,15 @@
import React from 'react';
+import { defaultLocale } from 'libs/i18n/default';
+
const SelectLanguage = (onChange, locale = defaultLocale) => (
);
-export { SelectLanguage };
+export default SelectLanguage;
diff --git a/client/package.json b/client/package.json
index b525a0cc..ec1d294e 100644
--- a/client/package.json
+++ b/client/package.json
@@ -96,12 +96,12 @@
"body-parser": "^1.15.2",
"chai": "^3.5.0",
"chai-immutable": "^1.6.0",
- "eslint": "^3.10.2",
- "eslint-config-shakacode": "^13.2.0-beta.1",
- "eslint-import-resolver-webpack": "^0.7.0",
+ "eslint": "^3.18.0",
+ "eslint-config-shakacode": "^14.1.1",
+ "eslint-import-resolver-webpack": "^0.8.1",
"eslint-plugin-import": "^2.2.0",
- "eslint-plugin-jsx-a11y": "^2.2.3",
- "eslint-plugin-react": "^6.7.1",
+ "eslint-plugin-jsx-a11y": "^4.0.0",
+ "eslint-plugin-react": "^6.10.3",
"estraverse-fb": "^1.3.1",
"express": "^4.14.0",
"jsdom": "^9.8.3",
diff --git a/lib/tasks/linters.rake b/lib/tasks/linters.rake
index 1c0bdde6..60500d6c 100644
--- a/lib/tasks/linters.rake
+++ b/lib/tasks/linters.rake
@@ -38,7 +38,7 @@ if %w(development test).include? Rails.env
desc "eslint"
task :eslint do
- cmd = "cd client && $(npm bin)/eslint . -- --ext .jsx,.js"
+ cmd = "npm run lint"
puts "Running eslint via `#{cmd}`"
sh cmd
end