Locales set in config.json
Expects languages | file | default_language

@return array
325586
public function locales()
    {
        if ($this->locales) {
            return $this->locales;
        }

        $cfg = $this->app()->config();
        $locales = isset($cfg['locales']) ? $cfg['locales'] : [];
        $languages = isset($locales['languages']) ? $locales['languages'] : [];
        $file = isset($locales['file']) ? $locales['file'] : $this->argOrInput('output');
        // Default to FR
        $default = isset($locales['default_language']) ? $locales['default_language'] : 'fr';

        $this->locales = [
            'languages' => $languages,
            'file' => $file,
            'default_language' => $default
        ];
        return $this->locales;
    }
1018340
public function availableLocales()
    {
        if ($this->config->has('translator.locales')) {
            return $this->config->get('translator.locales');
        }

        if ($this->config->get('translator.source') !== 'files') {
            if ($this->tableExists()) {
                $locales = $this->model->distinct()->get()->pluck('locale')->toArray();
                $this->config->set('translator.locales', $locales);
                return $locales;
            }
        }

        return $this->defaultAvailableLocales;
    }
277120
function languages()
    {
        // trust configuration
        $configured = $this->rc->config->get('spellcheck_languages');
        if (!empty($configured) && is_array($configured) && !$configured[0]) {
            return $configured;
        }
        else if (!empty($configured)) {
            $langs = (array)$configured;
        }
        else if ($this->backend) {
            $langs = $this->backend->languages();
        }

        // load index
        @include(RCUBE_LOCALIZATION_DIR . 'index.inc');

        // add correct labels
        $languages = array();
        foreach ($langs as $lang) {
            $langc = strtolower(substr($lang, 0, 2));
            $alias = $rcube_language_aliases[$langc];
            if (!$alias) {
                $alias = $langc.'_'.strtoupper($langc);
            }
            if ($rcube_languages[$lang]) {
                $languages[$lang] = $rcube_languages[$lang];
            }
            else if ($rcube_languages[$alias]) {
                $languages[$lang] = $rcube_languages[$alias];
            }
            else {
                $languages[$lang] = ucfirst($lang);
            }
        }

        // remove possible duplicates (#1489395)
        $languages = array_unique($languages);

        asort($languages);

        return $languages;
    }
337658
private Collection<Locale> initLocales() {

        Collection<Locale> locales = null;
        switch (m_bundleType) {
            case DESCRIPTOR:
                locales = new ArrayList<Locale>(1);
                locales.add(Descriptor.LOCALE);
                break;
            case XML:
            case PROPERTY:
                locales = OpenCms.getLocaleManager().getAvailableLocales(m_cms, m_resource);
                break;
            default:
                throw new IllegalArgumentException();
        }
        return locales;

    }
12914
protected function getLocaleChoices()
    {
        $locale = [];

        foreach ($this->languages as $language) {
            $locale[$language['label']] = $language['locale'];
        }

        return $locale;
    }
277315
protected function _languages()
    {
        if (!empty($this->params['languages'])) {
            $this->_languages = explode(',', $this->params['languages']);

            return;
        }

        $langs = Configure::read('I18n.languages');
        if (empty($langs)) {
            return;
        }

        $this->_languages = [];
        $langs = Hash::normalize($langs);
        foreach ($langs as $key => $value) {
            if (isset($value['locale'])) {
                $this->_languages[] = $value['locale'];
            } else {
                $this->_languages[] = $key;
            }
        }
    }
801400
public function language()
    {
        $languages = [
            'en_US' => [
                'url' => '/installer/startup/requirements?locale=en_US',
                'welcome' => 'Welcome to QuickAppsCMS',
                'action' => 'Click here to install in English'
            ]
        ];

        $Folder = new Folder(Plugin::classPath('Installer') . 'Locale');
        foreach ($Folder->read(false, true, true)[0] as $path) {
            $code = basename($path);
            $file = $path . '/installer.po';

            if (is_readable($file)) {
                I18n::locale($code); // trick for __d()
                $languages[$code] = [
                    'url' => "/installer/startup/requirements?locale={$code}",
                    'welcome' => __d('installer', 'Welcome to QuickAppsCMS'),
                    'action' => __d('installer', 'Click here to install in English')
                ];
            }
        }

        I18n::locale('en_US');
        $this->title('Welcome to QuickAppsCMS');
        $this->set('languages', $languages);
        $this->_step();
    }
299628
protected function _getLanguages()
    {
        $aLangData['params'] = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aLanguageParams');
        $aLangData['lang'] = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aLanguages');
        $aLangData['urls'] = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aLanguageURLs');
        $aLangData['sslUrls'] = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aLanguageSSLURLs');

        // empty languages parameters array - creating new one with default values
        if (!is_array($aLangData['params'])) {
            $aLangData['params'] = $this->_assignDefaultLangParams($aLangData['lang']);
        }

        return $aLangData;
    }
