mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
issue 1641, fixed a bug, Display user lang TRUE key code when selecting undefined language
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10407 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
89f224420c
commit
8aa01caea2
2 changed files with 60 additions and 13 deletions
|
|
@ -598,21 +598,55 @@
|
|||
$cache_path = _XE_PATH_.'files/cache/lang_defined/';
|
||||
if(!is_dir($cache_path)) FileHandler::makeDir($cache_path);
|
||||
|
||||
$lang_supported = Context::get('lang_supported');
|
||||
foreach($lang_supported as $key => $val) {
|
||||
$fp[$key] = fopen( sprintf('%s/%d.%s.php', $cache_path, $args->site_srl, $key), 'w' );
|
||||
if(!$fp[$key]) return;
|
||||
fwrite($fp[$key],"<?php if(!defined('__ZBXE__')) exit(); \r\n");
|
||||
}
|
||||
|
||||
$langMap = array();
|
||||
foreach($output->data as $key => $val) {
|
||||
if($fp[$val->lang_code]) fwrite($fp[$val->lang_code], sprintf('$lang["%s"] = "%s";'."\r\n", $val->name, str_replace('"','\\"',$val->value)));
|
||||
$langMap[$val->lang_code][$val->name] = $val->value;
|
||||
}
|
||||
|
||||
foreach($lang_supported as $key => $val) {
|
||||
if(!$fp[$key]) continue;
|
||||
fwrite($fp[$key],"?>");
|
||||
fclose($fp[$key]);
|
||||
$lang_supported = Context::get('lang_supported');
|
||||
$dbInfo = Context::getDBInfo();
|
||||
$defaultLang = $dbInfo->lang_type;
|
||||
|
||||
if(!is_array($langMap[$defaultLang]))
|
||||
{
|
||||
$langMap[$defaultLang] = array();
|
||||
}
|
||||
|
||||
foreach($lang_supported as $langCode => $langName) {
|
||||
if(!is_array($langMap[$langCode]))
|
||||
{
|
||||
$langMap[$langCode] = array();
|
||||
}
|
||||
|
||||
$langMap[$langCode] += $langMap[$defaultLang];
|
||||
foreach($lang_supported as $targetLangCode => $targetLangName)
|
||||
{
|
||||
if($langCode == $targetLangCode || $langCode == $defaultLang)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!is_array($langMap[$targetLangCode]))
|
||||
{
|
||||
$langMap[$targetLangCode] = array();
|
||||
}
|
||||
|
||||
$langMap[$langCode] += $langMap[$targetLangCode];
|
||||
}
|
||||
|
||||
$fp = fopen(sprintf('%s/%d.%s.php', $cache_path, $args->site_srl, $langCode), 'w');
|
||||
if(!$fp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
fwrite($fp, "<?php if(!defined('__XE__')) exit(); \r\n");
|
||||
|
||||
foreach($langMap[$langCode] as $code => $value)
|
||||
{
|
||||
fwrite($fp, sprintf('$lang[\'%s\'] = \'%s\';', $code, addcslashes($value, "'")));
|
||||
}
|
||||
|
||||
fwrite($fp, '?>');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -699,6 +699,8 @@
|
|||
}
|
||||
function _replaceLangCode($matches) {
|
||||
static $lang = null;
|
||||
|
||||
|
||||
if(is_null($lang)) {
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
if(!$site_module_info){
|
||||
|
|
@ -712,7 +714,18 @@
|
|||
$oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl);
|
||||
}
|
||||
|
||||
if(file_exists($cache_file)) require_once($cache_file);
|
||||
if(file_exists($cache_file))
|
||||
{
|
||||
$moduleAdminControllerMtime = filemtime(_XE_PATH_ . 'modules/module/module.admin.controller.php');
|
||||
$cacheFileMtime = filemtime($cache_file);
|
||||
if($cacheFileMtime < $moduleAdminControllerMtime)
|
||||
{
|
||||
$oModuleAdminController = &getAdminController('module');
|
||||
$oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl);
|
||||
}
|
||||
|
||||
require_once($cache_file);
|
||||
}
|
||||
}
|
||||
if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue