src/Cms/LocaleAwareTrait.php
private function parseLocale(array $localeStruct, $langCode)
    {
        $trans = 'locale.' . $langCode;

        /** Setup the name of the language in the current locale */
        if (isset($localeStruct['name'])) {
            $name = $this->translator()->translate($localeStruct['name']);
        } else {
            $name = $this->translator()->translate($trans);
            if ($trans === $name) {
                $name = strtoupper($langCode);
            }
        }

        /** Setup the native name of the language */
        if (isset($localeStruct['native'])) {
            $native = $this->translator()->translate($localeStruct['native'], [], null, $langCode);
        } else {
            $native = $this->translator()->translate($trans, [], null, $langCode);
            if ($trans === $native) {
                $native = strtoupper($langCode);
            }
        }

        if (!isset($localeStruct['locale'])) {
            $localeStruct['locale'] = $langCode;
        }

        $localeStruct['name']   = $name;
        $localeStruct['native'] = $native;
        $localeStruct['code']   = $langCode;

        return $localeStruct;
    }
private function parseLocale(array $localeStruct, $langCode)
    {
        $trans = 'locale.' . $langCode;

        /** Setup the name of the language in the current locale */
        if (isset($localeStruct['name'])) {
            $name = $this->translator()->translate($localeStruct['name']);
        } else {
            $name = $this->translator()->translate($trans);
            if ($trans === $name) {
                $name = strtoupper($langCode);
            }
        }

        /** Setup the native name of the language */
        if (isset($localeStruct['native'])) {
            $native = $this->translator()->translate($localeStruct['native'], [], null, $langCode);
        } else {
            $native = $this->translator()->translate($trans, [], null, $langCode);
            if ($trans === $native) {
                $native = strtoupper($langCode);
            }
        }

        if (!isset($localeStruct['locale'])) {
            $localeStruct['locale'] = $langCode;
        }

        $localeStruct['name']   = $name;
        $localeStruct['native'] = $native;
        $localeStruct['code']   = $langCode;

        return $localeStruct;
    }
private function parseLocale ( array $ localeStruct , $ langCode ) { $ trans = 'locale.' . $ langCode ; /** Setup the name of the language in the current locale */ if ( isset ( $ localeStruct [ 'name' ] ) ) { $ name = $ this -> translator ( ) -> translate ( $ localeStruct [ 'name' ] ) ; } else { $ name = $ this -> translator ( ) -> translate ( $ trans ) ; if ( $ trans === $ name ) { $ name = strtoupper ( $ langCode ) ; } } /** Setup the native name of the language */ if ( isset ( $ localeStruct [ 'native' ] ) ) { $ native = $ this -> translator ( ) -> translate ( $ localeStruct [ 'native' ] , [ ] , null , $ langCode ) ; } else { $ native = $ this -> translator ( ) -> translate ( $ trans , [ ] , null , $ langCode ) ; if ( $ trans === $ native ) { $ native = strtoupper ( $ langCode ) ; } } if ( ! isset ( $ localeStruct [ 'locale' ] ) ) { $ localeStruct [ 'locale' ] = $ langCode ; } $ localeStruct [ 'name' ] = $ name ; $ localeStruct [ 'native' ] = $ native ; $ localeStruct [ 'code' ] = $ langCode ; return $ localeStruct ; }
Parse the given locale.

@see    \Charcoal\Admin\Widget\FormSidebarWidget::languages()
@see    \Charcoal\Admin\Widget\FormGroupWidget::languages()
@param  array  $localeStruct The language structure.
@param  string $langCode     The language code.
@throws InvalidArgumentException If the locale does not have a language code.
@return array
Parse the given locale .