本文整理汇总了PHP中l10n::set方法的典型用法代码示例。如果您正苦于以下问题:PHP l10n::set方法的具体用法?PHP l10n::set怎么用?PHP l10n::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类l10n
的用法示例。
在下文中一共展示了l10n::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
*
*/
public function __construct($okt, $sPostPrefix = 'p_')
{
$this->okt = $okt;
# POST prefix
$this->sPostPrefix = $sPostPrefix;
# locales
l10n::set(OKT_LOCALES_PATH . '/' . $this->okt->user->language . '/definitions.less.editor');
}
示例2: prepend
protected function prepend()
{
# chargement des principales locales
l10n::set(__DIR__ . '/locales/' . $this->okt->user->language . '/main');
# permissions
$this->okt->addPerm('rte_tinymce_4_config', __('m_rte_tinymce_4_perm_config'), 'configuration');
# configuration
$this->config = $this->okt->newConfig('conf_rte_tinymce_4');
}
示例3: prepend_admin
protected function prepend_admin()
{
# on détermine si on est actuellement sur ce module
$this->onThisModule();
# chargement des locales admin
l10n::set(__DIR__ . '/locales/' . $this->okt->user->language . '/admin');
# on ajoutent un item au menu admin
if (!defined('OKT_DISABLE_MENU')) {
$this->okt->page->configSubMenu->add(__('Accessible Captcha'), 'module.php?m=accessible_captcha&action=index', ON_ACCESSIBLE_CAPTCHA_MODULE && (!$this->okt->page->action || $this->okt->page->action === 'index'), 30, $this->okt->checkPerm('accessible_captcha_config'), null);
}
}
示例4: dc_load_locales
function dc_load_locales()
{
global $_lang, $core;
$_lang = $core->auth->getInfo('user_lang');
$_lang = preg_match('/^[a-z]{2}(-[a-z]{2})?$/', $_lang) ? $_lang : 'en';
if (l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/date') === false && $_lang != 'en') {
l10n::set(dirname(__FILE__) . '/../../locales/en/date');
}
l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/main');
l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/plugins');
}
示例5: init
/**
* Load the translation strings
*
* @access public
* @author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
* @param common_ext_Extension $extension
* @param string langCode
* @return mixed
*/
public static function init(common_ext_Extension $extension, $langCode)
{
// if the langCode is empty do nothing
if (empty($langCode)) {
throw new Exception("Language is not defined");
}
//init the ClearFw l10n tools
l10n::init();
$basePath = $extension->getDir();
if (!empty($_GET['ext']) && is_string($_GET['ext'])) {
$shownExtension = common_ext_ExtensionsManager::singleton()->getExtensionById($_GET['ext']);
if (!empty($shownExtension)) {
try {
$basePath = $shownExtension->getDir();
$baseUrl = $shownExtension->getConstant('BASE_URL');
} catch (common_exception_Error $e) {
// let the current base path be used...
}
}
}
l10n::set($basePath . 'locales' . DIRECTORY_SEPARATOR . $langCode . DIRECTORY_SEPARATOR . 'messages');
}
示例6: __construct
/**
* Constructor.
*
* @param oktCore $okt
* @param array $aConfig
* @param string $sBase
* @param string $sTplFamily
* @param string $sBaseUrl
* @return void
*/
public function __construct($okt, $aConfig, $sBase, $sTplFamily, $sBaseUrl = '/')
{
$this->okt = $okt;
$this->aConfig = $aConfig;
$this->sTplFamily = $sTplFamily;
$this->sBase = util::formatAppPath($sBase, false, false);
$this->sBaseUrl = $sBaseUrl;
$this->loadTemplatesPaths();
$this->loadTemplatesInfos();
l10n::set(OKT_LOCALES_PATH . '/' . $this->okt->user->language . '/admin.templates.config');
# téléchargement d'un template
if (!empty($_GET['tpl_download']) && !empty($_GET['tpl_id']) && array_key_exists(rawurldecode($_GET['tpl_id']), $this->getTplInfos()) && !empty($_GET['tpl_family']) && rawurldecode($_GET['tpl_family']) == $this->sTplFamily) {
$this->dowloadTemplate(rawurldecode($_GET['tpl_id']));
}
# suppression d'un template
if (!empty($_GET['tpl_delete']) && !empty($_GET['tpl_id']) && array_key_exists(rawurldecode($_GET['tpl_id']), $this->getTplInfos()) && !empty($_GET['tpl_family']) && rawurldecode($_GET['tpl_family']) == $this->sTplFamily) {
$this->deleteTemplate(rawurldecode($_GET['tpl_id']));
$this->okt->redirect($this->sBaseUrl . 'tpl_family=' . rawurlencode($this->sTplFamily) . '&tpl_deleted=1');
}
if (isset($this->okt->page) && !empty($_GET['tpl_family']) && rawurldecode($_GET['tpl_family']) == $this->sTplFamily) {
$this->okt->page->messages->success('tpl_deleted', __('c_a_tpl_config_tpl_deleted'));
}
}
示例7: HttpRequest
# Manage the current language selected
$lang = $GLOBALS['lang'];
# Not really used because the anonymous account is always used
if (Auth::isAuth()) {
$lang = Auth::getLanguage();
# Special case to add synchro for changing temporary langue via the top control panel
$re = new HttpRequest();
$module = $re->getModule();
$action = $re->getAction();
if ($module == 'wall' && $action == 'index') {
$args = $re->getArgs();
if (isset($args['langage'])) {
$availableLanguages = Util::getAvailableLanguages();
if ($args['langage'] !== null && in_array($args['langage'], array_keys($availableLanguages))) {
$_SESSION['globalLangage'] = $lang = $args['langage'];
}
}
}
}
// internationalisation
l10n::init();
l10n::set(dirname(__FILE__) . '/locales/' . $lang . '/messages');
try {
$re = new HttpRequest();
$fc = new AdminEnabledDefaultFC($re);
$fc->loadModule();
} catch (Exception $e) {
$message = $e;
header('HTTP/1.1 500 Internal Error');
require_once DIR_VIEWS . $GLOBALS['dir_theme'] . "error404.tpl";
}
示例8: catch
<?php
/**
* @ingroup okt_module_galleries
* @brief Page de gestion des galeries
*
*/
# Accès direct interdit
if (!defined('ON_GALLERIES_MODULE')) {
die;
}
/* Initialisations
----------------------------------------------------------*/
# Chargement des locales
l10n::set(__DIR__ . '/../../locales/' . $okt->user->language . '/admin.list');
/* Traitements
----------------------------------------------------------*/
# Régénération des miniatures d'une galerie
if (!empty($_REQUEST['regenerate_thumbnails'])) {
if ($okt->galleries->items->regenMinImages($_REQUEST['regenerate_thumbnails'])) {
$okt->redirect('module.php?m=galleries&minregenerated=1');
}
}
# Switch statut
if (!empty($_GET['switch_status']) && $okt->checkPerm('galleries_manage')) {
try {
$okt->galleries->tree->switchGalleryStatus($_GET['switch_status']);
# log admin
$okt->logAdmin->info(array('code' => 32, 'component' => 'galleries', 'message' => 'category #' . $_GET['switch_status']));
$okt->redirect('module.php?m=galleries&switched=1');
} catch (Exception $e) {
示例9: Exception
#
# This file is part of QrazyTimes2, a theme for Dotclear 2.
# Pierre Van Glabeke
#
# Licensed under the GPL version 2.0 license.
# See LICENSE file or
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) {
return;
}
global $core;
//PARAMS
# Translations
l10n::set(dirname(__FILE__) . '/locales/' . $_lang . '/main');
# Default values
$default_about = false;
# Settings
$my_about = $core->blog->settings->themes->qrazytimes2_about;
# About
$html_fileabout = path::real($core->blog->themes_path) . '/' . $core->blog->settings->system->theme . '/tpl/_about.html';
if (!is_file($html_fileabout) && !is_writable(dirname($html_fileabout))) {
throw new Exception(sprintf(__('File %s does not exist and directory %s is not writable.'), $css_fileabout, dirname($html_fileabout)));
}
// POST ACTIONS
if (!empty($_POST)) {
try {
$core->blog->settings->addNamespace('themes');
# About
if (!empty($_POST['qrazytimes2_about'])) {
示例10: displayPublicAdminBar
public static function displayPublicAdminBar($okt)
{
$aBasesUrl = new ArrayObject();
$aPrimaryAdminBar = new ArrayObject();
$aSecondaryAdminBar = new ArrayObject();
$aBasesUrl['admin'] = $okt->config->app_path . OKT_ADMIN_DIR;
$aBasesUrl['logout'] = $aBasesUrl['admin'] . '/index.php?logout=1';
$aBasesUrl['profil'] = $aBasesUrl['admin'];
# -- CORE TRIGGER : publicAdminBarBeforeDefaultsItems
$okt->triggers->callTrigger('publicAdminBarBeforeDefaultsItems', $okt, $aPrimaryAdminBar, $aSecondaryAdminBar, $aBasesUrl);
# éléments première barre
$aPrimaryAdminBar[10] = array('intitle' => '<img src="' . OKT_PUBLIC_URL . '/img/notify/error.png" width="22" height="22" alt="' . __('c_c_warning') . '" />', 'items' => array());
$aPrimaryAdminBar[100] = array('href' => $aBasesUrl['admin'], 'intitle' => __('c_c_administration'));
$aPrimaryAdminBar[200] = array('intitle' => __('c_c_action_Add'), 'items' => array());
# éléments seconde barre
$aSecondaryAdminBar[100] = array('href' => $aBasesUrl['profil'], 'intitle' => sprintf(__('c_c_user_hello_%s'), html::escapeHTML(oktAuth::getUserCN($okt->user->username, $okt->user->lastname, $okt->user->firstname))));
if (!$okt->languages->unique) {
$iStartIdx = 150;
foreach ($okt->languages->list as $aLanguage) {
if ($aLanguage['code'] == $okt->user->language) {
continue;
}
$aSecondaryAdminBar[$iStartIdx++] = array('href' => html::escapeHTML($okt->config->app_path . $aLanguage['code'] . '/'), 'title' => html::escapeHTML($aLanguage['title']), 'intitle' => '<img src="' . OKT_PUBLIC_URL . '/img/flags/' . $aLanguage['img'] . '" alt="' . html::escapeHTML($aLanguage['title']) . '" />');
}
}
$aSecondaryAdminBar[200] = array('href' => $aBasesUrl['logout'], 'intitle' => __('c_c_user_log_off_action'));
# infos super-admin
if ($okt->checkPerm('is_superadmin')) {
# avertissement nouvelle version disponible
if ($okt->config->update_enabled && is_readable(OKT_DIGESTS)) {
$updater = new oktUpdate($okt->config->update_url, 'okatea', $okt->config->update_type, OKT_CACHE_PATH . '/versions');
$new_v = $updater->check(util::getVersion());
if ($updater->getNotify() && $new_v) {
# locales
l10n::set(OKT_LOCALES_PATH . '/' . $okt->user->language . '/admin.update');
$aPrimaryAdminBar[10]['items'][100] = array('href' => $aBasesUrl['admin'] . '/configuration.php?action=update', 'intitle' => sprintf(__('c_a_update_okatea_%s_available'), $new_v));
}
}
# avertissement mode maintenance est activé sur la partie publique
if ($okt->config->public_maintenance_mode) {
$aPrimaryAdminBar[10]['items'][300] = array('href' => $aBasesUrl['admin'] . '/configuration.php?action=advanced#tab_others', 'intitle' => sprintf(__('c_a_public_maintenance_mode_enabled'), $new_v));
}
# avertissement mode maintenance est activé sur l'admin
if ($okt->config->admin_maintenance_mode) {
$aPrimaryAdminBar[10]['items'][400] = array('href' => $aBasesUrl['admin'] . '/configuration.php?action=advanced#tab_others', 'intitle' => sprintf(__('c_a_admin_maintenance_mode_enabled'), $new_v));
}
# info execution
$aExecInfos = array();
$aExecInfos['execTime'] = util::getExecutionTime();
if (OKT_XDEBUG) {
$aExecInfos['memUsage'] = util::l10nFileSize(xdebug_memory_usage());
$aExecInfos['peakUsage'] = util::l10nFileSize(xdebug_peak_memory_usage());
} else {
$aExecInfos['memUsage'] = util::l10nFileSize(memory_get_usage());
$aExecInfos['peakUsage'] = util::l10nFileSize(memory_get_peak_usage());
}
$aSecondaryAdminBar[1000] = array('title' => $aExecInfos['execTime'] . ' s - ' . $aExecInfos['memUsage'], 'intitle' => '<img src="' . OKT_PUBLIC_URL . '/img/ico/terminal.gif" width="16" height="16" alt="" />', 'items' => array(array('intitle' => 'Temps d\'execution du script : ' . $aExecInfos['execTime'] . ' s'), array('intitle' => 'Mémoire utilisée par PHP : ' . $aExecInfos['memUsage']), array('intitle' => 'Pic mémoire allouée par PHP : ' . $aExecInfos['peakUsage']), array('intitle' => 'Router lang : ' . $okt->router->getLanguage()), array('intitle' => 'Router path : ' . $okt->router->getPath()), array('intitle' => 'Router route ID : ' . $okt->router->getFindedRouteId())));
if (!empty($okt->page->module)) {
$aSecondaryAdminBar[1000]['items'][] = array('intitle' => '$okt->page->module : ' . $okt->page->module);
}
if (!empty($okt->page->action)) {
$aSecondaryAdminBar[1000]['items'][] = array('intitle' => '$okt->page->action : ' . $okt->page->action);
}
}
# -- CORE TRIGGER : publicAdminBarItems
$okt->triggers->callTrigger('publicAdminBarItems', $okt, $aPrimaryAdminBar, $aSecondaryAdminBar, $aBasesUrl);
# sort items of by keys
$aPrimaryAdminBar->ksort();
$aSecondaryAdminBar->ksort();
# remove empty values of admins bars
$aPrimaryAdminBar = array_filter((array) $aPrimaryAdminBar);
$aSecondaryAdminBar = array_filter((array) $aSecondaryAdminBar);
# reverse sedond bar items
$aSecondaryAdminBar = array_reverse($aSecondaryAdminBar);
$class = '';
?>
<div id="oktadminbar" class="<?php
echo $class;
?>
" role="navigation">
<a class="screen-reader-shortcut" href="#okt-toolbar" tabindex="1"><?php
_e('Skip to toolbar');
?>
</a>
<div class="quicklinks" id="okt-toolbar" role="navigation"
aria-label="<?php
echo util::escapeAttrHTML(__('Top navigation toolbar.'));
?>
"
tabindex="0">
<ul class="ab-top-menu">
<?php
foreach ($aPrimaryAdminBar as $aPrimaryItem) {
echo self::getItems($aPrimaryItem);
}
?>
</ul>
<ul class="ab-top-secondary ab-top-menu">
<?php
foreach ($aSecondaryAdminBar as $aSecondaryItem) {
//.........这里部分代码省略.........
示例11: oktThemeEditor
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* La page de création de fichier de l'éditeur de themes.
*
* @addtogroup Okatea
*/
# Accès direct interdit
if (!defined('ON_THEME_EDITOR')) {
die;
}
/* Initialisations
----------------------------------------------------------*/
# locales
l10n::set(OKT_LOCALES_PATH . '/' . $okt->user->language . '/admin.theme.editor');
$sThemeId = !empty($_REQUEST['theme']) ? $_REQUEST['theme'] : null;
$oThemeEditor = new oktThemeEditor($okt, OKT_THEMES_DIR, OKT_THEMES_PATH);
if ($sThemeId) {
try {
$oThemeEditor->loadTheme($sThemeId);
} catch (Exception $e) {
$okt->error->set($e->getMessage());
$sThemeId = null;
}
} else {
$okt->error->set(__('c_a_te_error_choose_theme'));
}
/* Traitements
----------------------------------------------------------*/
# formulaire envoyé
示例12: name
/**
This method will search for file <var>$file</var> in language
<var>$lang</var> for module <var>$id</var>.
<var>$file</var> should not have any extension.
@param id <b>string</b> Module ID
@param lang <b>string</b> Language code
@param file <b>string</b> File name (without extension)
*/
public function loadModuleL10N($id, $lang, $file)
{
if (!$lang || !isset($this->modules[$id])) {
return;
}
$lfile = $this->modules[$id]['root'] . '/locales/%s/%s';
if (l10n::set(sprintf($lfile, $lang, $file)) === false && $lang != 'en') {
l10n::set(sprintf($lfile, 'en', $file));
}
}
示例13: ArrayObject
<?php
/**
* @ingroup okt_module_news
* @brief Page de gestion des rubriques
*
*/
# Accès direct interdit
if (!defined('ON_NEWS_MODULE')) {
die;
}
/* Initialisations
----------------------------------------------------------*/
# Chargement des locales
l10n::set(__DIR__ . '/../../locales/' . $okt->user->language . '/admin.categories');
# Récupération de la liste complète des rubriques
$rsCategories = $okt->news->categories->getCategories(array('active' => 2, 'with_count' => true, 'language' => $okt->user->language));
$iCategoryId = null;
$aCategoryData = new ArrayObject();
$aCategoryLocalesData = new ArrayObject();
$aCategoryData['active'] = 1;
$aCategoryData['parent_id'] = 0;
$aCategoryData['tpl'] = '';
$aCategoryData['items_tpl'] = '';
foreach ($okt->languages->list as $aLanguage) {
$aCategoryLocalesData[$aLanguage['code']] = array();
$aCategoryLocalesData[$aLanguage['code']]['title'] = '';
$aCategoryLocalesData[$aLanguage['code']]['content'] = '';
if ($okt->news->config->enable_metas) {
$aCategoryLocalesData[$aLanguage['code']]['title_seo'] = '';
$aCategoryLocalesData[$aLanguage['code']]['title_tag'] = '';
示例14: publicHeadContent
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of QrazyTimes2, a theme for Dotclear 2.
# Pierre Van Glabeke
#
# Licensed under the GPL version 2.0 license.
# See LICENSE file or
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')) {
return;
}
l10n::set(dirname(__FILE__) . '/locales/' . $_lang . '/public');
# appel css about
if ($core->blog->settings->themes->qrazytimes2_about) {
$core->addBehavior('publicHeadContent', array('tplQrazytimes2_about', 'publicHeadContent'));
}
class tplQrazytimes2_about
{
public static function publicHeadContent($core)
{
$url = $core->blog->settings->system->themes_url . '/' . $core->blog->settings->system->theme;
echo '<link rel="stylesheet" type="text/css" media="screen" href="' . $url . "/about.css\" />\n";
}
}
示例15: intval
<?php
/**
* @ingroup okt_module_galleries
* @brief Ajout de plusieurs éléments d'un coup
*
*/
# Accès direct interdit
if (!defined('ON_GALLERIES_MODULE')) {
die;
}
/* Initialisations
----------------------------------------------------------*/
# Chargement des locales
l10n::set(__DIR__ . '/../../../locales/' . $okt->user->language . '/admin.plupload');
$iGalleryId = !empty($_REQUEST['gallery_id']) ? intval($_REQUEST['gallery_id']) : null;
$aItemLocalesData = array();
foreach ($okt->languages->list as $aLanguage) {
$aItemLocalesData[$aLanguage['code']] = array();
$aItemLocalesData[$aLanguage['code']]['title'] = '';
}
/* Traitements
----------------------------------------------------------*/
# ajout d'éléments
if (!empty($_POST['sended'])) {
$okt->galleries->items->regenMinImages($iGalleryId);
$okt->redirect('module.php?m=galleries&action=items&gallery_id=' . $iGalleryId);
}
/* Affichage
----------------------------------------------------------*/
$okt->page->addButton('galleriesBtSt', array('permission' => true, 'title' => __('c_c_action_Go_back'), 'url' => $iGalleryId ? 'module.php?m=galleries&action=items&gallery_id=' . $iGalleryId : 'module.php?m=galleries&action=index', 'ui-icon' => 'arrowreturnthick-1-w'), 'before');