private function setDefaultLocale($lang)
    {
        if ($lang === null) {
            $this->defaultLanguage = $this->languages[0];
            return;
        }

        if (!$this->hasLocale($lang)) {
            if (!is_string($lang)) {
                $lang = is_object($lang) ? get_class($lang) : gettype($lang);
            }

            throw new InvalidArgumentException(sprintf(
                'Unsupported default language; must be one of "%s", received "%s"',
                implode(', ', $this->availableLocales()),
                $lang
            ));
        }

        $this->defaultLanguage = $lang;
    }