Added the global switch to set the percentage a language should be translated before it is automatically added to the component during compilation. Force language to be added when the debug lines are set to be added.

This commit is contained in:
dev
2017-04-06 09:47:51 +01:00
parent d9b2e51f8c
commit b1d9b672ab
192 changed files with 230 additions and 202 deletions

View File

@ -160,7 +160,14 @@ class Get
*
* @var boolean
*/
public $loadLineNr = false;
public $debugLinenr = false;
/*
* The percentage when a language should be added
*
* @var boolean
*/
public $percentageLanguageAdd = 0;
/**
* The Placholder Language prefix
@ -496,7 +503,7 @@ class Get
$this->addPlaceholders = ((int) $config['addPlaceholders'] == 0) ? false : (((int) $config['addPlaceholders'] == 1) ? true : $global);
// set if line numbers should be added to comments
$global = ((int) ComponentbuilderHelper::getVar('joomla_component', $this->componentID, 'id', 'debug_linenr') == 1) ? true:false;
$this->loadLineNr = ((int) $config['debugLinenr'] == 0) ? false : (((int) $config['debugLinenr'] == 1) ? true : $global);
$this->debugLinenr = ((int) $config['debugLinenr'] == 0) ? false : (((int) $config['debugLinenr'] == 1) ? true : $global);
// set the current user
$this->user = JFactory::getUser();
// Get a db connection.
@ -511,7 +518,9 @@ class Get
}
// get the component data
$this->componentData = $this->getComponentData();
// set the percentage when a language can be added
$this->percentageLanguageAdd = (int) $this->params->get('percentageLanguageAdd', 50);
return true;
}
}
@ -528,7 +537,7 @@ class Get
*/
private function setLine($nr)
{
if ($this->loadLineNr)
if ($this->debugLinenr)
{
return ' [Get '.$nr.']';
}

View File

@ -359,7 +359,7 @@ class Structure extends Get
*/
private function setLine($nr)
{
if ($this->loadLineNr)
if ($this->debugLinenr)
{
return ' [Structure '.$nr.']';
}

View File

@ -351,7 +351,7 @@ class Fields extends Structure
*/
private function setLine($nr)
{
if ($this->loadLineNr)
if ($this->debugLinenr)
{
return ' [Fields '.$nr.']';
}

View File

@ -75,7 +75,7 @@ class Interpretation extends Fields
*/
private function setLine($nr)
{
if ($this->loadLineNr)
if ($this->debugLinenr)
{
return ' [Interpretation '.$nr.']';
}

View File

@ -61,7 +61,7 @@ class Infusion extends Interpretation
*/
private function setLine($nr)
{
if ($this->loadLineNr)
if ($this->debugLinenr)
{
return ' [Infusion '.$nr.']';
}
@ -1110,13 +1110,17 @@ class Infusion extends Interpretation
{
foreach ($areas as $area => $languageStrings)
{
// check if we sould install this translation (must be atleast 50% ready
$dif = bcdiv(count($languageStrings), $mainLangLoader[$area]);
$percentage = bcmul($dif, 100);
if ($percentage < 50)
// force load if debug lines are added
if (!$this->debugLinenr)
{
// dont add
continue;
// check if we sould install this translation
$dif = bcdiv(count($languageStrings), $mainLangLoader[$area]);
$percentage = bcmul($dif, 100);
if ($percentage < $this->percentageLanguageAdd)
{
// dont add
continue;
}
}
$p = 'admin';
$t = '';