private function resolveLanguage($preferred)
    {
        if (in_array($preferred, $this->languages)) {
            return $preferred;
        } elseif (isset($this->mappings[$preferred])) {
            return $this->mappings[$preferred];
        }
        return null;
    }