* adjust for build lang file.
This commit is contained in:
@@ -21,7 +21,7 @@ include dirname(__FILE__) . '/base/router.class.php';
|
||||
class router extends baseRouter
|
||||
{
|
||||
/**
|
||||
* Add config langs.
|
||||
* Add custom langs when set client lang.
|
||||
*
|
||||
* @param string $lang zh-cn|zh-tw|zh-hk|en
|
||||
* @access public
|
||||
|
||||
@@ -210,7 +210,7 @@ $lang->action->label->createchildren = "创建子任务";
|
||||
$lang->action->label->managed = "维护";
|
||||
|
||||
/* 动态信息按照对象分组 */
|
||||
$lang->action->dynamicAction = new stdclass;
|
||||
$lang->action->dynamicAction = new stdclass();
|
||||
$lang->action->dynamicAction->todo['opened'] = '创建待办';
|
||||
$lang->action->dynamicAction->todo['edited'] = '编辑待办';
|
||||
$lang->action->dynamicAction->todo['erased'] = '删除待办';
|
||||
|
||||
@@ -152,6 +152,7 @@ class translateModel extends model
|
||||
{
|
||||
if(strpos($line, '$lang') === 0 and strpos($line, '=') !== false)
|
||||
{
|
||||
if(strpos($line, '.=') !== false) continue;
|
||||
$position = strpos($line, '=');
|
||||
$key = trim(substr($line, 0, $position));
|
||||
$value = trim(substr($line, $position + 1));
|
||||
@@ -229,8 +230,14 @@ class translateModel extends model
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getLangItemCount()
|
||||
public function getLangItemCount($module = '')
|
||||
{
|
||||
if(!empty($module))
|
||||
{
|
||||
$items = $this->getModuleLangs($module, 'zh-cn');
|
||||
return count($items);
|
||||
}
|
||||
|
||||
$moduleGroups = $this->getModules();
|
||||
$moduleRoot = $this->app->getModuleRoot();
|
||||
$itemCount = 0;
|
||||
@@ -455,7 +462,7 @@ class translateModel extends model
|
||||
$inFlow = false;
|
||||
foreach($flows as $flow)
|
||||
{
|
||||
if(strpos($line, 'config->global->flow') !== false and strpos($line, $flow) === false)
|
||||
if(strpos($line, 'config->global->flow') !== false and strpos($line, $flow) !== false)
|
||||
{
|
||||
$inFlow = true;
|
||||
break;
|
||||
@@ -481,7 +488,7 @@ class translateModel extends model
|
||||
{
|
||||
$content .= $line . "\n";
|
||||
}
|
||||
elseif($inFlow and strpos($line, '$lang') === 0 and strpos($line, '=') !== false)
|
||||
elseif($inFlow and strpos($line, '$lang') === 0 and strpos($line, '=') !== false and strpos($line, '.=') === false)
|
||||
{
|
||||
$position = strpos($line, '=');
|
||||
$key = trim(substr($line, 0, $position));
|
||||
@@ -493,7 +500,7 @@ class translateModel extends model
|
||||
{
|
||||
if(strpos($value, '.') === false)
|
||||
{
|
||||
$value = '"' . addslashes($value) . '"';
|
||||
$value = "'" . addslashes($value) . "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -569,6 +576,10 @@ class translateModel extends model
|
||||
$content .= $line . "\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$content .= $line . "\n";
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
@@ -583,8 +594,9 @@ class translateModel extends model
|
||||
public function checkNeedTranslate($value)
|
||||
{
|
||||
$result = true;
|
||||
if($value == 'new stdclass()') $result = false;
|
||||
if(strpos($value, '$') === 0 and strpos($value, '$lang->productCommon') === false and strpos($value, '$lang->projectCommon') === false and strpos($value, '.') === false) $result = false;
|
||||
$tolowerValue = strtolower($value);
|
||||
if($tolowerValue == 'new stdclass()' or $tolowerValue == 'new stdclass') $result = false;
|
||||
if(strpos($value, '$') === 0 and strpos($value, '$lang->productCommon') === false and strpos($value, '$lang->projectCommon') === false and strpos($value, '.') === false and !preg_match('/[^\$\-\>\w]/', $value)) $result = false;
|
||||
if($value == '$lang->productCommon' or $value == '$lang->projectCommon') $result = false;
|
||||
|
||||
return $result;
|
||||
|
||||
@@ -41,7 +41,21 @@
|
||||
<?php if(!isset($modules[$group])) continue;?>
|
||||
<?php $i = 0;?>
|
||||
<?php foreach($modules[$group] as $module):?>
|
||||
<?php $moduleStatistics = $statistics[$module];?>
|
||||
<?php
|
||||
if(isset($statistics[$module]))
|
||||
{
|
||||
$moduleStatistics = $statistics[$module];
|
||||
$moduleStatistics->count = $this->translate->getLangItemCount($module);
|
||||
}
|
||||
else
|
||||
{
|
||||
$moduleStatistics = new stdclass();
|
||||
$moduleStatistics->count = $this->translate->getLangItemCount($module);
|
||||
$moduleStatistics->translated = 0;
|
||||
$moduleStatistics->changed = 0;
|
||||
$moduleStatistics->reviewed = 0;
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<?php if($i == 0):?>
|
||||
<th rowspan='<?php echo count($modules[$group]);?>' class='w-100px text-middle'>
|
||||
|
||||
Reference in New Issue
Block a user