Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

21 app application internationalization and localization #256

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
cf93840
Init internationalization library in project
RubenFern Apr 11, 2024
adfd6ad
Added navbar in login and register for change language
RubenFern Apr 11, 2024
425a0a6
add library for flags icon
RubenFern Apr 11, 2024
141d37b
add icon translate for change app language
RubenFern Apr 11, 2024
3a6e135
refactoring components navbar
RubenFern Apr 11, 2024
01c7d57
refactoring settings icon
RubenFern Apr 11, 2024
bba4ba3
css added for mark language active
RubenFern Apr 11, 2024
3270e75
fixed warning
RubenFern Apr 11, 2024
9d2da18
internationalization login implemented
RubenFern Apr 11, 2024
39e548e
internationalization register implemented
RubenFern Apr 11, 2024
5e7d8de
internationalization nav and home screens
RubenFern Apr 12, 2024
8cc2b44
fixing tests
RubenFern Apr 13, 2024
26faff2
fixed tests
RubenFern Apr 13, 2024
ee8d10c
fixed conflicts
RubenFern Apr 14, 2024
eda2662
fixed conflicts
RubenFern Apr 14, 2024
50883af
fixed conflicts
RubenFern Apr 14, 2024
96dc5e3
fixed webapp tests
RubenFern Apr 14, 2024
7ad455b
add import i18n to tests
RubenFern Apr 14, 2024
38492ad
fixing tests
RubenFern Apr 14, 2024
0bdcf20
fixing tests
RubenFern Apr 14, 2024
3e0c664
fixing tests
RubenFern Apr 14, 2024
3f0040e
fixing tests
RubenFern Apr 14, 2024
5c59706
new mock add
RubenFern Apr 14, 2024
9a15459
new mock add
RubenFern Apr 14, 2024
9d8912b
move lang to nav
RubenFern Apr 14, 2024
9283d68
move lang to nav
RubenFern Apr 14, 2024
03390fa
remove lang from nav tests
RubenFern Apr 14, 2024
6d1d2b7
add import useState
RubenFern Apr 14, 2024
3c6e162
fixed import in nav
RubenFern Apr 14, 2024
1f47208
fixed import in nav
RubenFern Apr 14, 2024
8da6576
fixed many things
RubenFern Apr 14, 2024
68e40f4
Fixed code duplication (I think)
Manueluz Apr 16, 2024
25d26c5
Fixed code duplication (I think) (again)
Manueluz Apr 16, 2024
1dcafbf
Merge branch 'develop' into 21-app-application-internationalization-a…
RubenFern Apr 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.2",
"axios": "^1.6.5",
"flag-icons": "^7.2.1",
"history": "^5.3.0",
"i18next": "^23.11.1",
"i18next-browser-languagedetector": "^7.2.1",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^14.1.0",
"react-native": "^0.73.5",
"react-router-dom": "^6.21.3",
"react-scripts": "5.0.1",
Expand Down
1 change: 1 addition & 0 deletions webapp/src/components/game/Game.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {render, screen, fireEvent, act, waitFor} from '@testing-library/react';
import '@testing-library/jest-dom';
import {Game} from './Game';
import { MemoryRouter, Route } from 'react-router-dom';
import "../../i18n";

