getSupportedLocales() публичный статический Метод

public static getSupportedLocales ( ) : array | mixed
Результат array | mixed
 /**
  *
  */
 public function configureOptions()
 {
     $validLanguages = (array) Tool::getValidLanguages();
     $locales = Tool::getSupportedLocales();
     $options = array();
     foreach ($locales as $short => $translation) {
         if ($this->getOnlySystemLanguages()) {
             if (!in_array($short, $validLanguages)) {
                 continue;
             }
         }
         $options[] = array("key" => $translation, "value" => $short);
     }
     $this->setOptions($options);
 }
Пример #2
0
<?php

include "../../cli/startup.php";
$iconPath = '/pimcore/static6/img/flags/';
$locales = \Pimcore\Tool::getSupportedLocales();
$languageOptions = array();
foreach ($locales as $short => $translation) {
    if (!empty($short)) {
        $languageOptions[] = array("language" => $short, "display" => $translation . " ({$short})");
    }
}
function getIconPath($language)
{
    $iconBasePath = PIMCORE_PATH . '/static6/img/flags';
    $code = strtolower($language);
    $code = str_replace("_", "-", $code);
    $countryCode = null;
    $fallbackLanguageCode = null;
    $parts = explode("-", $code);
    if (count($parts) > 1) {
        $countryCode = array_pop($parts);
        $fallbackLanguageCode = $parts[0];
    }
    $languagePath = $iconBasePath . "/languages/" . $code . ".png";
    $countryPath = $iconBasePath . "/countries/" . $countryCode . ".png";
    $fallbackLanguagePath = $iconBasePath . "/languages/" . $fallbackLanguageCode . ".png";
    $iconPath = $iconBasePath . "/countries/_unknown.png";
    if (file_exists($languagePath)) {
        $iconPath = $languagePath;
    } else {
        if ($countryCode && file_exists($countryPath)) {
Пример #3
0
 public function languageListAction()
 {
     $locales = Tool::getSupportedLocales();
     foreach ($locales as $short => $translation) {
         $options[] = ["name" => $translation, "code" => $short];
     }
     $this->_helper->json(["data" => $options]);
 }
Пример #4
0
 public function getAvailableAdminLanguagesAction()
 {
     $langs = array();
     $availableLanguages = Tool\Admin::getLanguages();
     $locales = Tool::getSupportedLocales();
     foreach ($availableLanguages as $lang) {
         if (array_key_exists($lang, $locales)) {
             $langs[] = array("language" => $lang, "display" => $locales[$lang]);
         }
     }
     $this->_helper->json($langs);
 }