当前位置: 首页>>代码示例>>PHP>>正文


PHP Translate::loadStrings方法代码示例

本文整理汇总了PHP中Translate::loadStrings方法的典型用法代码示例。如果您正苦于以下问题:PHP Translate::loadStrings方法的具体用法?PHP Translate::loadStrings怎么用?PHP Translate::loadStrings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Translate的用法示例。


在下文中一共展示了Translate::loadStrings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setlocale

$language_id = Config::get()->backendLanguages->standard;
if (isset($_SESSION['pixelmanager']['backendLanguage'])) {
    if (isset($languages[$_SESSION['pixelmanager']['backendLanguage']])) {
        $language_id = $_SESSION['pixelmanager']['backendLanguage'];
    }
}
setlocale(LC_ALL, $languages[$language_id]['locale']);
if (is_array($languages[$language_id]['translationServerside'])) {
    if (count($languages[$language_id]['translationServerside']) > 0) {
        foreach ($languages[$language_id]['translationServerside'] as $translation_file) {
            Translate::loadStrings($translation_file, $language_id);
        }
    }
} else {
    if ($languages[$language_id]['translationServerside'] != '') {
        Translate::loadStrings($languages[$language_id]['translationServerside'], $language_id);
    }
}
// Datenstruktur laden (ist hier eigentlich nocht nicht nötig,
// aber so wird überprüft, ob alle nötigen Dateien existieren
// und die Arrays zurückgegebeb werden)
DataStructure::load();
// Plugins laden
Plugins::load();
// Falls die gesonderte Seite mit den globalen Elementen verwendet werden soll,
// diese ggf. anlegen
$pages = new Pages();
if ($pages->isGlobalElementsPageTemplateAvailable()) {
    $pages->createGlobalElementsPage();
}
// Request-Pfad auslesen
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:31,代码来源:index.php

示例2: run

 public function run()
 {
     // Startup-Ereignis
     Plugins::call(Plugins::STARTUP, null);
     // Router laden
     $router_file_name = Config::get()->frontendRouter->classFile;
     if (!file_exists($router_file_name)) {
         Helpers::fatalError('Frontend router class file not found (' . $router_file_name . ' doesn\'t exist)!', true);
     }
     require_once $router_file_name;
     $router_class_name = Config::get()->frontendRouter->className;
     if (!class_exists($router_class_name)) {
         Helpers::fatalError('Frontend router class not found (class "' . $router_class_name . '" doesn\'t exist in ' . $router_file_name . ')!', true);
     }
     $router = new $router_class_name();
     Registry::set('frontendRouter', $router);
     // PageBuilder laden
     $page_builder_file_name = Config::get()->pageBuilder->classFile;
     if (!file_exists($page_builder_file_name)) {
         Helpers::fatalError('PageBuilder class file not found (' . $page_builder_file_name . ' doesn\'t exist)!', true);
     }
     require_once $page_builder_file_name;
     $page_builder_class_name = Config::get()->pageBuilder->className;
     if (!class_exists($page_builder_class_name)) {
         Helpers::fatalError('PageBuilder class not found (class "' . $page_builder_class_name . '" doesn\'t exist in ' . $page_builder_file_name . ')!', true);
     }
     $page_builder = new $page_builder_class_name();
     Registry::set('pageBuilder', $page_builder);
     // routing
     $router->route();
     $languageId = $router->getLanguageId();
     if ($router->pageFound()) {
         $pageId = $router->getPageId();
         $error_404 = false;
     } else {
         $pageId = $router->getErrorPageId();
         $error_404 = true;
     }
     if ($pageId !== false) {
         // Ist die Seite ein Link? Dann einfach auf die angegebene URL weiterleiten...
         if ($router->isPageLink()) {
             Helpers::redirect($router->getPageLinkUrl(), Config::get()->pageLinkRedirectionResponseCode);
             exit;
         }
         // �bersetzungen laden
         $config = Config::getArray();
         $languages = $config['languages']['list'];
         setlocale(LC_ALL, $languages[$languageId]['locale']);
         if (is_array($languages[$languageId]['translation'])) {
             if (count($languages[$languageId]['translation']) > 0) {
                 foreach ($languages[$languageId]['translation'] as $translation_file) {
                     Translate::loadStrings($translation_file, $languageId);
                 }
             }
         } else {
             if ($languages[$languageId]['translation'] != '') {
                 Translate::loadStrings($languages[$languageId]['translation'], $languageId);
             }
         }
         // Before-Display-Ereignis
         Plugins::call(Plugins::BEFORE_DISPLAY, array('preview' => $router->isPreview(), 'pageId' => $pageId, 'languageId' => $languageId));
         if (!$router->isPreview()) {
             // Versuchen, die Seite aus dem Cache zu holen
             $output = PageCache::getPage($pageId, $languageId);
             $output_cached = false;
             // Keine Version im Cache verf�gbar, Seite neu erzeugen
             if ($output === false) {
                 $output = $page_builder->getPage($pageId, $languageId);
             } else {
                 $output_cached = true;
             }
             // Wenn noch nicht im Cache, erzeugte Ausgabe im Cache ablegen
             if (!$output_cached) {
                 PageCache::cachePage($pageId, $languageId, $output);
             }
         } else {
             // Im Vorschau-Modus den Cache nicht verwenden
             // Und dem PageBuilder sagen, dass er die Vorschau-Version erstellen soll
             $output = $page_builder->getPage($pageId, $languageId, true);
             $output_cached = false;
         }
         // HTTP-Header senden
         if ($error_404) {
             if (!headers_sent()) {
                 header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
             }
         }
         $page_builder->outputHeader($pageId, $languageId);
         // Header-Senden-Ereignis
         Plugins::call(Plugins::SEND_HEADER, array('preview' => $router->isPreview(), 'pageId' => $pageId, 'languageId' => $languageId));
         // Modify-Output-Before-Display-Ereignis, bietet die M�glichkeit,
         // dass ein Plugin die Ausgabe vor der Ausgabe nochmal ver�ndert,
         // unabh�ngig davon, ob die Seite aus dem Cache geladen wurde oder nicht
         Plugins::call(Plugins::MODIFY_OUTPUT_BEFORE_DISPLAY, array('preview' => $router->isPreview(), 'pageId' => $pageId, 'languageId' => $languageId, 'isCached' => $output_cached), $output);
         // Seite ausgeben
         print $output;
         // After-Display-Ereignis
         Plugins::call(Plugins::AFTER_DISPLAY, array('preview' => $router->isPreview(), 'pageId' => $pageId, 'languageId' => $languageId));
     } else {
         Helpers::fatalError('Error 404: page not found ', true);
//.........这里部分代码省略.........
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:101,代码来源:StandardFrontendController.php


注:本文中的Translate::loadStrings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。