fichier langue / bootstrap
This commit is contained in:
@@ -7,19 +7,22 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestHeader;
|
import org.springframework.web.bind.annotation.RequestHeader;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.servlet.LocaleResolver;
|
import org.springframework.web.servlet.LocaleResolver;
|
||||||
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||||
import org.springframework.web.servlet.support.RequestContextUtils;
|
import org.springframework.web.servlet.support.RequestContextUtils;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class LanguageController {
|
public class LanguageController {
|
||||||
|
private final LocaleResolver localeResolver;
|
||||||
|
|
||||||
|
public LanguageController(LocaleResolver localeResolver) {
|
||||||
|
this.localeResolver = localeResolver;
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/change-language")
|
@GetMapping("/change-language")
|
||||||
public String changeLanguage(HttpServletRequest request, HttpServletResponse response, @RequestParam("lang") String lang, @RequestHeader String referer) {
|
public String changeLanguage(@RequestParam("lang") String lang, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||||
LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(request);
|
localeResolver.setLocale(request, response, Locale.forLanguageTag(lang));
|
||||||
if (localeResolver != null) {
|
return "redirect:/"; // Redirect to a specific page or the current one
|
||||||
localeResolver.setLocale(request, response, new Locale(lang));
|
|
||||||
}
|
|
||||||
return "redirect:" + referer;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,12 +18,15 @@ public class WebSecurityConfig{
|
|||||||
http.authorizeHttpRequests((requests) -> requests
|
http.authorizeHttpRequests((requests) -> requests
|
||||||
.requestMatchers("/", "/accueil").permitAll()
|
.requestMatchers("/", "/accueil").permitAll()
|
||||||
.requestMatchers("/accueil", "/login", "/inscription/**", "/searchArticle", "/article/**", "/change-language").permitAll()
|
.requestMatchers("/accueil", "/login", "/inscription/**", "/searchArticle", "/article/**", "/change-language").permitAll()
|
||||||
.requestMatchers("/css/**", "/images/**", "/assets/**", "/img/**", "/js/**", "/assets/**").permitAll()
|
.requestMatchers("/css/**", "/images/**", "/assets/**", "/img/**", "/js/**", "/assets/**", "/i18n/**").permitAll()
|
||||||
.requestMatchers("/profil/**", "/article/new/**", "/article/update", "/article/delete").authenticated()
|
.requestMatchers("/profil/**", "/article/new/**", "/article/update", "/article/delete").authenticated()
|
||||||
.requestMatchers("/admin").hasRole("ADMIN")
|
.requestMatchers("/admin").hasRole("ADMIN")
|
||||||
.anyRequest().authenticated())
|
.anyRequest().authenticated())
|
||||||
.formLogin((form) -> form.loginPage("/login").defaultSuccessUrl("/", true))
|
.formLogin((form) -> form
|
||||||
.logout((logout) -> logout.clearAuthentication(true).invalidateHttpSession(true)
|
.loginPage("/login")
|
||||||
|
.defaultSuccessUrl("/", true))
|
||||||
|
.logout((logout) -> logout
|
||||||
|
.clearAuthentication(true).invalidateHttpSession(true)
|
||||||
.deleteCookies("JSESSIONID").logoutSuccessUrl("/login?logout")
|
.deleteCookies("JSESSIONID").logoutSuccessUrl("/login?logout")
|
||||||
.logoutRequestMatcher(new AntPathRequestMatcher("/logout")).permitAll());
|
.logoutRequestMatcher(new AntPathRequestMatcher("/logout")).permitAll());
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,44 @@
|
|||||||
accueil.search.title = Search for an article by name...
|
home.search.title = Search for an item by name...
|
||||||
|
home.search.cat = All categories
|
||||||
|
home.search.button = Search
|
||||||
|
|
||||||
|
profile.title = My Profile
|
||||||
|
profile.button = Edit
|
||||||
|
profile.pseudo = Username:
|
||||||
|
profile.surname = First Name:
|
||||||
|
profile.name = Last Name:
|
||||||
|
profile.email = Email:
|
||||||
|
profile.phone = Phone:
|
||||||
|
profile.street = Street:
|
||||||
|
profile.postal = Zip Code:
|
||||||
|
profile.city = City:
|
||||||
|
profile.credit = Credits:
|
||||||
|
|
||||||
|
edit.profile.currentpassword = Current Password:
|
||||||
|
edit.profile.newpassword = New Password:
|
||||||
|
edit.profile.confirmnewpassword = Confirm New Password:
|
||||||
|
edit.profile.title = Edit My Profile
|
||||||
|
edit.profile.button.edit = Save Changes
|
||||||
|
edit.profile.button.del = Delete My Account
|
||||||
|
|
||||||
|
login.title = To Log In:
|
||||||
|
login.id = Username:
|
||||||
|
login.password = Password:
|
||||||
|
login.save = Remember Me
|
||||||
|
login.forgotpassword = Forgot Password
|
||||||
|
login.connection = Login
|
||||||
|
login.makecompte = Create Account
|
||||||
|
|
||||||
|
register.title = My Profile
|
||||||
|
register.button = Edit
|
||||||
|
register.pseudo = Username:
|
||||||
|
register.surname = First Name:
|
||||||
|
register.name = Last Name:
|
||||||
|
register.email = Email:
|
||||||
|
register.phone = Phone:
|
||||||
|
register.street = Street:
|
||||||
|
register.postal = Zip Code:
|
||||||
|
register.city = City:
|
||||||
|
register.credit = Credits:
|
||||||
|
register.make = create
|
||||||
|
register.cancel = cancel
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="fr" th:replace="~{modele-page :: layout('Accueil - ENI-Enchères',~{::link} , ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
|
<html th:replace="~{modele-page :: layout('Accueil - ENI-Enchères',~{::link} , ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="fr" th:replace="~{modele-page :: layout('Panel administrateur',~{::link} , ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
|
<html th:replace="~{modele-page :: layout('Panel administrateur',~{::link} , ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="fr" th:replace="~{modele-page :: layout('Article - NOMARTICLE',~{::link} , ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
|
<html th:replace="~{modele-page :: layout('Article - NOMARTICLE',~{::link} , ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="fr" th:replace="~{modele-page :: layout('Modifier votre profile' , ~{::#link}, ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
|
<html th:replace="~{modele-page :: layout('Modifier votre profile' , ~{::#link}, ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet">
|
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="fr" th:replace="~{modele-page :: layout('Inscription',~{::link} , ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
|
<html th:replace="~{modele-page :: layout('Inscription',~{::link} , ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -38,12 +38,14 @@
|
|||||||
<a class="btn btn-primary" href="/login" role="button" style="background-color: #1B4463;">S'inscrire / Se connecter</a>
|
<a class="btn btn-primary" href="/login" role="button" style="background-color: #1B4463;">S'inscrire / Se connecter</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-expanded="false">
|
<div class="dropdown">
|
||||||
<i class="fa-solid fa-earth-americas"></i>
|
<a class="nav-link dropdown-toggle" href="" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-expanded="false">
|
||||||
</a>
|
<i class="fa-solid fa-earth-americas"></i>
|
||||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink">
|
</a>
|
||||||
<a class="dropdown-item" th:href="@{/change-language(lang='en')}">English</a>
|
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink" role="menu">
|
||||||
<a class="dropdown-item" th:href="@{/change-language(lang='fr')}">Français</a>
|
<a class="dropdown-item" th:href="@{/change-language(lang='en')}">English</a>
|
||||||
|
<a class="dropdown-item" th:href="@{/change-language(lang='fr')}">Français</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -101,6 +103,7 @@
|
|||||||
© 2024 Copyright:
|
© 2024 Copyright:
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
|
||||||
<script src="/js/bootstrap/bootstrap.min.js"></script>
|
<script src="/js/bootstrap/bootstrap.min.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="fr" th:replace="~{modele-page :: layout('Votre profile',~{::link} , ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
|
<html th:replace="~{modele-page :: layout('Votre profile',~{::link} , ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
Reference in New Issue
Block a user