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


PHP QApplication::TargetLanguage方法代码示例

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


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

示例1: InitializeLanguage

 public static function InitializeLanguage()
 {
     global $argv;
     if (strstr($_SERVER['REQUEST_URI'], '_devtools')) {
         return false;
     }
     if (strstr($_SERVER['REQUEST_URI'], 'image.php')) {
         return false;
     }
     if (strstr($_SERVER['REQUEST_URI'], 'profile.php')) {
         return false;
     }
     QApplication::$SourceLanguage = NarroLanguage::LoadByLanguageCode(__SOURCE_LANGUAGE_CODE__);
     // language passed through the l parameter
     if (@$_REQUEST['l']) {
         QApplication::$TargetLanguage = NarroLanguage::LoadByLanguageCode(@$_REQUEST['l']);
     } elseif (isset($argv) && ($strLanguage = $argv[array_search('--translation-lang', $argv) + 1])) {
         QApplication::$TargetLanguage = NarroLanguage::LoadByLanguageCode($strLanguage);
     } else {
         if (QApplication::$User->UserId != NarroUser::ANONYMOUS_USER_ID) {
             $objGuessedLanguage = NarroLanguage::LoadByLanguageCode(QApplication::$User->GetPreferenceValueByName('Language'));
             if (!$objGuessedLanguage instanceof NarroLanguage || !$objGuessedLanguage->Active) {
                 $objGuessedLanguage = null;
             }
         }
         if (!$objGuessedLanguage) {
             $objGuessedLanguage = QApplication::GetBrowserLanguage();
             if (!$objGuessedLanguage instanceof NarroLanguage || !$objGuessedLanguage->Active) {
                 $objGuessedLanguage = null;
             }
         }
         if (!$objGuessedLanguage) {
             $objGuessedLanguage = NarroLanguage::QuerySingle(QQ::Equal(QQN::NarroLanguage()->Active, true));
         }
         if (!$objGuessedLanguage) {
             die('There are no active languages in the database.');
         } else {
             if (!isset($_REQUEST['openid_mode']) && !isset($argv)) {
                 QApplication::Redirect(sprintf('projects.php?l=%s', $objGuessedLanguage->LanguageCode));
                 exit;
             } else {
                 QApplication::$TargetLanguage = $objGuessedLanguage;
             }
         }
     }
     if (QApplication::$TargetLanguage->Active == false && !isset($argv)) {
         die(sprintf('The language %s is not active. Please ask the administrator to activate or check your URL if this is not the language you wanted.', QApplication::$TargetLanguage->LanguageName));
     }
 }
开发者ID:Jobava,项目名称:narro,代码行数:49,代码来源:QApplication.class.php

示例2:

         NarroLogger::LogInfo(sprintf('The anonymous user id=%s does not exist in the database.', $intUserId));
         return false;
     }
 }
 QApplication::$User = $objUser;
 $objProject = NarroProject::Load($intProjectId);
 if (!$objProject instanceof NarroProject) {
     NarroLogger::LogInfo(sprintf('Project with id=%s does not exist in the database.', $intProjectId));
     return false;
 }
 $objLanguage = NarroLanguage::LoadByLanguageCode($strTargetLanguage);
 if (!$objLanguage instanceof NarroLanguage) {
     NarroLogger::LogInfo(sprintf('Language %s does not exist in the database.', $strTargetLanguage));
     return false;
 }
 QApplication::$TargetLanguage = $objLanguage;
 $objNarroImporter->TargetLanguage = $objLanguage;
 NarroLogger::LogInfo(sprintf('Target language is %s', $objNarroImporter->TargetLanguage->LanguageName));
 $objNarroImporter->SourceLanguage = NarroLanguage::LoadByLanguageCode($strSourceLanguage);
 if (!$objNarroImporter->SourceLanguage instanceof NarroLanguage) {
     NarroLogger::LogInfo(sprintf('Language %s does not exist in the database.', $strSourceLanguage));
     return false;
 }
 NarroLogger::LogInfo(sprintf('Source language is %s', $objNarroImporter->SourceLanguage->LanguageName));
 $objNarroImporter->Project = $objProject;
 $objNarroImporter->User = $objUser;
 if (array_search('--template-directory', $argv) !== false) {
     $objNarroImporter->TemplatePath = $argv[array_search('--template-directory', $argv) + 1];
 } else {
     $objNarroImporter->TemplatePath = $objNarroImporter->Project->DefaultTemplatePath;
 }
开发者ID:Jobava,项目名称:narro,代码行数:31,代码来源:narro-cli.php

示例3: dirname

 * Copyright (C) 2008-2011 Alexandru Szasz <alexxed@gmail.com>
 * http://code.google.com/p/narro/
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
 * later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
require_once dirname(__FILE__) . '/configuration/prepend.inc.php';
QApplication::$TargetLanguage = NarroLanguage::Load(QApplication::QueryString('l'));
if (QApplication::QueryString('p')) {
    $objProject = NarroProject::Load(QApplication::QueryString('p'));
}
switch (QApplication::QueryString('t')) {
    case 'suggestion':
        if (isset($objProject) && $objProject instanceof NarroProject) {
            $strCacheId = sprintf('rssfeed_suggestion_%d_%d', $objProject->ProjectId, QApplication::QueryString('l'));
        } else {
            $strCacheId = sprintf('rssfeed_suggestion_%d', QApplication::QueryString('l'));
        }
        if (!($objRssFeed = QApplication::$Cache->load($strCacheId))) {
            if (isset($objProject) && $objProject instanceof NarroProject) {
                $objRssFeed = new QRssFeed(sprintf(t('Translations for %s'), $objProject->ProjectName), __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__, sprintf(t('Get the latest translation suggestions in %s for %s'), t(QApplication::$TargetLanguage->LanguageName), $objProject->ProjectName));
            } else {
                $objRssFeed = new QRssFeed(sprintf(t('Translations for all projects'), t(QApplication::$TargetLanguage->LanguageName)), __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__, sprintf(t('Get the latest translation suggestions in %s'), t(QApplication::$TargetLanguage->LanguageName)));
开发者ID:Jobava,项目名称:narro,代码行数:31,代码来源:rss.php


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