protected function _localesPattern()
    {
        $cacheKey = '_localesPattern';
        $cache = static::cache($cacheKey);
        if ($cache) {
            return $cache;
        }

        $pattern = '(' . implode(
            '|',
            array_map(
                'preg_quote',
                array_keys(
                    quickapps('languages')
                )
            )
        ) . ')';

        return static::cache($cacheKey, $pattern);
    }