LabelLab
- Login to your account
+ {t('login.title')}
- Don't have an account?
- Create an account
+ {t('login.noAccount')}
+ {t('login.createAccount')}
-
Or
+
{t('login.or')}
@@ -238,4 +240,8 @@ const mapActionToProps = (dispatch) => {
}
}
-export default connect(mapStateToProps, mapActionToProps)(LoginIndex)
+export { LoginIndex }
+
+export default withTranslation()(
+ connect(mapStateToProps, mapActionToProps)(LoginIndex)
+)
diff --git a/labellab-client/src/components/navbar/index.js b/labellab-client/src/components/navbar/index.js
index abebfec3b..2ad392752 100644
--- a/labellab-client/src/components/navbar/index.js
+++ b/labellab-client/src/components/navbar/index.js
@@ -2,6 +2,7 @@ import React, { Component } from 'react'
import { Image, Header, Dropdown } from 'semantic-ui-react'
import { Link } from 'react-router-dom'
import { connect } from 'react-redux'
+import { withTranslation } from 'react-i18next'
import PropTypes from 'prop-types'
import './css/navbar.css'
import Searchbar from './searchbar'
@@ -35,7 +36,7 @@ class Navbar extends Component {
content={user.username}
/>
{isfetching ? (
-
LOADING
+ {this.props.t('navbar.loading')}
) : user ? (
- Profile
+ {this.props.t('navbar.profile')}
- Logout
+ {this.props.t('navbar.logout')}
- Logout
+ {this.props.t('navbar.logout')}
@@ -83,4 +84,4 @@ const mapStateToProps = state => {
}
}
-export default connect(mapStateToProps, null)(Navbar)
+export default withTranslation()(connect(mapStateToProps, null)(Navbar))
diff --git a/labellab-client/src/i18n/index.js b/labellab-client/src/i18n/index.js
new file mode 100644
index 000000000..d0aaec028
--- /dev/null
+++ b/labellab-client/src/i18n/index.js
@@ -0,0 +1,22 @@
+import i18n from 'i18next'
+import { initReactI18next } from 'react-i18next'
+import en from './locales/en.json'
+import hi from './locales/hi.json'
+
+i18n.use(initReactI18next).init({
+ resources: {
+ en: {
+ translation: en
+ },
+ hi: {
+ translation: hi
+ }
+ },
+ lng: 'en',
+ fallbackLng: 'en',
+ interpolation: {
+ escapeValue: false
+ }
+})
+
+export default i18n
diff --git a/labellab-client/src/i18n/locales/en.json b/labellab-client/src/i18n/locales/en.json
new file mode 100644
index 000000000..c85138a89
--- /dev/null
+++ b/labellab-client/src/i18n/locales/en.json
@@ -0,0 +1,21 @@
+{
+ "login": {
+ "authenticating": "Authenticating...",
+ "title": "Login to your account",
+ "email": "E-mail address",
+ "password": "Password",
+ "forgotPassword": "Forgot password?",
+ "loginButton": "Log in",
+ "noAccount": "Don't have an account?",
+ "createAccount": "Create an account",
+ "or": "Or",
+ "emailRequired": "E-mail address is required!",
+ "emailInvalid": "E-mail address is invalid!",
+ "passwordRequired": "Password is required!"
+ },
+ "navbar": {
+ "profile": "Profile",
+ "logout": "Logout",
+ "loading": "LOADING"
+ }
+}
\ No newline at end of file
diff --git a/labellab-client/src/i18n/locales/hi.json b/labellab-client/src/i18n/locales/hi.json
new file mode 100644
index 000000000..2893757e1
--- /dev/null
+++ b/labellab-client/src/i18n/locales/hi.json
@@ -0,0 +1,21 @@
+{
+ "login": {
+ "authenticating": "प्रमाणीकरण हो रहा है...",
+ "title": "अपने खाते में लॉग इन करें",
+ "email": "ई-मेल पता",
+ "password": "पासवर्ड",
+ "forgotPassword": "पासवर्ड भूल गए?",
+ "loginButton": "लॉग इन करें",
+ "noAccount": "खाता नहीं है?",
+ "createAccount": "खाता बनाएं",
+ "or": "या",
+ "emailRequired": "ई-मेल पता आवश्यक है!",
+ "emailInvalid": "ई-मेल पता अमान्य है!",
+ "passwordRequired": "पासवर्ड आवश्यक है!"
+ },
+ "navbar": {
+ "profile": "प्रोफ़ाइल",
+ "logout": "लॉग आउट",
+ "loading": "लोड हो रहा है"
+ }
+}
\ No newline at end of file
diff --git a/labellab-client/src/index.js b/labellab-client/src/index.js
index 0e602142a..d01f306b6 100644
--- a/labellab-client/src/index.js
+++ b/labellab-client/src/index.js
@@ -4,6 +4,7 @@ import { Provider } from 'react-redux'
import { store } from './utils/store'
import './index.css'
import 'semantic-ui-css/semantic.min.css'
+import './i18n'
import App from './App'
import * as serviceWorker from './serviceWorker'
ReactDOM.render(