public static function getCandidates($locale, $fallbackLocale = null)
    {
        $locale = self::replaceAlias($locale);
        $candidates = [$locale];
        while ($parent = self::getParent($locale)) {
            $candidates[] = $parent;
            $locale = $parent;
        }
        if (isset($fallbackLocale)) {
            $candidates[] = $fallbackLocale;
            while ($parent = self::getParent($fallbackLocale)) {
                $candidates[] = $parent;
                $fallbackLocale = $parent;
            }
        }

        return array_unique($candidates);
    }
public static function getCandidates($locale, $fallbackLocale = null)
    {
        $locale = self::replaceAlias($locale);
        $candidates = [$locale];
        while ($parent = self::getParent($locale)) {
            $candidates[] = $parent;
            $locale = $parent;
        }
        if (isset($fallbackLocale)) {
            $candidates[] = $fallbackLocale;
            while ($parent = self::getParent($fallbackLocale)) {
                $candidates[] = $parent;
                $fallbackLocale = $parent;
            }
        }

        return array_unique($candidates);
    }
public static function getCandidates ( $ locale , $ fallbackLocale = null ) { $ locale = self :: replaceAlias ( $ locale ) ; $ candidates = [ $ locale ] ; while ( $ parent = self :: getParent ( $ locale ) ) { $ candidates [ ] = $ parent ; $ locale = $ parent ; } if ( isset ( $ fallbackLocale ) ) { $ candidates [ ] = $ fallbackLocale ; while ( $ parent = self :: getParent ( $ fallbackLocale ) ) { $ candidates [ ] = $ parent ; $ fallbackLocale = $ parent ; } } return array_unique ( $ candidates ) ; }
Gets locale candidates.

For example, "bs-Cyrl-BA" has the following candidates:
1) bs-Cyrl-BA
2) bs-Cyrl
3) bs

The locale is de-aliased, e.g. the candidates for "sh" are:
1) sr-Latn
2) sr

@param string $locale         The locale (i.e. fr-FR).
@param string $fallbackLocale A fallback locale (i.e "en").

@return array An array of all variants of a locale.
Gets locale candidates .