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


PHP Translate::findTranslationKeyForTranslation方法代码示例

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


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

示例1: getCategory

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return array
  * @throws \RuntimeException
  */
 protected function getCategory(InputInterface $input, OutputInterface $output)
 {
     $validate = function ($category) {
         if (empty($category)) {
             throw new \InvalidArgumentException('Please enter the name of the category your widget should belong to');
         }
         return $category;
     };
     $category = $input->getOption('category');
     $categories = array();
     foreach (Widgets::getAllWidgets() as $widget) {
         if ($widget->getCategory()) {
             $categories[] = Piwik::translate($widget->getCategory());
         }
     }
     $categories = array_values(array_unique($categories));
     if (empty($category)) {
         $dialog = $this->getHelperSet()->get('dialog');
         $category = $dialog->askAndValidate($output, 'Enter the widget category, for instance "Visitor" (you can reuse any existing category or define a new one): ', $validate, false, null, $categories);
     } else {
         $validate($category);
     }
     $translationKey = Translate::findTranslationKeyForTranslation($category);
     if (!empty($translationKey)) {
         return $translationKey;
     }
     $category = ucfirst($category);
     return $category;
 }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:35,代码来源:GenerateWidget.php

示例2: getEnglishTranslationForFeatureName

 private function getEnglishTranslationForFeatureName($featureName)
 {
     if (Translate::getLanguageLoaded() == 'en') {
         return $featureName;
     }
     $translationKeyForFeature = Translate::findTranslationKeyForTranslation($featureName);
     return Piwik::translate($translationKeyForFeature, array(), 'en');
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:8,代码来源:API.php

示例3: getEnglishTranslationForFeatureName

 private function getEnglishTranslationForFeatureName($featureName)
 {
     $loadedLanguage = Translate::getLanguageLoaded();
     if ($loadedLanguage == 'en') {
         return $featureName;
     }
     $translationKeyForFeature = Translate::findTranslationKeyForTranslation($featureName);
     if (!empty($translationKeyForFeature)) {
         Translate::reloadLanguage('en');
         $featureName = Piwik::translate($translationKeyForFeature);
         Translate::reloadLanguage($loadedLanguage);
         return $featureName;
     }
     return $featureName;
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:15,代码来源:API.php

示例4: getCategory

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @param string $pluginName
  * @return array
  * @throws \RuntimeException
  */
 protected function getCategory(InputInterface $input, OutputInterface $output, $pluginName)
 {
     $path = $this->getPluginPath($pluginName) . '/Reports/Base.php';
     if (file_exists($path)) {
         // category is already defined in base.php
         return '';
     }
     $validate = function ($category) {
         if (empty($category)) {
             throw new \InvalidArgumentException('Please enter the name of the category your report belongs to');
         }
         return $category;
     };
     $category = $input->getOption('category');
     $reports = new ReportsProvider();
     $categories = array();
     foreach ($reports->getAllReports() as $report) {
         if ($report->getCategoryId()) {
             $categories[] = Piwik::translate($report->getCategoryId());
         }
     }
     $categories = array_values(array_unique($categories));
     if (empty($category)) {
         $dialog = $this->getHelperSet()->get('dialog');
         $category = $dialog->askAndValidate($output, 'Enter the report category, for instance "Visitor" (you can reuse any existing category or define a new one): ', $validate, false, null, $categories);
     } else {
         $validate($category);
     }
     $translationKey = Translate::findTranslationKeyForTranslation($category);
     if (!empty($translationKey)) {
         return $translationKey;
     }
     $category = ucfirst($category);
     return $category;
 }
开发者ID:piwik,项目名称:piwik,代码行数:42,代码来源:GenerateReport.php


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