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


PHP Translation\Translator类代码示例

本文整理汇总了PHP中Piwik\Translation\Translator的典型用法代码示例。如果您正苦于以下问题:PHP Translator类的具体用法?PHP Translator怎么用?PHP Translator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: test_addDirectory_shouldImportOverExistingTranslations

 public function test_addDirectory_shouldImportOverExistingTranslations()
 {
     $translator = new Translator(new JsonFileLoader(), array(__DIR__ . '/Loader/fixtures/dir1'));
     $this->assertEquals('Hello', $translator->translate('General_test2'));
     $translator->addDirectory(__DIR__ . '/Loader/fixtures/dir2');
     $this->assertEquals('Hello 2', $translator->translate('General_test2'));
 }
开发者ID:mgou-net,项目名称:piwik,代码行数:7,代码来源:TranslatorTest.php

示例2: getSparklines

 public function getSparklines()
 {
     $idGoal = Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER;
     $view = new View('@Ecommerce/getSparklines');
     $view->onlyConversionOverview = false;
     $view->conversionsOverViewEnabled = true;
     if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) {
         $goalDefinition['name'] = $this->translator->translate('Goals_Ecommerce');
         $goalDefinition['allow_multiple'] = true;
     } else {
         $goals = GoalsApi::getInstance()->getGoals($this->idSite);
         if (!isset($goals[$idGoal])) {
             Piwik::redirectToModule('Goals', 'index', array('idGoal' => null));
         }
         $goalDefinition = $goals[$idGoal];
     }
     $this->setGeneralVariablesView($view);
     $goal = $this->getMetricsForGoal($idGoal);
     foreach ($goal as $name => $value) {
         $view->{$name} = $value;
     }
     if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) {
         $goal = $this->getMetricsForGoal(Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART);
         foreach ($goal as $name => $value) {
             $name = 'cart_' . $name;
             $view->{$name} = $value;
         }
     }
     $view->idGoal = $idGoal;
     $view->goalAllowMultipleConversionsPerVisit = $goalDefinition['allow_multiple'];
     return $view->render();
 }
开发者ID:piwik,项目名称:piwik,代码行数:32,代码来源:Controller.php

示例3: getLongErrorMessage

    private function getLongErrorMessage()
    {
        $message = '<p>';

        if (SettingsServer::isWindows()) {
            $message .= $this->translator->translate(
                'Installation_SystemCheckWinPdoAndMysqliHelp',
                array('<br /><br /><code>extension=php_mysqli.dll</code><br /><code>extension=php_pdo.dll</code><br /><code>extension=php_pdo_mysql.dll</code><br />')
            );
        } else {
            $message .= $this->translator->translate(
                'Installation_SystemCheckPdoAndMysqliHelp',
                array(
                    '<br /><br /><code>--with-mysqli</code><br /><code>--with-pdo-mysql</code><br /><br />',
                    '<br /><br /><code>extension=mysqli.so</code><br /><code>extension=pdo.so</code><br /><code>extension=pdo_mysql.so</code><br />'
                )
            );
        }

        $message .= $this->translator->translate('Installation_RestartWebServer') . '<br/><br/>';
        $message .= $this->translator->translate('Installation_SystemCheckPhpPdoAndMysqli', array(
            '<a style="color:red" href="http://php.net/pdo">',
            '</a>',
            '<a style="color:red" href="http://php.net/mysqli">',
            '</a>',
        ));
        $message .= '</p>';

        return $message;
    }
开发者ID:GovanifY,项目名称:piwik,代码行数:30,代码来源:DbAdapterCheck.php

示例4: execute

 public function execute()
 {
     $isPiwikInstalling = !Config::getInstance()->existsLocalConfig();
     if ($isPiwikInstalling) {
         // Skip the diagnostic if Piwik is being installed
         return array();
     }
     $label = $this->translator->translate('Installation_DatabaseAbilities');
     $optionTable = Common::prefixTable('option');
     $testOptionNames = array('test_system_check1', 'test_system_check2');
     $loadDataInfile = false;
     $errorMessage = null;
     try {
         $loadDataInfile = Db\BatchInsert::tableInsertBatch($optionTable, array('option_name', 'option_value'), array(array($testOptionNames[0], '1'), array($testOptionNames[1], '2')), $throwException = true);
     } catch (\Exception $ex) {
         $errorMessage = str_replace("\n", "<br/>", $ex->getMessage());
     }
     // delete the temporary rows that were created
     Db::exec("DELETE FROM `{$optionTable}` WHERE option_name IN ('" . implode("','", $testOptionNames) . "')");
     if ($loadDataInfile) {
         return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK, 'LOAD DATA INFILE'));
     }
     $comment = sprintf('LOAD DATA INFILE<br/>%s<br/>%s', $this->translator->translate('Installation_LoadDataInfileUnavailableHelp', array('LOAD DATA INFILE', 'FILE')), $this->translator->translate('Installation_LoadDataInfileRecommended'));
     if ($errorMessage) {
         $comment .= sprintf('<br/><strong>%s:</strong> %s<br/>%s', $this->translator->translate('General_Error'), $errorMessage, 'Troubleshooting: <a target="_blank" href="?module=Proxy&action=redirect&url=http://piwik.org/faq/troubleshooting/%23faq_194">FAQ on piwik.org</a>');
     }
     return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:28,代码来源:LoadDataInfileCheck.php

示例5: execute

 public function execute()
 {
     $label = $this->translator->translate('Installation_SystemCheckWriteDirs');
     $result = new DiagnosticResult($label);
     $directories = Filechecks::checkDirectoriesWritable($this->getDirectories());
     $error = false;
     foreach ($directories as $directory => $isWritable) {
         if ($isWritable) {
             $status = DiagnosticResult::STATUS_OK;
         } else {
             $status = DiagnosticResult::STATUS_ERROR;
             $error = true;
         }
         $result->addItem(new DiagnosticResultItem($status, $directory));
     }
     if ($error) {
         $longErrorMessage = $this->translator->translate('Installation_SystemCheckWriteDirsHelp');
         $longErrorMessage .= '<ul>';
         foreach ($directories as $directory => $isWritable) {
             if (!$isWritable) {
                 $longErrorMessage .= sprintf('<li><pre>chmod a+w %s</pre></li>', $directory);
             }
         }
         $longErrorMessage .= '</ul>';
         $result->setLongErrorMessage($longErrorMessage);
     }
     return array($result);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:28,代码来源:WriteAccessCheck.php

示例6: setManageVariables

 private function setManageVariables(View $view)
 {
     $view->isSuperUser = Piwik::hasUserSuperUserAccess();
     $mobileMessagingAPI = API::getInstance();
     $view->delegatedManagement = $mobileMessagingAPI->getDelegatedManagement();
     $view->credentialSupplied = $mobileMessagingAPI->areSMSAPICredentialProvided();
     $view->accountManagedByCurrentUser = $view->isSuperUser || $view->delegatedManagement;
     $view->strHelpAddPhone = $this->translator->translate('MobileMessaging_Settings_PhoneNumbers_HelpAdd', array($this->translator->translate('General_Settings'), $this->translator->translate('MobileMessaging_SettingsMenu')));
     $view->creditLeft = 0;
     $view->provider = '';
     if ($view->credentialSupplied && $view->accountManagedByCurrentUser) {
         $view->provider = $mobileMessagingAPI->getSMSProvider();
         $view->creditLeft = $mobileMessagingAPI->getCreditLeft();
     }
     $view->smsProviders = SMSProvider::$availableSMSProviders;
     // construct the list of countries from the lang files
     $countries = array();
     foreach ($this->regionDataProvider->getCountryList() as $countryCode => $continentCode) {
         if (isset(CountryCallingCodes::$countryCallingCodes[$countryCode])) {
             $countries[$countryCode] = array('countryName' => \Piwik\Plugins\UserCountry\countryTranslate($countryCode), 'countryCallingCode' => CountryCallingCodes::$countryCallingCodes[$countryCode]);
         }
     }
     $view->countries = $countries;
     $view->defaultCountry = Common::getCountry(LanguagesManager::getLanguageCodeForCurrentUser(), true, IP::getIpFromHeader());
     $view->phoneNumbers = $mobileMessagingAPI->getPhoneNumbers();
     $this->setBasicVariablesView($view);
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:27,代码来源:Controller.php

示例7: execute

    public function execute()
    {
        $label = $this->translator->translate('Installation_SystemCheckSettings');

        $result = new DiagnosticResult($label);

        foreach ($this->getRequiredSettings() as $setting) {
            list($settingName, $requiredValue) = explode('=', $setting);

            $currentValue = (int) ini_get($settingName);

            if ($currentValue != $requiredValue) {
                $status = DiagnosticResult::STATUS_ERROR;
                $comment = sprintf(
                    '%s <br/><br/><em>%s</em><br/><em>%s</em><br/>',
                    $setting,
                    $this->translator->translate('Installation_SystemCheckPhpSetting', array($setting)),
                    $this->translator->translate('Installation_RestartWebServer')
                );
            } else {
                $status = DiagnosticResult::STATUS_OK;
                $comment = $setting;
            }

            $result->addItem(new DiagnosticResultItem($status, $comment));
        }

        return array($result);
    }
开发者ID:GovanifY,项目名称:piwik,代码行数:29,代码来源:PhpSettingsCheck.php

示例8: getPromoVideo

 /**
  * Renders and echo's HTML that displays the Piwik promo video.
  */
 public function getPromoVideo()
 {
     $view = new View('@CoreHome/getPromoVideo');
     $view->shareText = $this->translator->translate('CoreHome_SharePiwikShort');
     $view->shareTextLong = $this->translator->translate('CoreHome_SharePiwikLong');
     $view->promoVideoUrl = 'https://www.youtube.com/watch?v=OslfF_EH81g';
     return $view->render();
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:11,代码来源:Widgets.php

示例9: render

 public function render()
 {
     $footerMessage = null;
     if (Common::getRequestVar('widget', false) && Piwik::hasUserSuperUserAccess()) {
         $footerMessage = $this->translator->translate('CoreHome_OnlyForSuperUserAccess');
     }
     return $this->renderTemplate('getDonateForm', array('footerMessage' => $footerMessage));
 }
开发者ID:piwik,项目名称:piwik,代码行数:8,代码来源:GetDonateForm.php

示例10: execute

 public function execute()
 {
     $label = $this->translator->translate('Installation_SystemCheckGDFreeType');
     if (SettingsServer::isGdExtensionEnabled()) {
         return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK));
     }
     $comment = sprintf('%s<br />%s', $this->translator->translate('Installation_SystemCheckGDFreeType'), $this->translator->translate('Installation_SystemCheckGDHelp'));
     return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:9,代码来源:GdExtensionCheck.php

示例11: execute

 public function execute()
 {
     $label = $this->translator->translate('Installation_SystemCheckPageSpeedDisabled');
     if (!$this->isPageSpeedEnabled()) {
         return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK));
     }
     $comment = $this->translator->translate('Installation_SystemCheckPageSpeedWarn', array('(eg. Apache, Nginx or IIS)'));
     return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:9,代码来源:PageSpeedCheck.php

示例12: execute

 public function execute()
 {
     $label = $this->translator->translate('Installation_SystemCheckUpdateHttps');
     if (CoreUpdater\Controller::isUpdatingOverHttps()) {
         return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK));
     }
     $comment = $this->translator->translate('Installation_SystemCheckUpdateHttpsNotSupported');
     return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:9,代码来源:HttpsUpdateCheck.php

