public function setLocale($locale)
    {
        if ($locale && !preg_match('/[a-z]{2,3}/', $locale)) {
            throw new \InvalidArgumentException('Locale must be a valid i18n code');
        }

        $this->i18n = $locale;

        return $this;
    }
public function setLocale($locale)
    {
        if ($locale && !preg_match('/[a-z]{2,3}/', $locale)) {
            throw new \InvalidArgumentException('Locale must be a valid i18n code');
        }

        $this->i18n = $locale;

        return $this;
    }
public function setLocale ( $ locale ) { if ( $ locale && ! preg_match ( '/[a-z]{2,3}/' , $ locale ) ) { throw new \ InvalidArgumentException ( 'Locale must be a valid i18n code' ) ; } $ this -> i18n = $ locale ; return $ this ; }
Defines locale code to use for query

@param string $locale An i18n locale code
@return $this
Defines locale code to use for query