Progress on i18n
This commit is contained in:
@@ -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')}
|
||||
/>
|
||||
<Text style={styles.header}>EMI Social</Text>
|
||||
<Text >Login</Text>
|
||||
<Text >{i18n.t("message.login")}</Text>
|
||||
<TextInput
|
||||
style={styles.input}
|
||||
onChangeText={text => 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</Button>
|
||||
>{i18n.t("message.submit")}</Button>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ let NewComment = ({ postid, newComentAdded }) => {
|
||||
style={{
|
||||
flex: 8,
|
||||
fontSize: 12,
|
||||
backgroundColor: "white",
|
||||
}}
|
||||
/>
|
||||
<View style={{
|
||||
|
||||
@@ -83,18 +83,19 @@ let NewPost = ({ profileid, newPostCB }) => {
|
||||
return (
|
||||
<View style={styles.newPost}>
|
||||
<TextInput
|
||||
label="New Post"
|
||||
label={i18n.t("message.statusUpdate")}
|
||||
value={postContent}
|
||||
onChangeText={setPostContent}
|
||||
mode="outlined"
|
||||
multiline={true}
|
||||
numberOfLines={3}
|
||||
/>
|
||||
{
|
||||
postContent ? (
|
||||
<>
|
||||
<View style={{ flexDirection: "row", justifyContent: 'flex-end' }}>
|
||||
<Button icon="add-a-photo" mode="outlined" onPress={pickImage} ></Button>
|
||||
<Button icon="send" mode="outlined" onPress={handleNewPostButton}>Post</Button>
|
||||
<Button icon="send" mode="outlined" onPress={handleNewPostButton}>{i18n.t("message.post")}</Button>
|
||||
</View>
|
||||
{photo && (
|
||||
<View>
|
||||
@@ -122,6 +123,7 @@ export default NewPost;
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
newPost: {
|
||||
margin: 10
|
||||
margin: 10,
|
||||
padding: 10,
|
||||
}
|
||||
});
|
||||
@@ -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",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user