817404
public function getLanguages()
    {
        $source = $this->server['HTTP_ACCEPT_LANGUAGE'];

        if (strpos($source, ',') !== false) {
            $langs = explode(',', $source);
            return $langs;
        } else {
            return array($source);
        }
    }
290223
public function getConfig(): array
    {
        $structure = [
            'locationMappings' => [],
            'defaultMappings' => [],
            'fallbackContentType' => $this->buildFallbackContentTypeStructure($this->fallbackContentType),
            'maxFileSize' => $this->maxFileSize,
        ];

        foreach ($this->locationMappings as $locationIdentifier => $locationConfiguration) {
            $structure['locationMappings'][$locationIdentifier] = [
                'contentTypeIdentifier' => $locationConfiguration['content_type_identifier'],
                'mimeTypeFilter' => $locationConfiguration['mime_type_filter'],
                'mappings' => [],
            ];

            foreach ($locationConfiguration['mappings'] as $mappingGroup) {
                $structure['locationMappings'][$locationIdentifier]['mappings'][] = $this->buildMappingGroupStructure($mappingGroup);
            }
        }

        foreach ($this->defaultMappings as $mappingGroup) {
            $structure['defaultMappings'][] = $this->buildMappingGroupStructure($mappingGroup);
        }

        return $structure;
    }
80578
public static function optionsInstalledLanguages(): array
    {
        $languages = [];
        foreach (I18N::installedLocales() as $locale) {
            $languages[$locale->languageTag()] = $locale->endonym();
        }

        return $languages;
    }
280171
public static function getLanguageOptions()
    {
        $languages = array();

        foreach (self::$languages as $language) {
            $strings = array();
            require(PHPCI_DIR . 'PHPCI/Languages/lang.' . $language . '.php');
            $languages[$language] = $strings['language_name'];
        }

        return $languages;
    }
1018500
public function setTranslations() {
        $locales      = $this->getLocales();
        $translations = [];

        foreach($locales as $locale => $options) {
            $path = $this->getFileFullPath($locale);

            $contents = Support\get_file_contents($path);

            $translations[$locale] = $contents;
        }

        $this->translations = $this->loaded = $translations;

        return $this;
    }
367217
public function getLanguages()
    {
        // Cache by locale
        $locale = i18n::get_locale();
        if (!empty(static::$cache_languages[$locale])) {
            return static::$cache_languages[$locale];
        }

        // Localise all languages
        $languages = $this->config()->get('languages');
        $localised = [];
        foreach ($languages as $code => $default) {
            $localised[$code] = $this->languageName($code);
        }

        // Save cache
        static::$cache_languages[$locale] = $localised;
        return $localised;
    }
92632
private function getPostedLocales()
    {
        $localeIDs = [];
        $list = $this->post('translatedLocales');
        if (is_array($list)) {
            $localeIDs = array_merge($localeIDs, $list);
        }
        $list = $this->post('untranslatedLocales');
        if (is_array($list)) {
            $localeIDs = array_merge($localeIDs, $list);
        }
        $repo = $this->app->make(LocaleRepository::class);
        $locales = $repo->getApprovedLocales();
        $result = [];
        foreach ($locales as $locale) {
            if (in_array($locale->getID(), $localeIDs, true)) {
                $result[] = $locale;
            }
        }

        $count = count($result);
        if ($count === 0) {
            throw new UserMessageException(t('Please specify the languages of the .po/.mo files to generate'));
        }
        if ($this->maxLocalesCount && $count > (int) $this->maxLocalesCount) {
            throw new UserMessageException(t('Please specify up to %s languages (you requested %2$s languages)', $this->maxLocalesCount, $count));
        }

        return $result;
    }
801469
public function getTranslations(): array
    {
        // Get english name
        $name = [
            'eng' => [
                'common' => $this->getName(),
                'official' => $this->getOfficialName(),
            ],
        ];

        // Get native names
        $natives = $this->getNativeNames() ?: [];

        // Get other translations
        $file = __DIR__.'/../resources/translations/'.mb_strtolower($this->getIsoAlpha2()).'.json';
        $translations = file_exists($file) ? json_decode(file_get_contents($file), true) : [];

        // Merge all names together
        $result = array_merge($translations, $natives, $name);

        // Sort alphabetically
        ksort($result);

        return $result;
    }
1134201
public function get(): Locale
    {
        $locale = $this->originalLocale;

        $convert_locales = $this->config->get('convert_locales');
        $conversions = $this->config->get('convert_locales_to', []);

        if ('auto' === $convert_locales) {
            $locale = isset($conversions[$locale->get()])
                ? Locale::from($conversions[$locale->get()])
                : $locale->withoutRegion();
        } elseif (true === $convert_locales && isset($conversions[$locale->get()])) {
            $locale = Locale::from($conversions[$locale->get()]);
        }

        return $locale;
    }