jest.mock('../../services/game.service', () => ({
startNewGame: () => Promise.resolve(""),
Expand Down
1 change: 1 addition & 0 deletions webapp/src/components/game/SuddenDeath.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {SuddenDeath} from './SuddenDeath';
import Game from "./Game";
import { MemoryRouter, Route } from 'react-router-dom';
import * as router from "react-router";
import "../../i18n";

jest.mock('../../services/game.service', () => ({
startNewGame: () => Promise.resolve(""),
Expand Down
1 change: 1 addition & 0 deletions webapp/src/components/history/History.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { render, screen, act, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom';
import {History} from './History';
import { MemoryRouter } from 'react-router-dom';
import "../../i18n";

jest.mock('../../services/user.service', () => ({
getHistory: () => Promise.resolve(
Expand Down
43 changes: 22 additions & 21 deletions webapp/src/components/home/Home.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import React, { useEffect, useState } from 'react';
import {Box, IconButton, Chip, Container, CssBaseline, Modal, Typography} from "@mui/material";
import CancelIcon from "@mui/icons-material/Cancel";
import { useTranslation } from "react-i18next";

import './Home.css';
import { getCurrentUser } from "../../services/user.service";
import bannerDark from '../../media/wiq_banner.png';
import bannerLight from '../../media/wiq_banner.light.png';
import { Nav } from '../nav/Nav';
import './Home.css';
import {useNavigate} from "react-router-dom";
import CancelIcon from "@mui/icons-material/Cancel";
import {getTags} from "../../services/question.service";
import {useNavigate} from "react-router-dom";
import bannerDark from '../../media/wiq_banner.png';
import bannerLight from '../../media/wiq_banner.light.png';

export const Home = () =>
{
const { t } = useTranslation();

const [loggedIn, setLoggedIn] = useState(true);
const [username, setUsername] = useState("No identificado");
const [tagSelection, setTagSelection] = useState(false);
Expand Down Expand Up @@ -114,57 +118,54 @@ export const Home = () =>
<img src={bannerDark} alt="WiQ" className="hidden dark:block"/>

<div className="flex p-4 place-content-between ">

<Typography className="text-black dark:text-white " component="h2" variant="h4"
fontFamily="monospace" fontWeight="bold" alignSelf="center">
Home
{ t('Home.home') }
</Typography>

<Typography className="text-black dark:text-white " component="h3" variant="h5"
fontFamily="monospace" alignSelf="center">
¡Bienvenido, {username}!
{ t('Home.welcome', { name: username }) }
</Typography>

</div>

<div className="p-2 m-1">
<Typography component="h3" variant="h6" fontFamily="monospace" fontWeight="bold"
alignSelf="center" className="text-black dark:text-white ">
Cómo jugar
{ t('Home.howToPlay') }
</Typography>
<Typography component="p" variant="p" className="text-black dark:text-white ">
Cuando pulses en el botón de jugar, se te irán mostrando preguntas junto con 4 posibles
respuestas, sólo una de ellas es verdadera, haz click sobre la respuesta correcta para
ganar puntos.
{ t('Home.tutorialP1') }
</Typography>
<Typography component="p" variant="p" className="text-black dark:text-white ">
El tiempo para contestar es limitado. La barra en la parte inferior muestra el tiempo
restante. Si el tiempo se termina, la pregunta contará como fallada y se pasará a la
siguiente.
{ t('Home.tutorialP2') }
</Typography>
<Typography component="p" variant="h6" fontFamily="monospace" fontWeight="bold"
className="text-center p-3 text-black dark:text-white ">
¡Mucha suerte y demuestra lo que sabes!
{ t('Home.goodLuck') }
</Typography>
</div>
<div className="flex align-middle justify-center flex-grow m-3">
<button onClick={startGame} className="bg-gradient-to-r
from-cyan-50 via-cyan-300 to blue-500
dark:from-orange-500 dark:via-purple-500 dark:to-pink-500
buttonGradient">
<span className="text-black dark:text-white text">JUGAR CLÁSICO</span>
</button>
<span className="text-black dark:text-white text">{ t('Home.playClassic') }</span>
</button>
</div>
<div className="flex align-middle justify-center flex-grow">
<div className="flex align-middle justify-center flex-grow m-3">
<button onClick={startSuddenDeath} className="bg-gradient-to-r
from-cyan-50 via-cyan-300 to blue-500
dark:from-orange-500 dark:via-purple-500 dark:to-pink-500
buttonGradient">
<span className="text-black dark:text-white text">JUGAR MUERTE SÚBITA</span>
<span className="text-black dark:text-white text">{ t('Home.playSuddenDeath') }</span>
</button>
</div>
<div className="flex align-middle justify-center flex-grow m-3">
<button onClick={openTagSelection} className="buttonGradient">
<span className="text-black dark:text-white ">Elige las tags</span>
<span className="text-black dark:text-white ">{ t('Home.chooseTags') }</span>
</button>

</div>
Expand Down Expand Up @@ -197,7 +198,7 @@ export const Home = () =>
<Typography component="h3" variant="h2" className="text-black dark:text-white">
Tags
</Typography>
<p className="text-black dark:text-white">Con las tags puedes seleccionar las categorías sobre las que quieres ser preguntado.</p>
<p className="text-black dark:text-white">{ t('Home.infoTags') }</p>
<div id="tagBox">
{tags.map((tag) =>
<Chip
Expand Down
2 changes: 2 additions & 0 deletions webapp/src/components/home/Home.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { createMemoryHistory } from 'history';
import { MemoryRouter, BrowserRouter as Router, useLocation } from 'react-router-dom';
import { Home } from './Home';
import * as router from 'react-router';
import '../../i18n';


jest.mock('../../services/user.service', () => ({
getCurrentUser: () => {
Expand Down
Loading