
diff -r 28971cf04a91 -r 37ecf0b9c174 clientjs/packages/dashboard-components/src/intl.jsx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/clientjs/packages/dashboard-components/src/intl.jsx	Thu Sep 20 17:51:15 2018 +0200
@@ -0,0 +1,34 @@
+import React from 'react';
+import _ from 'lodash';
+
+import { addLocaleData, IntlProvider } from 'react-intl';
+
+import messagesBase from './locales/messages.json';
+
+export default function setIntl(messagesDataExt, WrappedComponent, localeData) {
+  const messagesData = _.merge(_.cloneDeep(messagesBase), messagesDataExt || {});
+
+  addLocaleData(localeData);
+
+  let language = (navigator.languages && navigator.languages[0])
+    || navigator.language
+    || navigator.userLanguage;
+
+  let language6391 = language.toLowerCase().split(/[_-]+/)[0];
+
+  if (!(language6391 in messagesData)) {
+    language = 'en';
+    language6391 = 'en';
+  }
+
+  const messages = messagesData[language6391] || messagesData[language] || messagesData.en;
+
+  return props => (
+    <IntlProvider
+      locale={language}
+      messages={messages}
+    >
+      <WrappedComponent {...props} />
+    </IntlProvider>
+  );
+}




