Progress on i18n
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
import { StatusBar } from 'expo-status-bar';
|
import React, { useState } from 'react';
|
||||||
import React, { useState, useEffect } from 'react';
|
|
||||||
import { Text, View, StyleSheet, Image } from 'react-native';
|
import { Text, View, StyleSheet, Image } from 'react-native';
|
||||||
import { TextInput, Button } from 'react-native-paper';
|
import { TextInput, Button } from 'react-native-paper';
|
||||||
import API from './../API.js';
|
import API from './../API.js';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import GlobalState from '../contexts/GlobalState.js';
|
import i18n from "../i18nMessages.js";
|
||||||
|
|
||||||
|
|
||||||
let LoginForm = () => {
|
let LoginForm = () => {
|
||||||
@@ -13,12 +12,12 @@ let LoginForm = () => {
|
|||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
|
|
||||||
const loginCall = async ()=>{
|
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({
|
if (r.status === "ok") return navigation.reset({
|
||||||
index: 0,
|
index: 0,
|
||||||
routes: [{ name: 'MainNavigation' }],
|
routes: [{ name: 'MainNavigation' }],
|
||||||
});
|
});
|
||||||
alert('Please review the information')
|
alert(i18n.t('message.wrongInformation'))
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -28,13 +27,13 @@ let LoginForm = () => {
|
|||||||
source={require('./../assets/icon.png')}
|
source={require('./../assets/icon.png')}
|
||||||
/>
|
/>
|
||||||
<Text style={styles.header}>EMI Social</Text>
|
<Text style={styles.header}>EMI Social</Text>
|
||||||
<Text >Login</Text>
|
<Text >{i18n.t("message.login")}</Text>
|
||||||
<TextInput
|
<TextInput
|
||||||
style={styles.input}
|
style={styles.input}
|
||||||
onChangeText={text => setEmail(text)}
|
onChangeText={text => setEmail(text)}
|
||||||
defaultValue={email}
|
defaultValue={email}
|
||||||
placeholder="email"
|
placeholder="email"
|
||||||
label="email:"
|
label={i18n.t("message.email")}
|
||||||
autoCapitalize='none'
|
autoCapitalize='none'
|
||||||
autoComplete='email'
|
autoComplete='email'
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
@@ -46,7 +45,7 @@ let LoginForm = () => {
|
|||||||
defaultValue={password}
|
defaultValue={password}
|
||||||
placeholder="password"
|
placeholder="password"
|
||||||
textContentType="password"
|
textContentType="password"
|
||||||
label="password:"
|
label={i18n.t("message.password")}
|
||||||
secureTextEntry={true}
|
secureTextEntry={true}
|
||||||
autoCapitalize='none'
|
autoCapitalize='none'
|
||||||
autoComplete='email'
|
autoComplete='email'
|
||||||
@@ -58,7 +57,7 @@ let LoginForm = () => {
|
|||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
await loginCall();
|
await loginCall();
|
||||||
}}
|
}}
|
||||||
>submit</Button>
|
>{i18n.t("message.submit")}</Button>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ let NewComment = ({ postid, newComentAdded }) => {
|
|||||||
style={{
|
style={{
|
||||||
flex: 8,
|
flex: 8,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
|
backgroundColor: "white",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<View style={{
|
<View style={{
|
||||||
|
|||||||
@@ -83,18 +83,19 @@ let NewPost = ({ profileid, newPostCB }) => {
|
|||||||
return (
|
return (
|
||||||
<View style={styles.newPost}>
|
<View style={styles.newPost}>
|
||||||
<TextInput
|
<TextInput
|
||||||
label="New Post"
|
label={i18n.t("message.statusUpdate")}
|
||||||
value={postContent}
|
value={postContent}
|
||||||
onChangeText={setPostContent}
|
onChangeText={setPostContent}
|
||||||
mode="outlined"
|
mode="outlined"
|
||||||
multiline={true}
|
multiline={true}
|
||||||
|
numberOfLines={3}
|
||||||
/>
|
/>
|
||||||
{
|
{
|
||||||
postContent ? (
|
postContent ? (
|
||||||
<>
|
<>
|
||||||
<View style={{ flexDirection: "row", justifyContent: 'flex-end' }}>
|
<View style={{ flexDirection: "row", justifyContent: 'flex-end' }}>
|
||||||
<Button icon="add-a-photo" mode="outlined" onPress={pickImage} ></Button>
|
<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>
|
</View>
|
||||||
{photo && (
|
{photo && (
|
||||||
<View>
|
<View>
|
||||||
@@ -122,6 +123,7 @@ export default NewPost;
|
|||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
newPost: {
|
newPost: {
|
||||||
margin: 10
|
margin: 10,
|
||||||
|
padding: 10,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -59,6 +59,8 @@ const messages = {
|
|||||||
searchUsers: "Search Users",
|
searchUsers: "Search Users",
|
||||||
searchCourses: "Search Courses",
|
searchCourses: "Search Courses",
|
||||||
news: "News",
|
news: "News",
|
||||||
|
wrongInformation: "Please review the information.",
|
||||||
|
submit: "Submit"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
es: {
|
es: {
|
||||||
@@ -116,6 +118,8 @@ const messages = {
|
|||||||
searchUsers: "Busca Usuarios",
|
searchUsers: "Busca Usuarios",
|
||||||
searchCourses: "Busca Cursos",
|
searchCourses: "Busca Cursos",
|
||||||
news: "Noticias",
|
news: "Noticias",
|
||||||
|
wrongInformation: "Por favor revisa la información introducida.",
|
||||||
|
submit: "Ingresar",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user