Merge pull request 'Traduction fr-en' (#6) from Login2 into master

Reviewed-on: #6
pull/13/head
Leni BEAULATON 2 months ago
commit baea721171

@ -30,8 +30,8 @@ class MainActivity : ComponentActivity() {
)
}
}
AppNavigator() // Accès à la page login et SingUp (pour le moment)
//ProfilPage() //Accès à la page profil
//AppNavigator() // Accès à la page login et SingUp (pour le moment)
ProfilPage() //Accès à la page profil
}
}
}

@ -35,6 +35,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
@ -46,6 +47,8 @@ import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import com.example.what_the_fantasy.R
@Composable
fun LoginPage(navController : NavController) {
@ -71,13 +74,13 @@ fun LoginPage(navController : NavController) {
horizontalAlignment = Alignment.CenterHorizontally
) {
TitleLogin("Connexion au compte", 20,Color.White)
IdentifiantTextField("Identifiant*")
PassWdTextField("Mot de passe*")
TitlePage(R.string.titleLogin, 20,Color.White)
IdentifiantTextField(R.string.IdentifiantLogin)
PassWdTextField(R.string.PasswdLogin)
Space(16)
ConnexionButtonLogin("Connexion",18, Color.White, Color.Black)
ConnexionButtonLogin(R.string.ButtonLogin,18, Color.White, Color.Black)
Space(16)
CreateAccountButton("Créer un compte",12, Color.White, navController)
CreateAccountButton(R.string.ButtonCreateLogin,12, Color.White, navController)
}
}
@ -92,7 +95,8 @@ fun Space(height : Int){
@Composable
fun IdentifiantTextField(textIdentifiant : String){
fun IdentifiantTextField(textIdentifiantResId : Int){
val textIdentifiant = stringResource(id = textIdentifiantResId)
var identifiant by remember { mutableStateOf("") } // Stocke la valeur du champ
Column(modifier = Modifier.padding(top = 16.dp)) {
OutlinedTextField(
@ -109,7 +113,8 @@ fun IdentifiantTextField(textIdentifiant : String){
}
@Composable
fun PassWdTextField(textpasswd : String){
fun PassWdTextField(textpasswdResId : Int){
val textpasswd = stringResource(id = textpasswdResId)
var passwd by remember { mutableStateOf("") } // Stocke la valeur du champ
var passwordVisible by remember { mutableStateOf(false) } // État pour afficher/masquer
Column(modifier = Modifier.padding(top = 10.dp)) {
@ -132,7 +137,8 @@ fun PassWdTextField(textpasswd : String){
}
@Composable
fun TitleLogin(title : String, size : Int, color : Color){
fun TitlePage(titleResId : Int, size : Int, color : Color){
val title = stringResource(id = titleResId)
Text(
text = title,
fontSize = size.sp,
@ -142,7 +148,8 @@ fun TitleLogin(title : String, size : Int, color : Color){
}
@Composable
fun ConnexionButtonLogin(title : String, size : Int, colorButton : Color, colorText : Color){
fun ConnexionButtonLogin(titleResId : Int, size : Int, colorButton : Color, colorText : Color){
val title = stringResource(id = titleResId)
Button(
onClick = { /* Action */ },
colors = ButtonDefaults.buttonColors(containerColor = colorButton),
@ -154,7 +161,8 @@ fun ConnexionButtonLogin(title : String, size : Int, colorButton : Color, colorT
}
@Composable
fun CreateAccountButton(title : String, size : Int, color : Color, navController: NavController){
fun CreateAccountButton(titleResId : Int, size : Int, color : Color, navController: NavController){
val title = stringResource(id = titleResId)
Text(
text = title,
fontSize = size.sp,

@ -43,6 +43,7 @@ import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.ImeAction
@ -81,7 +82,7 @@ fun ProfilPage() {
) {
// Titre
TitleProfil("Profil", 20, Color.White)
TitleProfil(R.string.titleProfile, 20, Color.White)
SpaceProfil(16)
// Image de profil
@ -101,11 +102,11 @@ fun ProfilPage() {
SpaceProfil(16)
// Bouton
ButtonProfile("Ajouter une citation",18, Color.Black, Color.White)
ButtonProfile(R.string.ButtonAddQuoteprofile,18, Color.Black, Color.White)
SpaceProfil(16)
ButtonProfile("Langue",18, Color.Black, Color.White)
ButtonProfile(R.string.ButtonLanguageprofile,18, Color.Black, Color.White)
SpaceProfil(16)
ButtonProfile("Déconnexion", 18, Color.Black, Color.White)
ButtonProfile(R.string.ButtonUnlogprofile, 18, Color.Black, Color.White)
}
}
@ -121,7 +122,8 @@ fun SpaceProfil(height : Int){
@Composable
fun TitleProfil(title : String, size : Int, color : Color){
fun TitleProfil(titleResId : Int, size : Int, color : Color){
val title = stringResource(id = titleResId)
Text(
text = title,
fontSize = size.sp,
@ -174,8 +176,9 @@ fun EditEmail(){
isError = emailError // ✅ Afficher l'erreur si l'email est invalide
)
if (emailError) {
val text = stringResource(id = R.string.ErrorEmailprofile)
Text(
text = "Adresse e-mail invalide",
text = text,
color = Color.Red,
fontSize = 12.sp,
modifier = Modifier.padding(top = 4.dp)
@ -259,10 +262,11 @@ fun EditPasswd(){
var passwordError by remember { mutableStateOf(false) }
if (isEditingPassword) {
Column {
val text = stringResource(id = R.string.NewPasswdprofile)
OutlinedTextField(
value = newPassword,
onValueChange = { newPassword = it },
label = { Text("Nouveau mot de passe") },
label = { Text(text) },
modifier = Modifier.fillMaxWidth(),
textStyle = TextStyle(color = Color.White, fontSize = 18.sp),
singleLine = true,
@ -279,14 +283,15 @@ fun EditPasswd(){
)
Spacer(modifier = Modifier.height(8.dp))
val textConfirm = stringResource(id = R.string.ConfirmNewPasswdprofile)
OutlinedTextField(
value = confirmPassword,
onValueChange = {
confirmPassword = it
passwordError = newPassword != it
},
label = { Text("Confirmer le mot de passe") },
label = { Text(textConfirm) },
modifier = Modifier.fillMaxWidth(),
textStyle = TextStyle(color = Color.White, fontSize = 18.sp),
singleLine = true,
@ -310,8 +315,9 @@ fun EditPasswd(){
)
if (passwordError) {
val text = stringResource(id = R.string.Errorpasswdprofile)
Text(
text = "Les mots de passe ne correspondent pas",
text = text,
color = Color.Red,
fontSize = 12.sp,
modifier = Modifier.padding(top = 4.dp)
@ -330,7 +336,8 @@ fun EditPasswd(){
colors = ButtonDefaults.buttonColors(containerColor = Color.White),
modifier = Modifier.fillMaxWidth()
) {
Text("Valider", fontSize = 18.sp, color = Color.Black)
val text = stringResource(id = R.string.ButtonSaveprofile)
Text(text, fontSize = 18.sp, color = Color.Black)
}
}
} else {
@ -356,7 +363,8 @@ fun EditPasswd(){
@Composable
fun ButtonProfile(text : String, size :Int, colorTexte : Color, colorButton : Color){
fun ButtonProfile(textResId : Int, size :Int, colorTexte : Color, colorButton : Color){
val text = stringResource(id = textResId)
Button(
onClick = { /* Action */ },
colors = ButtonDefaults.buttonColors(containerColor = colorButton),

@ -31,6 +31,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
@ -38,6 +39,7 @@ import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import com.example.what_the_fantasy.R
import com.example.what_the_fantasy.ui.theme.What_The_FantasyTheme
@Composable
@ -64,15 +66,15 @@ fun SignUpPage(navController: NavController) {
horizontalAlignment = Alignment.CenterHorizontally
) {
TitleSign("Inscription", 20,Color.White)
IdentifiantTextFieldSign("Identifiant*")
TitlePage(R.string.titleSignUp, 20,Color.White)
IdentifiantTextFieldSign(R.string.IdentifiantLogin)
EmailTextFieldSign("Email*")
PassWdTextFieldSign("Mot de passe*")
PassWdConfirmTextFieldSign("Confirmer mot de passe*")
PassWdTextFieldSign(R.string.PasswdLogin)
PassWdConfirmTextFieldSign(R.string.ConfirmPassWdSignUp)
SpaceSign(16)
ConnexionButtonSign("S'incrire",18, Color.White, Color.Black)
ConnexionButtonSign(R.string.ButtonSignUp,18, Color.White, Color.Black)
SpaceSign(16)
CreateAccountButtonSign("Se connecter",12, Color.White, navController = navController)
CreateAccountButtonSign(R.string.ButtonLogin,12, Color.White, navController = navController)
}
}
@ -87,8 +89,10 @@ fun SpaceSign(height : Int){
@Composable
fun IdentifiantTextFieldSign(textIdentifiant : String){
fun IdentifiantTextFieldSign(textIdentifiantResId : Int){
val textIdentifiant = stringResource(id = textIdentifiantResId)
var identifiant by remember { mutableStateOf("") } // Stocke la valeur du champ
Column(modifier = Modifier.padding(top = 16.dp)) {
OutlinedTextField(
value = identifiant,
@ -121,7 +125,8 @@ fun EmailTextFieldSign(textIdentifiant : String){
}
@Composable
fun PassWdTextFieldSign(textpasswd : String){
fun PassWdTextFieldSign(textpasswdResId : Int){
val textpasswd = stringResource(id = textpasswdResId)
var passwd by remember { mutableStateOf("") } // Stocke la valeur du champ
var passwordVisible by remember { mutableStateOf(false) } // État pour afficher/masquer
Column(modifier = Modifier.padding(top = 10.dp)) {
@ -144,7 +149,8 @@ fun PassWdTextFieldSign(textpasswd : String){
}
@Composable
fun PassWdConfirmTextFieldSign(textpasswd : String){
fun PassWdConfirmTextFieldSign(textpasswdResId : Int){
val textpasswd = stringResource(id = textpasswdResId)
var passwd by remember { mutableStateOf("") } // Stocke la valeur du champ
var passwordVisible by remember { mutableStateOf(false) } // État pour afficher/masquer
Column(modifier = Modifier.padding(top = 10.dp)) {
@ -166,18 +172,19 @@ fun PassWdConfirmTextFieldSign(textpasswd : String){
}
}
@Composable
fun TitleSign(title : String, size : Int, color : Color){
Text(
text = title,
fontSize = size.sp,
fontWeight = FontWeight.Bold,
color = color
)
}
//@Composable
//fun TitleSign(title : String, size : Int, color : Color){
// Text(
// text = title,
// fontSize = size.sp,
// fontWeight = FontWeight.Bold,
// color = color
// )
//}
@Composable
fun ConnexionButtonSign(title : String, size : Int, colorButton : Color, colorText : Color){
fun ConnexionButtonSign(titleResId : Int, size : Int, colorButton : Color, colorText : Color){
val title = stringResource(id = titleResId)
Button(
onClick = { /* Action */ },
colors = ButtonDefaults.buttonColors(containerColor = colorButton),
@ -189,7 +196,8 @@ fun ConnexionButtonSign(title : String, size : Int, colorButton : Color, colorTe
}
@Composable
fun CreateAccountButtonSign(title: String, size: Int, color: Color, navController: NavController) {
fun CreateAccountButtonSign(titleResId: Int, size: Int, color: Color, navController: NavController) {
val title = stringResource(id = titleResId)
Text(
text = title,
fontSize = size.sp,

@ -4,4 +4,27 @@
<string name="movie">Film</string>
<string name="videoGame">Jeu Vidéo</string>
<string name="series">Série</string>
//Page Login
<string name="titleLogin">Connexion au compte</string>
<string name="IdentifiantLogin">Votre identifiant*</string>
<string name="PasswdLogin">Votre mot de passe*</string>
<string name="ButtonLogin">Se connecter</string>
<string name="ButtonCreateLogin">Créer son compte</string>
//Page Sign Up
<string name="titleSignUp">Inscription</string>
<string name="ConfirmPassWdSignUp">Confirmer mot de passe*</string>
<string name="ButtonSignUp">S\'inscrire</string>
//Page Profil
<string name="titleProfile">Profil</string>
<string name="ButtonAddQuoteprofile">Suggérer une citation</string>
<string name="ButtonLanguageprofile">Changer la langue</string>
<string name="ButtonUnlogprofile">Se Déconnecter</string>
<string name="NewPasswdprofile">Nouveau mot de passe</string>
<string name="ConfirmNewPasswdprofile">Confirmer le nouveau mot de passe</string>
<string name="ButtonSaveprofile">Sauvegarder</string>
<string name="ErrorEmailprofile">L\'adress email est invalide</string>
<string name="Errorpasswdprofile">Les mots de passe ne correspondent pas</string>
</resources>

@ -3,4 +3,28 @@
<string name="movie">Movie</string>
<string name="videoGame">Video Game</string>
<string name="series">Series</string>
//Page Login
<string name="titleLogin">Account login</string>
<string name="IdentifiantLogin">Your username*</string>
<string name="PasswdLogin">Your password*</string>
<string name="ButtonLogin">Login</string>
<string name="ButtonCreateLogin">Create your account</string>
//Page Sign Up
<string name="titleSignUp">Account creation</string>
<string name="ConfirmPassWdSignUp">Confirm your password*</string>
<string name="ButtonSignUp">Create</string>
//Page Profil
<string name="titleProfile">Profile</string>
<string name="ButtonAddQuoteprofile">Suggest a quote</string>
<string name="ButtonLanguageprofile">Change Language</string>
<string name="ButtonUnlogprofile">Disconnect</string>
<string name="NewPasswdprofile">New password</string>
<string name="ConfirmNewPasswdprofile">Confirm password</string>
<string name="ButtonSaveprofile">Save</string>
<string name="ErrorEmailprofile">Invalid email address</string>
<string name="Errorpasswdprofile">Passwords do not match</string>
</resources>
Loading…
Cancel
Save