protected function getLocaleGroup($parentName, $locale)
    {
        if (!($locale instanceof LocaleEntity)) {
            $l = $this->app->make(LocaleRepository::class)->findApproved($locale);
            if ($l === null) {
                throw new UserMessageException(t("The locale identifier '%s' is not valid", $locale));
            }
            $locale = $l;
        }
        $localeID = $locale->getID();
        if (!isset($this->localeGroups[$parentName])) {
            $this->localeGroups[$parentName] = [];
        }
        if (!isset($this->localeGroups[$parentName][$localeID])) {
            $this->localeGroups[$parentName][$localeID] = $this->getGroup($localeID, $parentName);
        }

        return $this->localeGroups[$parentName][$localeID];
    }