當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tool::getSupportedLocales方法代碼示例

本文整理匯總了PHP中Pimcore\Tool::getSupportedLocales方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tool::getSupportedLocales方法的具體用法?PHP Tool::getSupportedLocales怎麽用?PHP Tool::getSupportedLocales使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Pimcore\Tool的用法示例。


在下文中一共展示了Tool::getSupportedLocales方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: configureOptions

 /**
  *
  */
 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);
 }
開發者ID:yonetici,項目名稱:pimcore-coreshop-demo,代碼行數:18,代碼來源:Languagemultiselect.php

示例2: getIconPath

<?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)) {
開發者ID:ChristophWurst,項目名稱:pimcore,代碼行數:31,代碼來源:flags.php

示例3: languageListAction

 public function languageListAction()
 {
     $locales = Tool::getSupportedLocales();
     foreach ($locales as $short => $translation) {
         $options[] = ["name" => $translation, "code" => $short];
     }
     $this->_helper->json(["data" => $options]);
 }
開發者ID:pimcore,項目名稱:pimcore,代碼行數:8,代碼來源:MiscController.php

示例4: getAvailableAdminLanguagesAction

 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);
 }
開發者ID:elavarasann,項目名稱:pimcore,代碼行數:12,代碼來源:SettingsController.php


注:本文中的Pimcore\Tool::getSupportedLocales方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。