-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
221 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Change the IP address to that of your ESP device to enable local development of the UI. | ||
# Remember to also enable CORS in platformio.ini before uploading the code to the device. | ||
REACT_APP_HTTP_ROOT=http://192.168.0.88 | ||
REACT_APP_WEB_SOCKET_ROOT=ws://192.168.0.88 | ||
REACT_APP_HTTP_ROOT=http://192.168.0.7 | ||
REACT_APP_WEB_SOCKET_ROOT=ws://192.168.0.7 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React, { Component } from 'react'; | ||
import { createIntl, createIntlCache, RawIntlProvider } from 'react-intl'; | ||
import { messages } from './messages'; | ||
|
||
const defaultLocale = "es"; | ||
|
||
const cache = createIntlCache() | ||
|
||
export const intl = createIntl({ | ||
locale: defaultLocale, | ||
defaultLocale: defaultLocale, | ||
messages: messages[defaultLocale] | ||
}, cache) | ||
|
||
interface LanguageWrapperState { | ||
locale: string; | ||
}; | ||
|
||
class I18n extends Component<{}, LanguageWrapperState> { | ||
|
||
state: LanguageWrapperState = { locale: defaultLocale }; | ||
|
||
// load locale from local storage here | ||
componentDidMount = () => { | ||
|
||
} | ||
|
||
selectLanguage = (locale: string) => { | ||
intl.locale = locale; | ||
intl.messages = messages[locale]; | ||
this.setState({ locale }) | ||
} | ||
|
||
render() { | ||
const { locale } = this.state; | ||
return ( | ||
<RawIntlProvider key={locale} value={intl}> | ||
{this.props.children} | ||
</RawIntlProvider> | ||
); | ||
} | ||
|
||
} | ||
|
||
export default I18n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { merge } from 'lodash'; | ||
import { signInMessages } from '../messages'; | ||
import { projectMessages } from '../project/messages'; | ||
|
||
export const messages: Record<string, Record<string, string>> = merge( | ||
signInMessages, | ||
projectMessages | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export const signInMessages: Record<string, Record<string, string>> = { | ||
es: { | ||
"signIn.invalidCredentials": "Credenciales no válidas", | ||
"signIn.invalidStatusCode": "Codigo invalido: {code}", | ||
"signIn.password": "Contraseña", | ||
"signIn.passwordRequired": "Se requiere contraseña", | ||
"signIn.signIn": "Registrarse", | ||
"signIn.username": "Nombre de usuario", | ||
"signIn.usernameRequired": "Se requiere nombre de usuario" | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.