Add compiled messages

This commit is contained in:
Paulo Gustavo Veiga 2020-11-28 09:50:35 -08:00
parent da3f1d00ec
commit 4cf2ee9b17
10 changed files with 294 additions and 18 deletions

View File

@ -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":531,"mtime":1606582877518,"results":"8","hashOfConfig":"6"},{"size":4184,"mtime":1606583450721,"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"]
[{"/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":702,"mtime":1606586450512,"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":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"]

View File

@ -71,4 +71,9 @@ This section has moved here: [https://facebook.github.io/create-react-app/docs/t
# Generate I18n resource
npm run extract -- 'src/*.js' --out-file src/lang/en.json
## Extract
npm run extract -- 'src/*.js' --out-file lang/en.json
## Compile
npm run compile -- lang/en.json --ast --out-file src/compiled-lang/en.json
npm run compile -- lang/es.json --ast --out-file src/compiled-lang/es.json

63
lang/en.json Normal file
View File

@ -0,0 +1,63 @@
{
"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"
}
}

View File

@ -58,6 +58,6 @@
"defaultMessage": "Sorry, your account has not been activated yet. You'll receive a notification email when it becomes active. Stay tuned!."
},
"WELCOME": {
"defaultMessage": "Welcome"
"defaultMessage": "Bienvenido"
}
}

BIN
public/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -104,16 +104,18 @@ class LoginPage extends React.Component {
const messages = props.messages;
const locale = props.locale;
const defaultLocale = 'en'
this.state = {
locale: locale,
message: messages
messages: messages,
defaultLocale: defaultLocale
};
intl = createIntl(
{
locale: locale,
defaultLocale: 'en'
defaultLocale: defaultLocale
},
messages,
cache
@ -122,7 +124,7 @@ class LoginPage extends React.Component {
render() {
return (
<IntlProvider locale={this.state.locale} defaultLocale="en" messages={this.state.messages}>
<IntlProvider locale={this.state.locale} defaultLocale={this.state.defaultLocale} messages={this.state.messages}>
<div>
<Header type='login' />
<LoginForm />

122
src/compiled-lang/en.json Normal file
View File

@ -0,0 +1,122 @@
{
"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"
}
]
}

82
src/compiled-lang/es.json Normal file
View File

@ -0,0 +1,82 @@
{
"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": "Bienvenido"
}]
}

View File

@ -6,19 +6,26 @@ import LoginPage from './LoginPage.js';
function loadLocaleData(locale) {
switch (locale) {
case 'en':
return import('./lang/es.json')
case 'es':
return import('./compiled-lang/es.json')
default:
return import('./lang/es.json')
return import('./compiled-lang/en.json')
}
}
async function bootstrapApplication(locale) {
const messages = loadLocaleData(locale);
async function bootstrapApplication() {
const locale = window.navigator.language;
console.log("Browser Locale:" + window.navigator.language)
const messages = loadLocaleData(locale);
console.log("loadLocaleData:" + toString(messages))
ReactDOM.render(
<LoginPage locale={locale} messages={messages}/>
<LoginPage locale={locale} messages={messages} />
,
document.getElementById('root')
)
}
bootstrapApplication('en')
bootstrapApplication()

View File

@ -1,5 +0,0 @@
{
"FORGOT_PASSWORD": {
"defaultMessage": "Olvido Password"
}
}