From d2eb98d1c05ccde5707160437c62aa5e080fd210 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 29 Nov 2020 09:18:38 -0800 Subject: [PATCH] Fix i18n resource loading --- .eslintcache | 2 +- lang/en.json | 119 +++++++++++------------ lang/es.json | 71 +++++++------- package-lock.json | 52 ++++------ package.json | 2 +- src/Footer.js | 58 +++++++---- src/Header.js | 6 +- src/LoginPage.js | 62 +++++------- src/compiled-lang/en.json | 196 +++++++++++++++----------------------- src/compiled-lang/es.json | 76 +++++++-------- src/index.js | 20 ++-- 11 files changed, 303 insertions(+), 361 deletions(-) diff --git a/.eslintcache b/.eslintcache index 30f7faab..04449ac3 100644 --- a/.eslintcache +++ b/.eslintcache @@ -1 +1 @@ -[{"/Users/pveiga/repos/wisemapping-react/src/Footer.js":"1","/Users/pveiga/repos/wisemapping-react/src/Header.js":"2","/Users/pveiga/repos/wisemapping-react/src/index.js":"3","/Users/pveiga/repos/wisemapping-react/src/LoginPage.js":"4"},{"size":1747,"mtime":1606529689598,"results":"5","hashOfConfig":"6"},{"size":1557,"mtime":1606529996629,"results":"7","hashOfConfig":"6"},{"size":695,"mtime":1606632469498,"results":"8","hashOfConfig":"6"},{"size":4283,"mtime":1606584003214,"results":"9","hashOfConfig":"6"},{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1xegajf",{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"14","messages":"15","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"16","messages":"17","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"/Users/pveiga/repos/wisemapping-react/src/Footer.js",[],"/Users/pveiga/repos/wisemapping-react/src/Header.js",[],"/Users/pveiga/repos/wisemapping-react/src/index.js",["18"],"/Users/pveiga/repos/wisemapping-react/src/LoginPage.js",["19"],{"ruleId":"20","severity":1,"message":"21","line":8,"column":9,"nodeType":"22","messageId":"23","endLine":8,"endColumn":17},{"ruleId":"20","severity":1,"message":"24","line":7,"column":7,"nodeType":"22","messageId":"23","endLine":7,"endColumn":26},"no-unused-vars","'language' is assigned a value but never used.","Identifier","unusedVar","'ConfigStatusMessage' is defined but never used."] \ No newline at end of file +[{"/Users/pveiga/repos/wisemapping-react/src/Footer.js":"1","/Users/pveiga/repos/wisemapping-react/src/Header.js":"2","/Users/pveiga/repos/wisemapping-react/src/index.js":"3","/Users/pveiga/repos/wisemapping-react/src/LoginPage.js":"4"},{"size":2117,"mtime":1606670064431,"results":"5","hashOfConfig":"6"},{"size":1572,"mtime":1606670050593,"results":"7","hashOfConfig":"6"},{"size":777,"mtime":1606670265242,"results":"8","hashOfConfig":"6"},{"size":4012,"mtime":1606670278388,"results":"9","hashOfConfig":"6"},{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1xegajf",{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"16","messages":"17","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"/Users/pveiga/repos/wisemapping-react/src/Footer.js",[],"/Users/pveiga/repos/wisemapping-react/src/Header.js",[],"/Users/pveiga/repos/wisemapping-react/src/index.js",[],"/Users/pveiga/repos/wisemapping-react/src/LoginPage.js",["18"],{"ruleId":"19","severity":1,"message":"20","line":7,"column":7,"nodeType":"21","messageId":"22","endLine":7,"endColumn":26},"no-unused-vars","'ConfigStatusMessage' is defined but never used.","Identifier","unusedVar"] \ No newline at end of file diff --git a/lang/en.json b/lang/en.json index 6e4e9b9b..5398048a 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1,63 +1,60 @@ { - "ABOUT_US": { - "defaultMessage": "About Us" - }, - "CONTACT_US": { - "defaultMessage": "Contact Us" - }, - "DONATIONS": { - "defaultMessage": "PayPal Donations" - }, - "DONT_HAVE_ACCOUNT": { - "defaultMessage": "Don't have an account ?" - }, - "EMAIL": { - "defaultMessage": "Email" - }, - "FAQ": { - "defaultMessage": "F.A.Q." - }, - "FEEDBACK": { - "defaultMessage": "Feedback" - }, - "FORGOT_PASSWORD": { - "defaultMessage": "Forgot Password ?" - }, - "LOGIN_ERROR": { - "defaultMessage": "The email address or password you entered is not valid." - }, - "LOG_INTO": { - "defaultMessage": "Log Into Your Account" - }, - "NO_PRODUCTION_DATABASE_CONFIGURED": { - "defaultMessage": "Warning: Although HSQLDB is bundled with WiseMapping by default during the installation, we do not recommend this database for production use. Please consider using MySQL 5.7 instead. You can find more information how to configure MySQL", - "description": "Missing production database configured" - }, - "OPEN_SOURCE": { - "defaultMessage": "Open Source" - }, - "PASSWORD": { - "defaultMessage": "Password" - }, - "REMEMBER_ME": { - "defaultMessage": "Remember me" - }, - "SIGN_IN": { - "defaultMessage": "Sign In" - }, - "SIGN_UP": { - "defaultMessage": "Sign Up" - }, - "SING_IN": { - "defaultMessage": "Sign In" - }, - "TERMS_AND_CONDITIONS": { - "defaultMessage": "Term And Conditions" - }, - "USER_INACTIVE": { - "defaultMessage": "Sorry, your account has not been activated yet. You'll receive a notification email when it becomes active. Stay tuned!." - }, - "WELCOME": { - "defaultMessage": "Welcome" - } + "footer.aboutus": { + "defaultMessage": "About Us" + }, + "footer.contactus": { + "defaultMessage": "Contact Us" + }, + "footer.donations": { + "defaultMessage": "PayPal footer.donations" + }, + "header.donthaveaccount": { + "defaultMessage": "Don't have an account ?" + }, + "login.email": { + "defaultMessage": "login.email" + }, + "footer.faq": { + "defaultMessage": "F.A.Q." + }, + "footer.feedback": { + "defaultMessage": "footer.feedback" + }, + "login.forgotpwd": { + "defaultMessage": "Forgot login.password ?" + }, + "login.error": { + "defaultMessage": "The login.email address or login.password you entered is not valid." + }, + "login.loginto": { + "defaultMessage": "Log Into Your Account" + }, + "login.hsqldbcofig": { + "defaultMessage": "Warning: Although HSQLDB is bundled with WiseMapping by default during the installation, we do not recommend this database for production use. Please consider using MySQL 5.7 instead. You can find more information how to configure MySQL", + "description": "Missing production database configured" + }, + "footer.opensource": { + "defaultMessage": "Open Source" + }, + "login.password": { + "defaultMessage": "login.password" + }, + "login.remberme": { + "defaultMessage": "Remember me" + }, + "login.signin": { + "defaultMessage": "Sign In" + }, + "login.signup": { + "defaultMessage": "Sign Up" + }, + "footer.termsandconditions": { + "defaultMessage": "Term And Conditions" + }, + "login.userinactive": { + "defaultMessage": "Sorry, your account has not been activated yet. You'll receive a notification login.email when it becomes active. Stay tuned!." + }, + "login.welcome": { + "defaultMessage": "login.welcome" + } } \ No newline at end of file diff --git a/lang/es.json b/lang/es.json index 41e98ba8..3ed77afc 100644 --- a/lang/es.json +++ b/lang/es.json @@ -1,63 +1,60 @@ { - "ABOUT_US": { - "defaultMessage": "About Us" + "footer.aboutus": { + "defaultMessage": "Sobre Nosotros" }, - "CONTACT_US": { - "defaultMessage": "Contact Us" + "footer.contactus": { + "defaultMessage": "Contáctenos" }, - "DONATIONS": { - "defaultMessage": "PayPal Donations" + "footer.donations": { + "defaultMessage": "PayPal Donaciones" }, - "DONT_HAVE_ACCOUNT": { - "defaultMessage": "Don't have an account ?" + "header.donthaveaccount": { + "defaultMessage": "No tienes una cuenta ?" }, - "EMAIL": { - "defaultMessage": "Email" + "login.email": { + "defaultMessage": "login.email" }, - "FAQ": { + "footer.faq": { "defaultMessage": "F.A.Q." }, - "FEEDBACK": { - "defaultMessage": "Feedback" + "footer.feedback": { + "defaultMessage": "footer.feedback" }, - "FORGOT_PASSWORD": { - "defaultMessage": "Forgot Password ?" + "login.forgotpwd": { + "defaultMessage": "Olvidaste el login.password ?" }, - "LOGIN_ERROR": { - "defaultMessage": "The email address or password you entered is not valid." + "login.error": { + "defaultMessage": "El login.email or la contraseña no es valida." }, - "LOG_INTO": { - "defaultMessage": "Log Into Your Account" + "login.loginto": { + "defaultMessage": "Ingresar a tu Cuenta" }, - "NO_PRODUCTION_DATABASE_CONFIGURED": { + "login.hsqldbcofig": { "defaultMessage": "Warning: Although HSQLDB is bundled with WiseMapping by default during the installation, we do not recommend this database for production use. Please consider using MySQL 5.7 instead. You can find more information how to configure MySQL", "description": "Missing production database configured" }, - "OPEN_SOURCE": { + "footer.opensource": { "defaultMessage": "Open Source" }, - "PASSWORD": { - "defaultMessage": "Password" + "login.password": { + "defaultMessage": "Contraseña" }, - "REMEMBER_ME": { - "defaultMessage": "Remember me" + "login.remberme": { + "defaultMessage": "Recordarme" }, - "SIGN_IN": { - "defaultMessage": "Sign In" + "login.signin": { + "defaultMessage": "Ingresar" }, - "SIGN_UP": { - "defaultMessage": "Sign Up" + "login.signup": { + "defaultMessage": "Registrarse" }, - "SING_IN": { - "defaultMessage": "Sign In" + "footer.termsandconditions": { + "defaultMessage": "Terminos y Condiciones" }, - "TERMS_AND_CONDITIONS": { - "defaultMessage": "Term And Conditions" + "login.userinactive": { + "defaultMessage": "Sorry, your account has not been activated yet. You'll receive a notification login.email when it becomes active. Stay tuned!." }, - "USER_INACTIVE": { - "defaultMessage": "Sorry, your account has not been activated yet. You'll receive a notification email when it becomes active. Stay tuned!." - }, - "WELCOME": { + "login.welcome": { "defaultMessage": "Bienvenido" } } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 1f844b81..40988141 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4742,8 +4742,7 @@ "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { + "funding": [{ "type": "github", "url": "https://github.com/sponsors/feross" }, @@ -4980,8 +4979,7 @@ "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { + "funding": [{ "type": "github", "url": "https://github.com/sponsors/feross" }, @@ -6164,7 +6162,7 @@ "node_modules/cssnano": { "version": "4.1.10", "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-4.1.10.tgz", - "integrity": "sha512-5wny+F6H4/8RgNlaqab4ktc3e0/blKutmq8yNlBFXA//nSFFAqAngjNVRzUvCgYROULmZZUoosL/KSoZo5aUaQ==", + "integrity": "sha512-5wny+F6H4/8RgNlaqab4ktc3e0/blKutmq8yNlBFXA//nSFfooter.faqAngjNVRzUvCgYROULmZZUoosL/KSoZo5aUaQ==", "dependencies": { "cosmiconfig": "^5.0.0", "cssnano-preset-default": "^4.0.7", @@ -6245,7 +6243,7 @@ "node_modules/cssnano-util-same-parent": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/cssnano-util-same-parent/-/cssnano-util-same-parent-4.0.1.tgz", - "integrity": "sha512-WcKx5OY+KoSIAxBW6UBBRay1U6vkYheCdjyVNDm85zt5K9mHoGOfsOsqIszfAqrQQFIIKgjh2+FDgIj/zsl21Q==", + "integrity": "sha512-WcKx5OY+KoSIAxBW6UBBRay1U6vkYheCdjyVNDm85zt5K9mHoGOfsOsqIszfooter.faqrQQFIIKgjh2+FDgIj/zsl21Q==", "engines": { "node": ">=6.9.0" } @@ -6851,12 +6849,10 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.2.tgz", "integrity": "sha512-wFwTwCVebUrMgGeAwRL/NhZtHAUyT9n9yg4IMDwf10+6iCMxSkVq9MGCVEH+QZWo1nNidy8kNvwmv4zWHDTqvA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ] + "funding": [{ + "type": "github", + "url": "https://github.com/sponsors/fb55" + }] }, "node_modules/domain-browser": { "version": "1.2.0", @@ -8682,12 +8678,10 @@ "version": "1.13.0", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz", "integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], + "funding": [{ + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + }], "engines": { "node": ">=4.0" } @@ -9343,8 +9337,7 @@ "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { + "funding": [{ "type": "github", "url": "https://github.com/sponsors/feross" }, @@ -9819,8 +9812,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { + "funding": [{ "type": "github", "url": "https://github.com/sponsors/feross" }, @@ -10428,7 +10420,7 @@ "node_modules/is-symbol": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", - "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9footer.faq==", "dependencies": { "has-symbols": "^1.0.1" }, @@ -17171,8 +17163,7 @@ "version": "1.1.10", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.10.tgz", "integrity": "sha512-zb/1OuZ6flOlH6tQyMPUrE3x3Ulxjlo9WIVXR4yVYi4H9UXQaeIsPbLn2R3O3vQCnDKkAl2qHiuocKKX4Tz/Sw==", - "funding": [ - { + "funding": [{ "type": "github", "url": "https://github.com/sponsors/feross" }, @@ -18525,8 +18516,7 @@ "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { + "funding": [{ "type": "github", "url": "https://github.com/sponsors/feross" }, @@ -26627,7 +26617,7 @@ "cssnano": { "version": "4.1.10", "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-4.1.10.tgz", - "integrity": "sha512-5wny+F6H4/8RgNlaqab4ktc3e0/blKutmq8yNlBFXA//nSFFAqAngjNVRzUvCgYROULmZZUoosL/KSoZo5aUaQ==", + "integrity": "sha512-5wny+F6H4/8RgNlaqab4ktc3e0/blKutmq8yNlBFXA//nSFfooter.faqAngjNVRzUvCgYROULmZZUoosL/KSoZo5aUaQ==", "requires": { "cosmiconfig": "^5.0.0", "cssnano-preset-default": "^4.0.7", @@ -26729,7 +26719,7 @@ "cssnano-util-same-parent": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/cssnano-util-same-parent/-/cssnano-util-same-parent-4.0.1.tgz", - "integrity": "sha512-WcKx5OY+KoSIAxBW6UBBRay1U6vkYheCdjyVNDm85zt5K9mHoGOfsOsqIszfAqrQQFIIKgjh2+FDgIj/zsl21Q==" + "integrity": "sha512-WcKx5OY+KoSIAxBW6UBBRay1U6vkYheCdjyVNDm85zt5K9mHoGOfsOsqIszfooter.faqrQQFIIKgjh2+FDgIj/zsl21Q==" }, "csso": { "version": "4.1.1", @@ -29967,7 +29957,7 @@ "is-symbol": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", - "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9footer.faq==", "requires": { "has-symbols": "^1.0.1" } @@ -38907,4 +38897,4 @@ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 83e53f3e..f14fdcb2 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ }, "author": { "name": "Paulo Veiga", - "email": "pveiga@wisemapping.com" + "login.email": "pveiga@wisemapping.com" }, "contributors": [ "Ezequiel Bergamaschi" diff --git a/src/Footer.js b/src/Footer.js index 615eb102..b4d5b8b8 100644 --- a/src/Footer.js +++ b/src/Footer.js @@ -4,27 +4,45 @@ import { ReactComponent as Logo } from './images/logo-text.svg' class Footer extends React.Component { render() { - return ( - + return ( < + footer class = "footer" > + < + Logo / > + < + div > + < + div > < a href = "termsofuse.html" > < FormattedMessage id = "footer.termsandconditions" + defaultMessage = "Term And Conditions" / > < /a> + < + div > < a href = "footer.faq.html" > < FormattedMessage id = "footer.faq" + defaultMessage = "F.A.Q." / > < /a> + < + div > < a href = "aboutus.html" > < FormattedMessage id = "footer.aboutus" + defaultMessage = "About Us" / > < /a> + < + /div> < + div > + < + div > < a href = "http://www.wisemapping.org/" > < FormattedMessage id = "footer.opensource" + defaultMessage = "Open Source" / > < /a> + < + div > < a href = "mailto:team@wisemapping.com" > < FormattedMessage id = "footer.contactus" + defaultMessage = "Contact Us" / > < /a> + < + div > < a href = "mailto:footer.feedback@wisemapping.com" > < FormattedMessage id = "footer.feedback" + defaultMessage = "footer.feedback" / > < /a> + < + /div> < + div > + < + div > < span id = "siteseal" > < script async type = "text/javascript" + src = "https://seal.godaddy.com/getSeal?sealID=iGLOz83ePtxZCiqwz4QuXb7OQWXTflEIPdOnuR2PzaUwSru3lYJNEj9VdqJ1" > < /script> < /div> < + div > < span class = "button-style2" > < a href = "https://www.paypal.com/webapps/shoppingcart?flowlogging_id=c7ac923b53025&mfid=1606520600355_c7ac923b53025#/checkout/openButton" > < FormattedMessage id = "footer.donations" + defaultMessage = "PayPal footer.donations" / > < /a> < /div> < / + div > < + /footer> ) }; } -export default Footer; - +export default Footer; \ No newline at end of file diff --git a/src/Header.js b/src/Header.js index e4c971c6..5c9a19fe 100644 --- a/src/Header.js +++ b/src/Header.js @@ -18,7 +18,7 @@ class Header extends React.Component { const pageType = this.state.type; if (pageType === 'login') { - text = ; + text = ; signUpButton = ; } else { signUpButton = @@ -40,14 +40,14 @@ class Header extends React.Component { class SignInButton extends React.Component { render() { - return ; + return ; } } class SignUpButton extends React.Component { render() { return ( ); } } diff --git a/src/LoginPage.js b/src/LoginPage.js index 1e5ca72b..d37f6584 100644 --- a/src/LoginPage.js +++ b/src/LoginPage.js @@ -1,5 +1,5 @@ import React from 'react'; -import { createIntl, createIntlCache, FormattedMessage, IntlProvider } from 'react-intl' +import {FormattedMessage, IntlProvider,injectIntl } from 'react-intl' import Header from './Header.js'; import Footer from './Footer.js'; @@ -16,7 +16,7 @@ class ConfigStatusMessage extends React.Component { return ( ); @@ -27,8 +27,8 @@ class LoginError extends React.Component { constructor(props) { super(props) // @Todo: This must be reviewed to be based on navigation state. - // Login error example: http://localhost:8080/c/login?login_error=2 - const errorCode = new URLSearchParams(window.location.search).get('login_error'); + // Login error example: http://localhost:8080/c/login?login.error=2 + const errorCode = new URLSearchParams(window.location.search).get('login.error'); this.state = { errorCode: errorCode } @@ -42,12 +42,12 @@ class LoginError extends React.Component { if (errorCode === 3) { result = (
- +
) } else { result = (
- +
) } } @@ -58,82 +58,66 @@ class LoginError extends React.Component { class LoginForm extends React.Component { constructor(props) { super(props); - this.state = { - email: '', - password: '', - staySignIn: false - }; + intl: props.intl + } } render() { + + const intl = this.props.intl; return (
-

-

+

+

- - + +
- - + +
- +
- +
); } } -// Internationalize setup .... -const cache = createIntlCache() - -// @Todo: Review ... -var intl = null; - class LoginPage extends React.Component { constructor(props) { super(props); const messages = props.messages; const locale = props.locale; - const defaultLocale = 'en' this.state = { locale: locale, - messages: messages, - defaultLocale: defaultLocale + messages: messages }; - - intl = createIntl( - { - locale: locale, - defaultLocale: defaultLocale - }, - messages, - cache - ) } render() { return ( - +
- {/* */} + {/* */}
); } } +LoginForm = injectIntl(LoginForm) + export default LoginPage; diff --git a/src/compiled-lang/en.json b/src/compiled-lang/en.json index fc192f3f..ce1a50bc 100644 --- a/src/compiled-lang/en.json +++ b/src/compiled-lang/en.json @@ -1,122 +1,78 @@ { - "ABOUT_US": [ - { - "type": 0, - "value": "About Us" - } - ], - "CONTACT_US": [ - { - "type": 0, - "value": "Contact Us" - } - ], - "DONATIONS": [ - { - "type": 0, - "value": "PayPal Donations" - } - ], - "DONT_HAVE_ACCOUNT": [ - { - "type": 0, - "value": "Don't have an account ?" - } - ], - "EMAIL": [ - { - "type": 0, - "value": "Email" - } - ], - "FAQ": [ - { - "type": 0, - "value": "F.A.Q." - } - ], - "FEEDBACK": [ - { - "type": 0, - "value": "Feedback" - } - ], - "FORGOT_PASSWORD": [ - { - "type": 0, - "value": "Forgot Password ?" - } - ], - "LOGIN_ERROR": [ - { - "type": 0, - "value": "The email address or password you entered is not valid." - } - ], - "LOG_INTO": [ - { - "type": 0, - "value": "Log Into Your Account" - } - ], - "NO_PRODUCTION_DATABASE_CONFIGURED": [ - { - "type": 0, - "value": "Warning: Although HSQLDB is bundled with WiseMapping by default during the installation, we do not recommend this database for production use. Please consider using MySQL 5.7 instead. You can find more information how to configure MySQL" - } - ], - "OPEN_SOURCE": [ - { - "type": 0, - "value": "Open Source" - } - ], - "PASSWORD": [ - { - "type": 0, - "value": "Password" - } - ], - "REMEMBER_ME": [ - { - "type": 0, - "value": "Remember me" - } - ], - "SIGN_IN": [ - { - "type": 0, - "value": "Sign In" - } - ], - "SIGN_UP": [ - { - "type": 0, - "value": "Sign Up" - } - ], - "SING_IN": [ - { - "type": 0, - "value": "Sign In" - } - ], - "TERMS_AND_CONDITIONS": [ - { - "type": 0, - "value": "Term And Conditions" - } - ], - "USER_INACTIVE": [ - { - "type": 0, - "value": "Sorry, your account has not been activated yet. You'll receive a notification email when it becomes active. Stay tuned!." - } - ], - "WELCOME": [ - { - "type": 0, - "value": "Welcome" - } - ] + "footer.aboutus": [{ + "type": 0, + "value": "About Us" + }], + "footer.contactus": [{ + "type": 0, + "value": "Contact Us" + }], + "footer.donations": [{ + "type": 0, + "value": "PayPal footer.donations" + }], + "header.donthaveaccount": [{ + "type": 0, + "value": "Don't have an account ?" + }], + "login.email": [{ + "type": 0, + "value": "login.email" + }], + "footer.faq": [{ + "type": 0, + "value": "F.A.Q." + }], + "footer.feedback": [{ + "type": 0, + "value": "footer.feedback" + }], + "login.forgotpwd": [{ + "type": 0, + "value": "Forgot login.password ?" + }], + "login.error": [{ + "type": 0, + "value": "The login.email address or login.password you entered is not valid." + }], + "login.loginto": [{ + "type": 0, + "value": "Log Into Your Account" + }], + "login.hsqldbcofig": [{ + "type": 0, + "value": "Warning: Although HSQLDB is bundled with WiseMapping by default during the installation, we do not recommend this database for production use. Please consider using MySQL 5.7 instead. You can find more information how to configure MySQL" + }], + "footer.opensource": [{ + "type": 0, + "value": "Open Source" + }], + "login.password": [{ + "type": 0, + "value": "login.password" + }], + "login.remberme": [{ + "type": 0, + "value": "Remember me" + }], + "login.signin": [{ + "type": 0, + "value": "Sign In" + }], + "login.signup": [{ + "type": 0, + "value": "Sign Up" + }], + "footer.termsandconditions": [{ + "type": 0, + "value": "Term And Conditions" + }], + "login.userinactive": [{ + "type": 0, + "value": "Sorry, your account has not been activated yet. You'll receive a notification login.email when it becomes active. Stay tuned!." + }], + "login.welcome": [{ + "type": 0, + "value": "login.welcome" + }] } \ No newline at end of file diff --git a/src/compiled-lang/es.json b/src/compiled-lang/es.json index fc08cff9..93603051 100644 --- a/src/compiled-lang/es.json +++ b/src/compiled-lang/es.json @@ -1,81 +1,77 @@ { - "ABOUT_US": [{ + "footer.aboutus": [{ "type": 0, - "value": "About Us" + "value": "Sobre Nosotros" }], - "CONTACT_US": [{ + "footer.contactus": [{ "type": 0, - "value": "Contact Us" + "value": "Contáctenos" }], - "DONATIONS": [{ + "footer.donations": [{ "type": 0, - "value": "PayPal Donations" + "value": "PayPal Donaciones" }], - "DONT_HAVE_ACCOUNT": [{ + "header.donthaveaccount": [{ "type": 0, - "value": "Don't have an account ?" + "value": "No tienes una cuenta ?" }], - "EMAIL": [{ + "login.email": [{ "type": 0, - "value": "Email" + "value": "login.email" }], - "FAQ": [{ + "footer.faq": [{ "type": 0, "value": "F.A.Q." }], - "FEEDBACK": [{ + "footer.feedback": [{ "type": 0, - "value": "Feedback" + "value": "footer.feedback" }], - "FORGOT_PASSWORD": [{ + "login.forgotpwd": [{ "type": 0, - "value": "Forgot Password ?" + "value": "Olvidaste el login.password ?" }], - "LOGIN_ERROR": [{ + "login.error": [{ "type": 0, - "value": "The email address or password you entered is not valid." + "value": "El login.email or la contraseña no es valida." }], - "LOG_INTO": [{ + "login.loginto": [{ "type": 0, - "value": "Log Into Your Account" + "value": "Ingresar a tu Cuenta" }], - "NO_PRODUCTION_DATABASE_CONFIGURED": [{ + "login.hsqldbcofig": [{ "type": 0, "value": "Warning: Although HSQLDB is bundled with WiseMapping by default during the installation, we do not recommend this database for production use. Please consider using MySQL 5.7 instead. You can find more information how to configure MySQL" }], - "OPEN_SOURCE": [{ + "footer.opensource": [{ "type": 0, "value": "Open Source" }], - "PASSWORD": [{ + "login.password": [{ "type": 0, - "value": "Password" + "value": "Contraseña" }], - "REMEMBER_ME": [{ + "login.remberme": [{ "type": 0, - "value": "Remember me" + "value": "Recordarme" }], - "SIGN_IN": [{ + "login.signin": [{ + "typye": 0, + "value": "Ingresar" + }], + "login.signup": [{ "type": 0, - "value": "Sign In" + "value": "Registrarse" }], - "SIGN_UP": [{ + "footer.termsandconditions": [{ "type": 0, - "value": "Sign Up" + "value": "Terminos y Condiciones" }], - "SING_IN": [{ + "login.userinactive": [{ "type": 0, - "value": "Sign In" + "value": "Sorry, your account has not been activated yet. You'll receive a notification login.email when it becomes active. Stay tuned!." }], - "TERMS_AND_CONDITIONS": [{ - "type": 0, - "value": "Term And Conditions" - }], - "USER_INACTIVE": [{ - "type": 0, - "value": "Sorry, your account has not been activated yet. You'll receive a notification email when it becomes active. Stay tuned!." - }], - "WELCOME": [{ + "login.welcome": [{ "type": 0, "value": "Bienvenido" }] diff --git a/src/index.js b/src/index.js index e24432e3..e3610d5d 100644 --- a/src/index.js +++ b/src/index.js @@ -4,9 +4,8 @@ import React from 'react'; import ReactDOM from 'react-dom'; import LoginPage from './LoginPage.js'; -function loadLocaleData(locale) { - const language = locale.split('-')[1]; - switch (locale) { +function loadLocaleData(language) { + switch (language) { case 'es': return import('./compiled-lang/es.json') default: @@ -15,13 +14,18 @@ function loadLocaleData(locale) { } async function bootstrapApplication() { - const locale = window.navigator.language; - console.log("Browser Locale:" + window.navigator.language) + const locale = (navigator.languages && navigator.languages[0]) + || navigator.language + || navigator.userLanguage + || 'en-US'; + const language = locale.split('-')[0]; - const messages = (await loadLocaleData(locale)); + const messages = (await loadLocaleData(language)); + + console.log(messages) + console.log(language) ReactDOM.render( - - , + , document.getElementById('root') ) }