Commit f8e603a4 authored by Ubbo Veentjer's avatar Ubbo Veentjer
Browse files

i18n for the error controller. remove href from menu labels.

parent 597e1b38
Pipeline #134427 passed with stages
in 8 minutes and 46 seconds
package info.textgrid.rep;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import info.textgrid.rep.i18n.I18N;
import info.textgrid.rep.i18n.I18NProvider;
@Controller
public class TGRepErrorController implements ErrorController {
@Autowired
private I18NProvider i18nProvider;
@RequestMapping("/error")
public String handleError(Model model, HttpServletRequest request) {
public String handleError(Model model, Locale locale, HttpServletRequest request) {
I18N i18n = i18nProvider.getI18N(locale);
if(request.getAttribute("javax.servlet.error.exception") != null) {
Exception exception = (Exception) request.getAttribute("javax.servlet.error.exception");
......@@ -20,6 +29,10 @@ public class TGRepErrorController implements ErrorController {
model.addAttribute("statusCode", request.getAttribute("javax.servlet.error.status_code"));
// translation array
model.addAttribute("i18n", i18n.getTranslationMap());
model.addAttribute("language", i18n.getLanguage());
return "error";
}
......
......@@ -29,7 +29,7 @@
</li>
<li class="tg nav_item -has-dropdown" id="nav-explore" role="presentation">
<a aria-labelledby="nav-explore" href="/browse" class="tg dropdown_toggle -nav" aria-haspopup="true" role="menuitem">
<a aria-labelledby="nav-explore" class="tg dropdown_toggle -nav" aria-haspopup="true" role="menuitem">
Explore
</a>
<ul class="tg dropdown_menu -nav" role="menu">
......@@ -52,7 +52,7 @@
</li>
<li class="tg nav_item -has-dropdown" id="nav-explore" role="presentation">
<a aria-labelledby="nav-explore" href="/browse" class="tg dropdown_toggle -nav" aria-haspopup="true" role="menuitem">
<a aria-labelledby="nav-explore" class="tg dropdown_toggle -nav" aria-haspopup="true" role="menuitem">
${i18n['help']}
</a>
<ul class="tg dropdown_menu -nav" role="menu">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment