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


PHP Translator::getLanguageInfoForLanguageId方法代码示例

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


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

示例1: translateFN

/**
 * function translateFN: used to handle message translations
 * based on user language
 *
 * @param string $message - the message to be translated
 * @param string $language_from
 * @param string $language_to 2 char string
 * @return string the translated message, if a translation was found, the original message otherwise
 */
function translateFN($message, $language_from = null, $language_to = null)
{
    if (is_null($language_to)) {
        $sess_userObj = $_SESSION['sess_userObj'];
        $languageId = $sess_userObj->getLanguage();
    } else {
        $languageId = $language_to;
    }
    if ($languageId != 0) {
        $languageInfo = Translator::getLanguageInfoForLanguageId($languageId);
        $user_language_code = $languageInfo['codice_lingua'];
    } else {
        if (!isset($_SESSION['sess_user_language'])) {
            $user_language_code = ADA_LOGIN_PAGE_DEFAULT_LANGUAGE;
        } else {
            $user_language_code = $_SESSION['sess_user_language'];
        }
    }
    return Translator::translate($message, $user_language_code);
}
开发者ID:eguicciardi,项目名称:ada,代码行数:29,代码来源:output_funcs.inc.php

示例2: realpath

require_once realpath(dirname(__FILE__)) . '/../config_path.inc.php';
/**
 * Clear node and layout variable in $_SESSION
 */
$variableToClearAR = array('node', 'layout', 'course', 'course_instance');
/**
 * Users (types) allowed to access this module.
 */
$allowedUsersAr = array(AMA_TYPE_SWITCHER);
/**
 * Performs basic controls before entering this module
 */
$neededObjAr = array(AMA_TYPE_SWITCHER => array('layout', 'course'));
require_once ROOT_DIR . '/include/module_init.inc.php';
$self = whoami();
include_once 'include/switcher_functions.inc.php';
/*
 * YOUR CODE HERE
 */
if (!$courseObj instanceof Course || !$courseObj->isFull()) {
    $data = new CText(translateFN('Corso non trovato'));
} else {
    $authorObj = MultiPort::findUser($courseObj->getAuthorId());
    $language_info = Translator::getLanguageInfoForLanguageId($courseObj->getLanguageId());
    $formData = array('id corso' => $courseObj->getId(), 'autore' => $authorObj->getFullName(), 'lingua' => $language_info['nome_lingua'], 'codice corso' => $courseObj->getCode(), 'titolo' => $courseObj->getTitle(), 'descrizione' => $courseObj->getDescription(), 'id nodo iniziale' => $courseObj->getRootNodeId(), 'id nodo toc' => $courseObj->getTableOfContentsNodeId(), 'media path' => $courseObj->getMediaPath(), 'data di creazione' => $courseObj->getCreationDate(), 'data di pubblicazione' => $courseObj->getPublicationDate(), 'crediti' => $courseObj->getCredits());
    $data = BaseHtmlLib::labeledListElement('class:view_info', $formData);
}
$label = translateFN('Visualizzazione dei dati del corso');
$help = translateFN('Da qui il provider admin può visualizzare i dati di un corso esistente');
$content_dataAr = array('user_name' => $user_name, 'user_type' => $user_type, 'status' => $status, 'label' => $label, 'edit_profile' => $userObj->getEditProfilePage(), 'help' => $help, 'data' => $data->getHtml(), 'module' => isset($module) ? $module : '', 'messages' => $user_messages->getHtml());
ARE::render($layout_dataAr, $content_dataAr);
开发者ID:eguicciardi,项目名称:ada,代码行数:31,代码来源:view_course.php

示例3: end

 $extension = '.' . end($exploded_filename);
 $underscoreDelimited = explode('_', reset($exploded_filename));
 /**
  * If the last piece of $underscoreDelimited has length 2
  * it's assumed to be lang part of the file name, remove it
  */
 if (strlen(end($underscoreDelimited)) === 2) {
     unset($underscoreDelimited[count($underscoreDelimited) - 1]);
 }
 /*
  * attempt to find the file in the user actual language
  */
 if (is_object($userObj)) {
     $userActualLangId = $userObj->getLanguage();
     if ($userActualLangId != false) {
         $userActualLang = Translator::getLanguageInfoForLanguageId($userActualLangId);
         $userActualLangCod = $userActualLang['codice_lingua'];
     }
     if (isset($userActualLangCod)) {
         $filename = implode('_', $underscoreDelimited) . '_' . $userActualLangCod . $extension;
         $foundFile = is_file(ROOT_DIR . '/docs/' . $filename) && is_readable(ROOT_DIR . '/docs/' . $filename);
     }
 }
 /**
  * build the array of candidate languages
  */
 $tryLangs = array($login_page_language_code = Translator::negotiateLoginPageLanguage());
 if (!in_array(ADA_LOGIN_PAGE_DEFAULT_LANGUAGE, $tryLangs)) {
     $tryLangs[] = ADA_LOGIN_PAGE_DEFAULT_LANGUAGE;
 }
 /**
开发者ID:eguicciardi,项目名称:ada,代码行数:31,代码来源:external_link.php


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