示例13: execute

 public function execute()
 {
     $label = $this->translator->translate('SitesManager_Timezone');
     if (SettingsServer::isTimezoneSupportEnabled()) {
         return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK));
     }
     $comment = sprintf('%s<br />%s.', $this->translator->translate('SitesManager_AdvancedTimezoneSupportNotFound'), '<a href="http://php.net/manual/en/datetime.installation.php" rel="noreferrer" target="_blank">Timezone PHP documentation</a>');
     return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:9,代码来源:TimezoneCheck.php

示例14: ecommerceReport

 public function ecommerceReport()
 {
     if (!\Piwik\Plugin\Manager::getInstance()->isPluginActivated('CustomVariables')) {
         throw new Exception("Ecommerce Tracking requires that the plugin Custom Variables is enabled. Please enable the plugin CustomVariables (or ask your admin).");
     }
     $view = $this->getGoalReportView($idGoal = Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER);
     $view->displayFullReport = false;
     $view->headline = $this->translator->translate('General_EvolutionOverPeriod');
     return $view->render();
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:10,代码来源:Controller.php

示例15: updatePiwik

 public function updatePiwik($https = true)
 {
     // Simulate that the update over HTTPS fails
     if ($https) {
         // The actual error message depends on the OS, the HTTP method etc.
         // This is what I get on my machine, but it doesn't really matter
         throw new ArchiveDownloadException(new \Exception('curl_exec: SSL certificate problem: Invalid certificate chain. Hostname requested was: piwik.org'), array());
     }
     // Simulate that the update over HTTP succeeds
     return array($this->translator->translate('CoreUpdater_DownloadingUpdateFromX', ''), $this->translator->translate('CoreUpdater_UnpackingTheUpdate'), $this->translator->translate('CoreUpdater_VerifyingUnpackedFiles'), $this->translator->translate('CoreUpdater_InstallingTheLatestVersion'));
 }
开发者ID:dorelljames,项目名称:piwik,代码行数:11,代码来源:UpdaterMock.php


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