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


PHP Translation::getInstance方法代码示例

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


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

示例1: executeHookHandler

 /**
  * Execute certain hook handler
  *
  * @return void
  */
 public function executeHookHandler()
 {
     \XLite\Core\Translation::getInstance()->reset();
     \XLite\Core\Database::getEM()->flush();
     \XLite\Core\Translation::getInstance()->resetDriver();
     \XLite\Core\Translation::getInstance()->translateByString('label');
     \XLite\Core\Database::getRepo('XLite\\Model\\TmpVar')->setVar(\XLite::CACHE_TIMESTAMP, intval(microtime(true)));
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:Main.php

示例2: getLabels

 /**
  * Return list of product labels
  *
  * @param \XLite\Model\Product $product The product to look for
  *
  * @return array
  */
 protected function getLabels(\XLite\Model\Product $product)
 {
     $labels = parent::getLabels($product);
     if ($this->participateSale($product)) {
         $label = intval($product->getSalePercent()) . '% ' . \XLite\Core\Translation::getInstance()->translate('off');
         $labels += array('orange sale-price' => $label);
     }
     return $labels;
 }
开发者ID:kingsj,项目名称:core,代码行数:16,代码来源:ItemsList.php

示例3: __construct

 /**
  * Constructor
  *
  * @return void
  */
 public function __construct()
 {
     $this->em = \XLite\Core\Database::getEM();
     $this->translation = \XLite\Core\Translation::getInstance();
     $entities = \XLite\Core\Database::getCacheDriver()->fetch('quickEntities');
     if (!is_array($entities) || !$entities) {
         foreach ($this->em->getMetadataFactory()->getAllMetadata() as $md) {
             if (!$md->isMappedSuperclass && preg_match('/^XLite\\\\(?:Module\\\\([a-z0-9]+)\\\\)?Model\\\\(.+)$/iSs', $md->name, $m)) {
                 $key = ($m[1] ? $m[1] . '\\' : '') . $m[2];
                 $entities[$key] = $md->name;
             }
         }
         \XLite\Core\Database::getCacheDriver()->save('quickEntities', $entities);
     }
     $this->entities = $entities;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:21,代码来源:QuickAccess.php

示例4: translateLabelXModulesWillBeDisabled

 /**
  * Translate label 'X modules will be disabled'
  *
  * @param array $arguments Arguments
  *
  * @return string
  */
 public function translateLabelXModulesWillBeDisabled(array $arguments)
 {
     return 1 == $arguments['count'] ? \XLite\Core\Translation::getInstance()->translateByString('X module will be disabled', $arguments) : \XLite\Core\Translation::getInstance()->translateByString('X modules will be disabled', $arguments);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:11,代码来源:ATranslationLanguage.php

示例5: getLabelContent

 /**
  * Get content of Free shipping label
  *
  * @return array
  */
 protected static function getLabelContent()
 {
     return array('blue free-shipping' => \XLite\Core\Translation::getInstance()->translate('FREE'));
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:9,代码来源:Labels.php

示例6: uninstallModule

 /**
  * Uninstall module
  *
  * @param \XLite\Model\Module $module    Module object
  * @param array               &$messages Messages list
  *
  * @return boolean
  */
 public function uninstallModule(\XLite\Model\Module $module, &$messages)
 {
     $result = false;
     // Get module pack
     $pack = new \XLite\Core\Pack\Module($module);
     $dirs = $pack->getDirs();
     $nonWritableDirs = array();
     // Check module directories permissions
     foreach ($dirs as $dir) {
         if (\Includes\Utils\FileManager::isExists($dir) && !\Includes\Utils\FileManager::isDirWriteable($dir)) {
             $nonWritableDirs[] = \Includes\Utils\FileManager::getRelativePath($dir, LC_DIR_ROOT);
         }
     }
     $params = array('name' => sprintf('%s v%s (%s)', $module->getModuleName(), $module->getVersion(), $module->getAuthorName()));
     if (empty($nonWritableDirs)) {
         $yamlData = array();
         $yamlFiles = \Includes\Utils\ModulesManager::getModuleYAMLFiles($module->getAuthor(), $module->getName());
         foreach ($yamlFiles as $yamlFile) {
             $yamlData[] = \Includes\Utils\FileManager::read($yamlFile);
         }
         if (!$module->checkModuleMainClass()) {
             $classFile = LC_DIR_CLASSES . \Includes\Utils\Converter::getClassFile($module->getMainClass());
             if (\Includes\Utils\FileManager::isFileReadable($classFile)) {
                 require_once $classFile;
             }
         }
         // Call uninstall event method
         $r = $module->callModuleMethod('callUninstallEvent', 111);
         if (111 == $r) {
             \XLite\Logger::getInstance()->log($module->getActualName() . ': Method callUninstallEvent() was not called');
         }
         // Remove from FS
         foreach ($dirs as $dir) {
             \Includes\Utils\FileManager::unlinkRecursive($dir);
         }
         \Includes\Utils\ModulesManager::disableModule($module->getActualName());
         \Includes\Utils\ModulesManager::removeModuleFromDisabledStructure($module->getActualName());
         // Remove module from DB
         try {
             // Refresh module entity as it was changed by disableModule() method above
             $module = $this->find($module->getModuleID());
             $this->delete($module);
         } catch (\Exception $e) {
             $messages[] = $e->getMessage();
         }
         if ($module->getModuleID()) {
             $messages[] = \XLite\Core\Translation::getInstance()->translate('A DB error occured while uninstalling the module X', $params);
         } else {
             if (!empty($yamlData)) {
                 foreach ($yamlData as $yaml) {
                     \XLite\Core\Database::getInstance()->unloadFixturesFromYaml($yaml);
                 }
             }
             $messages[] = \XLite\Core\Translation::getInstance()->translate('The module X has been uninstalled successfully', $params);
             $result = true;
         }
     } else {
         $messages[] = \XLite\Core\Translation::getInstance()->translate('Unable to delete module X files: some dirs have no writable permissions: Y', $params + array('dirs' => implode(', ', $nonWritableDirs)));
     }
     return $result;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:69,代码来源:Module.php

示例7: t

 /**
  * Language label translation short method
  *
  * @param string $name      Label name
  * @param array  $arguments Substitution arguments OPTIONAL
  * @param string $code      Language code OPTIONAL
  *
  * @return string
  */
 protected static function t($name, array $arguments = array(), $code = null)
 {
     return \XLite\Core\Translation::getInstance()->translate($name, $arguments, $code);
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:13,代码来源:SuperClass.php

示例8: getTranslationDriver

 /**
  * Get translation driver identifier
  *
  * @return string
  */
 public function getTranslationDriver()
 {
     return \XLite\Core\Translation::getInstance()->getDriver()->getName();
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:9,代码来源:Settings.php

示例9: getLabels

 /**
  * Get the "New!" label
  *
  * @param \XLite\Model\Product $product Current product
  *
  * @return array
  */
 public static function getLabels(\XLite\Model\Product $product)
 {
     $result = array();
     if ($product->isNewProduct() && \XLite\Core\Config::getInstance()->CDev->ProductAdvisor->na_mark_with_label) {
         $result[self::PA_MODULE_PRODUCT_LABEL_NEW] = \XLite\Core\Translation::getInstance()->translate('New!');
     }
     if ($product->isUpcomingProduct() && \XLite\Core\Config::getInstance()->CDev->ProductAdvisor->cs_mark_with_label) {
         $result[self::PA_MODULE_PRODUCT_LABEL_SOON] = \XLite\Core\Translation::getInstance()->translate('Coming soon');
     }
     return $result;
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:18,代码来源:Main.php

示例10: performActionUpdate

 /**
  * Perform certain action for the model object
  *
  * @return boolean
  */
 protected function performActionUpdate()
 {
     \XLite\Core\Database::getEM()->flush();
     \XLite\Core\Translation::getInstance()->reset();
     return true;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:11,代码来源:NotificationCommon.php

示例11: getHead

 /**
  * Get title
  *
  * @return string
  */
 protected function getHead()
 {
     return \XLite\Core\Translation::getInstance()->translate('Coming soon');
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:9,代码来源:AComingSoon.php

示例12: getLabels

 /**
  * Get the "X% less" label
  *
  * @param \XLite\Model\Product $product Current product
  *
  * @return array
  */
 public static function getLabels(\XLite\Model\Product $product)
 {
     $result = array();
     $percent = static::getSaveDifferenceInPercents($product);
     if (0 < $percent) {
         $result['orange market-price'] = $percent . '% ' . \XLite\Core\Translation::getInstance()->translate('less');
     }
     return $result;
 }
开发者ID:kingsj,项目名称:core,代码行数:16,代码来源:Main.php

示例13: defineRESTClasses

 /**
  * Define REST repository classes
  *
  * @return array
  */
 protected function defineRESTClasses()
 {
     return array(\XLite\Core\Translation::getInstance(), 'XLite\\Model\\Product');
 }
开发者ID:kingsj,项目名称:core,代码行数:9,代码来源:Rest.php

示例14: function

 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the software license agreement
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.x-cart.com/license-agreement.html
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to licensing@x-cart.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not modify this file if you wish to upgrade X-Cart to newer versions
 * in the future. If you wish to customize X-Cart for your needs please
 * refer to http://www.x-cart.com/ for more information.
 *
 * @category  X-Cart 5
 * @author    Qualiteam software Ltd <info@x-cart.com>
 * @copyright Copyright (c) 2011-2014 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
 * @license   http://www.x-cart.com/license-agreement.html X-Cart 5 License Agreement
 * @link      http://www.x-cart.com/
 */
return function () {
    // Loading new labels
    $yamlFile = __DIR__ . LC_DS . 'new_labels.yaml';
    if (\Includes\Utils\FileManager::isFileReadable($yamlFile)) {
        \XLite\Core\Translation::getInstance()->loadLabelsFromYaml($yamlFile);
    }
    \XLite\Core\Translation::getInstance()->reset();
};
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:31,代码来源:post_rebuild.php

示例15: defineRESTClasses

 /**
  * Define REST repository classes
  *
  * @return array
  */
 protected function defineRESTClasses()
 {
     return array(\XLite\Core\Translation::getInstance());
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:9,代码来源:Rest.php


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