From fc8056bd9258fdbcd654fcf790d9f26d31b12d23 Mon Sep 17 00:00:00 2001 From: Adolfo Reyna Date: Thu, 22 Dec 2022 10:51:00 -0500 Subject: [PATCH] Progress on i18n --- components/Login.js | 17 ++++++++--------- components/NewComment.js | 1 + components/NewPost.js | 8 +++++--- i18nMessages.js | 4 ++++ 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/components/Login.js b/components/Login.js index 219b49c..14bdf8c 100644 --- a/components/Login.js +++ b/components/Login.js @@ -1,10 +1,9 @@ -import { StatusBar } from 'expo-status-bar'; -import React, { useState, useEffect } from 'react'; +import React, { useState } from 'react'; import { Text, View, StyleSheet, Image } from 'react-native'; import { TextInput, Button } from 'react-native-paper'; import API from './../API.js'; import { useNavigation } from '@react-navigation/native'; -import GlobalState from '../contexts/GlobalState.js'; +import i18n from "../i18nMessages.js"; let LoginForm = () => { @@ -13,12 +12,12 @@ let LoginForm = () => { const navigation = useNavigation(); const loginCall = async ()=>{ - let r = await API.logIn(email, password); + let r = await API.logIn(email.trim(), password); if (r.status === "ok") return navigation.reset({ index: 0, routes: [{ name: 'MainNavigation' }], }); - alert('Please review the information') + alert(i18n.t('message.wrongInformation')) }; return ( @@ -28,13 +27,13 @@ let LoginForm = () => { source={require('./../assets/icon.png')} /> EMI Social - Login + {i18n.t("message.login")} setEmail(text)} defaultValue={email} placeholder="email" - label="email:" + label={i18n.t("message.email")} autoCapitalize='none' autoComplete='email' autoCorrect={false} @@ -46,7 +45,7 @@ let LoginForm = () => { defaultValue={password} placeholder="password" textContentType="password" - label="password:" + label={i18n.t("message.password")} secureTextEntry={true} autoCapitalize='none' autoComplete='email' @@ -58,7 +57,7 @@ let LoginForm = () => { onPress={async () => { await loginCall(); }} - >submit + >{i18n.t("message.submit")} ); } diff --git a/components/NewComment.js b/components/NewComment.js index ae437f0..100249e 100644 --- a/components/NewComment.js +++ b/components/NewComment.js @@ -22,6 +22,7 @@ let NewComment = ({ postid, newComentAdded }) => { style={{ flex: 8, fontSize: 12, + backgroundColor: "white", }} /> { return ( { postContent ? ( <> - + {photo && ( @@ -122,6 +123,7 @@ export default NewPost; const styles = StyleSheet.create({ newPost: { - margin: 10 + margin: 10, + padding: 10, } }); \ No newline at end of file diff --git a/i18nMessages.js b/i18nMessages.js index a7a57ed..157ee39 100644 --- a/i18nMessages.js +++ b/i18nMessages.js @@ -59,6 +59,8 @@ const messages = { searchUsers: "Search Users", searchCourses: "Search Courses", news: "News", + wrongInformation: "Please review the information.", + submit: "Submit" }, }, es: { @@ -116,6 +118,8 @@ const messages = { searchUsers: "Busca Usuarios", searchCourses: "Busca Cursos", news: "Noticias", + wrongInformation: "Por favor revisa la información introducida.", + submit: "Ingresar", }, } }