function smarty_function_cms_set_language($params, &$template) { $lang = null; if (isset($params['lang'])) { $lang = trim($params['lang']); } $res = CmsNlsOperations::set_language($lang); }
} cmsms()->set_variable('content_obj', $contentobj); cmsms()->set_variable('content_id', $contentobj->Id()); cmsms()->set_variable('page_id', $page); cmsms()->set_variable('page_name', $contentobj->Alias()); cmsms()->set_variable('position', $contentobj->Hierarchy()); cmsms()->set_variable('friendly_position', $contentops->CreateFriendlyHierarchyPosition($contentobj->Hierarchy())); $smarty->assign('content_obj', $contentobj); $smarty->assign('content_id', $contentobj->Id()); $smarty->assign('page', $page); $smarty->assign('page_id', $page); $smarty->assign('page_name', $contentobj->Alias()); $smarty->assign('page_alias', $contentobj->Alias()); $smarty->assign('position', $contentobj->Hierarchy()); $smarty->assign('friendly_position', $gCms->variables['friendly_position']); CmsNlsOperations::set_language(); // <- NLS detection for frontend $smarty->assign('lang', CmsNlsOperations::get_current_language()); $smarty->assign('encoding', CmsNlsOperations::get_encoding()); $html = ''; $showtemplate = true; if (isset($_REQUEST['showtemplate']) && $_REQUEST['showtemplate'] == 'false' || isset($smarty->id) && $smarty->id != '' && isset($_REQUEST[$smarty->id . 'showtemplate']) && $_REQUEST[$smarty->id . 'showtemplate'] == 'false') { $showtemplate = false; } $smarty->set_global_cacheid('p' . $contentobj->Id()); $uid = get_userid(FALSE); if ($contentobj->Cachable() && $showtemplate && !$uid && get_site_preference('use_smartycache', 0)) { if (version_compare(phpversion(), '5.3') >= 0) { // this content is cachable... so enable smarty caching of this page data, for this user. $smarty->setCaching(Smarty::CACHING_LIFETIME_CURRENT); }
cms_cookies::set("cms_language", $_POST["change_cms_lang"]); } } } else { if (isset($_SESSION['login_cms_language'])) { debug_buffer('Setting language to: ' . $_SESSION['login_cms_language']); $current_language = $_SESSION['login_cms_language']; cms_cookies::set('cms_language', $_SESSION['login_cms_language']); unset($_SESSION['login_cms_language']); } else { if (isset($_COOKIE["cms_language"])) { $current_language = $_COOKIE["cms_language"]; } } } #First load the english one so that we have strings to fall back on $base_lang = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR; @(include $base_lang . 'en_US.php'); #Now load the real file if ($current_language != 'en_US') { $file = $base_lang . 'ext' . DIRECTORY_SEPARATOR . $current_language . '.php'; if (!is_file($file)) { $file = $base_lang . $current_language . '.php'; } if (is_file($file) && strlen($current_language) == 5 && strpos($current_language, ".") === false) { include $file; } } $info = CmsNlsOperations::set_language($current_language); } # vim:ts=4 sw=4 noet
$header .= '<span class="helptext"><a href="listmodules.php?' . CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY] . '&action=showmodulehelp&module=' . $module . '&lang=en_US">' . lang('modulehelp_english') . '</a></span>'; } } $header .= '</div>'; echo $header; // this is ugly hacky stuff to ajust the language temporarily. $mod_old_lang = $modinstance->curlang; $modinstance->params = array(array('name' => 'lang', 'default' => 'en_US', 'optional' => true)); if (isset($_GET['lang'])) { $modinstance->curlang = trim($_GET['lang']); } echo @$modinstance->GetHelpPage(); $modinstance->params = array(array('name' => 'lang', 'default' => 'en_US', 'optional' => true)); $modinstance->curlang = $mod_old_lang; echo "</div>"; CmsNlsOperations::set_language($orig_lang); } echo '<p class="pageback"><a class="pageback" href="' . $thisurl . '">« ' . lang('back') . '</a></p>'; } else { if ($action == 'missingdeps') { echo '<div class="pagecontainer">'; echo '<p class="pageheader">' . lang('depsformodule', array($module)) . '</p>'; echo '<table cellspacing="0" class="AdminTable">'; echo '<thead>'; echo '<tr><th>' . lang('name') . '</th><th>' . lang('minimumversion') . '</th><th>' . lang('installed') . '</th></tr>'; echo '</thead>'; echo '<tbody>'; $modinstance = $modops->get_module_instance($module, '', true); if (is_object($modinstance)) { if (count($modinstance->GetDependencies()) > 0) { $curclass = 'row1';
/** * Temporarily override the current frontend language * * @string lang, the language to set. If empty, the system will be restored to the default frontend language. * @deprecated */ function cms_set_frontend_language($lang = '') { return CmsNlsOperations::set_language($lang); }