From dc4f3fa4ffe4d8de9c75b845452f1e97c75beaee Mon Sep 17 00:00:00 2001 From: Lorenzo Trujillo Date: Tue, 23 Apr 2024 17:06:16 -0600 Subject: [PATCH 01/18] =?UTF-8?q?Se=20elimin=C3=B3=20el=20header=20de=20la?= =?UTF-8?q?=20pantalla=20que=20muestra=20una=20actividad?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/state/[stateId]/town/[townId]/activity/_layout.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mobile/app/state/[stateId]/town/[townId]/activity/_layout.tsx b/mobile/app/state/[stateId]/town/[townId]/activity/_layout.tsx index 02fde054..496d7769 100644 --- a/mobile/app/state/[stateId]/town/[townId]/activity/_layout.tsx +++ b/mobile/app/state/[stateId]/town/[townId]/activity/_layout.tsx @@ -8,6 +8,11 @@ export default function ActivitySelectionScreen() { headerShown: false } } /> + ); } \ No newline at end of file -- GitLab From c04c94f5ec4f58b1584651841955416ad4f653af Mon Sep 17 00:00:00 2001 From: Lorenzo Trujillo Date: Tue, 23 Apr 2024 17:07:00 -0600 Subject: [PATCH 02/18] =?UTF-8?q?Se=20cre=C3=B3=20el=20objeto=20que=20defi?= =?UTF-8?q?ne=20la=20estructura=20de=20un=20lenguaje?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile/src/lang/lang.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 mobile/src/lang/lang.ts diff --git a/mobile/src/lang/lang.ts b/mobile/src/lang/lang.ts new file mode 100644 index 00000000..22dd3943 --- /dev/null +++ b/mobile/src/lang/lang.ts @@ -0,0 +1,30 @@ +export interface Lang { + loginScreen:{ + title: string; + loginButton: string; + registerButton: string; + }, + registerScreen:{ + title: string; + loginButton: string; + registerButton: string; + }, + forms : { + email: string; + password: string; + confirmPassword: string; + name: string; + lastName: string; + dateOfBirth: string; + }, + formsErrors : { + invalidEmailFormat: string; + requiredField: string; + passwordNotMatch: string; + emailAlreadyInUse: string; + }, + common : { + or: string; + } +} + \ No newline at end of file -- GitLab From 4dbbea0a496a2dea20d90e765f006e351ee2117f Mon Sep 17 00:00:00 2001 From: Lorenzo Trujillo Date: Tue, 23 Apr 2024 17:07:28 -0600 Subject: [PATCH 03/18] =?UTF-8?q?Se=20crearon=20las=20etiquetas=20parciale?= =?UTF-8?q?s=20del=20lenguaje=20ingles=20y=20espa=C3=B1ol?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile/src/lang/english_lang.ts | 31 +++++++++++++++++++++++++++++++ mobile/src/lang/spanish_lang.ts | 31 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 mobile/src/lang/english_lang.ts create mode 100644 mobile/src/lang/spanish_lang.ts diff --git a/mobile/src/lang/english_lang.ts b/mobile/src/lang/english_lang.ts new file mode 100644 index 00000000..991949b7 --- /dev/null +++ b/mobile/src/lang/english_lang.ts @@ -0,0 +1,31 @@ +import { Lang } from "./lang"; + +export const ENGLISH_LANG: Lang = { + loginScreen:{ + title: "Login", + loginButton: "Login", + registerButton: "Register", + }, + registerScreen:{ + title: "Register", + loginButton: "Login", + registerButton: "Register", + }, + forms : { + email: "Email", + password: "Password", + confirmPassword: "Confirm password", + name: "Name", + lastName: "Last name", + dateOfBirth: "Date of birth", + }, + formsErrors : { + invalidEmailFormat: "Invalid email format", + requiredField: "Required field", + passwordNotMatch: "Passwords do not match", + emailAlreadyInUse: "Email already in use", + }, + common : { + or: "or", + } +} \ No newline at end of file diff --git a/mobile/src/lang/spanish_lang.ts b/mobile/src/lang/spanish_lang.ts new file mode 100644 index 00000000..9c7eb5fc --- /dev/null +++ b/mobile/src/lang/spanish_lang.ts @@ -0,0 +1,31 @@ +import { Lang } from "./lang"; + +export const SPANISH_LANG: Lang = { + loginScreen:{ + title: "Iniciar sesión", + loginButton: "Iniciar sesión", + registerButton: "Registrarse", + }, + registerScreen:{ + title: "Registrarse", + loginButton: "Iniciar sesión", + registerButton: "Registrarse", + }, + forms : { + email: "Correo electrónico", + password: "Contraseña", + confirmPassword: "Confirmar contraseña", + name: "Nombre", + lastName: "Apellido", + dateOfBirth: "Fecha de nacimiento", + }, + formsErrors : { + invalidEmailFormat: "Formato de correo electrónico inválido", + requiredField: "Campo requerido", + passwordNotMatch: "Las contraseñas no coinciden", + emailAlreadyInUse: "Correo electrónico ya en uso", + }, + common : { + or: "o", + } +}; \ No newline at end of file -- GitLab From c60472bf35a40a0fba7863fe16da0421e15b20f8 Mon Sep 17 00:00:00 2001 From: Lorenzo Trujillo Date: Tue, 23 Apr 2024 17:08:56 -0600 Subject: [PATCH 04/18] =?UTF-8?q?Se=20cre=C3=B3=20el=20objeto=20que=20prov?= =?UTF-8?q?isionalmente=20provee=20los=20lenguajes=20disponibles=20a=20la?= =?UTF-8?q?=20aplicaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile/src/lang/translations.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 mobile/src/lang/translations.ts diff --git a/mobile/src/lang/translations.ts b/mobile/src/lang/translations.ts new file mode 100644 index 00000000..a21b25e3 --- /dev/null +++ b/mobile/src/lang/translations.ts @@ -0,0 +1,18 @@ +import { ENGLISH_LANG } from "./english_lang"; +import { SPANISH_LANG } from "./spanish_lang"; +import { I18n } from 'i18n-js'; + +const translations = { + en : ENGLISH_LANG, + es : SPANISH_LANG +} + +const LANG = new I18n(translations); + +LANG.locale = 'es'; + +LANG.enableFallback = true; + +export { LANG }; + + -- GitLab From cb5ceb363dbe627708d628244e1ca641fa29b539 Mon Sep 17 00:00:00 2001 From: Lorenzo Trujillo Date: Tue, 23 Apr 2024 17:10:58 -0600 Subject: [PATCH 05/18] =?UTF-8?q?Se=20actualiz=C3=B3=20el=20lenguaje=20act?= =?UTF-8?q?ual=20de=20la=20aplicaci=C3=B3n=20en=20la=20pantalla=20de=20log?= =?UTF-8?q?in?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../language_icon/language_icon.tsx | 23 +++++++++++++++++++ .../src/components/login_form/login_form.tsx | 9 ++++---- .../components/or_division/or_division.tsx | 3 ++- mobile/src/screens/login/login_page.tsx | 4 +++- 4 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 mobile/src/components/language_icon/language_icon.tsx diff --git a/mobile/src/components/language_icon/language_icon.tsx b/mobile/src/components/language_icon/language_icon.tsx new file mode 100644 index 00000000..657cb320 --- /dev/null +++ b/mobile/src/components/language_icon/language_icon.tsx @@ -0,0 +1,23 @@ +import { Entypo } from '@expo/vector-icons'; +import { TouchableOpacity } from 'react-native-gesture-handler'; +import { LANG } from '../../lang/translations'; + +export const LanguageIcon = () => { + const changeLanguage = () => { + if (LANG.locale === 'es') { + // Change to english RTL + LANG.locale = 'en'; + + + } + else { + LANG.locale = 'es'; + } + } + + return ( + + + + ); +} \ No newline at end of file diff --git a/mobile/src/components/login_form/login_form.tsx b/mobile/src/components/login_form/login_form.tsx index 39eb15fa..1dd04ee7 100644 --- a/mobile/src/components/login_form/login_form.tsx +++ b/mobile/src/components/login_form/login_form.tsx @@ -4,6 +4,7 @@ import { CustomTextInput } from "../text_input/text_input"; import { LIGTHT_THEME } from "../../constants/theme"; import { LoginFormValues } from "../../hooks/useLoggin"; import { OrDivision } from "../or_division/or_division"; +import { LANG } from "../../lang/translations"; interface LoginFormProps { control: Control; @@ -13,7 +14,7 @@ interface LoginFormProps { export const LoginForm = ({ control, onSubmit }: LoginFormProps) => { return ( - Login + {LANG.t('loginScreen.title')} { formState: { errors }, }) => ( { formState: { errors }, }) => ( { /> - Login + {LANG.t('loginScreen.loginButton')} diff --git a/mobile/src/components/or_division/or_division.tsx b/mobile/src/components/or_division/or_division.tsx index 95430d93..af51421b 100644 --- a/mobile/src/components/or_division/or_division.tsx +++ b/mobile/src/components/or_division/or_division.tsx @@ -1,10 +1,11 @@ import { View, Text, StyleSheet } from "react-native"; import { LIGTHT_THEME } from "../../constants/theme"; +import { LANG } from "../../lang/translations"; export const OrDivision = () => { return ( - OR + {LANG.t('common.or')} ); }; diff --git a/mobile/src/screens/login/login_page.tsx b/mobile/src/screens/login/login_page.tsx index 385cb637..68dacfb0 100644 --- a/mobile/src/screens/login/login_page.tsx +++ b/mobile/src/screens/login/login_page.tsx @@ -3,6 +3,8 @@ import { LoginForm } from "../../components/login_form/login_form"; import { useLoggin } from "../../hooks/useLoggin"; import { LIGTHT_THEME } from "../../constants/theme"; import { router } from "expo-router"; +import { LANG } from "../../lang/translations"; +import { LanguageIcon } from "../../components/language_icon/language_icon"; const loginImage = require("../../../assets/login-image.jpg"); export const LoginPage = () => { @@ -18,7 +20,7 @@ export const LoginPage = () => { -