for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace LeKoala\FormElements;
use SilverStripe\i18n\i18n;
trait Localize
{
/**
* Override locale. If empty will default to current locale
*
* @var string
*/
protected $locale = null;
* Get locale to use for this field
* @return string
public function getLocale()
return $this->locale ?: i18n::get_locale();
}
* Determines the presented/processed format based on locale defaults,
* instead of explicitly setting {@link setDateFormat()}.
* Only applicable with {@link setHTML5(false)}.
* @param string $locale
* @return $this
public function setLocale($locale)
$this->locale = $locale;
return $this;
public function getScriptDir()
return i18n::get_script_direction($this->getLocale());