we are developing a web site that we need to support both LTR and RTL. we find that the best way is to change in CSSs(i.e. CSS for LTR and another to RTL). and that worked fine, the question is how to decide wether the language needs LTR or RTL. I know one solution for that, that we get the accept language from controller, then decide wether it is LTR or RTL, then send this variable to the scala templates, and templates will have an if, else statement to decide wich CSSs it will load, but we will do that in each Controller, what is the best practise for doing such a thing, is there a way to know the accept language from scala template not from controller? Thanks in advance
The closest thing I find that, I put a method in acontroller that get lang()
then get if its RTL or LTR then load the CSSs and JSs accoding to that from my main.scala.html. so that I shouldn't be worry about passing the if statement from every controller method, the code in main,scala.html would be like that:
@if(Language.isRTL()){
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/bootstrap_rtl.min.css")">
}else{
<link rel="stylesheet" media="screen" href="@routes.WebJarAssets.at(WebJarAssets.locate("bootstrap.min.css"))">
}