I am using SilverStripe to build a website that should support both English (LTR) and Arabic (RTL) languages. In the templates I need to set the direction of the language.
<html lang="$ContentLocale" dir="$//SomethingHere//">
How can I detect the current language direction and provide that to the template?
In SilverStripe 3.4 the i18n
has a get_script_direction
function that returns "rtl" or "ltr". This can be called through the template global variable $i18nScriptDirection
.
<html lang="$ContentLocale" dir="$i18nScriptDirection">