gh-60 language translation component added, basic implementation
This commit is contained in:
@ -163,11 +163,11 @@ class Get
|
||||
public $loadLineNr = false;
|
||||
|
||||
/**
|
||||
* The Language prefix
|
||||
* The Placholder Language prefix
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $langPrefix = 'COM_';
|
||||
public $langPrefix;
|
||||
|
||||
/**
|
||||
* The Language content
|
||||
@ -176,6 +176,34 @@ class Get
|
||||
*/
|
||||
public $langContent = array();
|
||||
|
||||
/**
|
||||
* The Languages bucket
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $languages = array('en-GB' => array());
|
||||
|
||||
/**
|
||||
* The Multi Languages bucket
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $multiLangString = array();
|
||||
|
||||
/**
|
||||
* The new lang to add
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $newLangStrings = array();
|
||||
|
||||
/**
|
||||
* The existing lang to update
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $existingLangStrings = array();
|
||||
|
||||
/**
|
||||
* The Component Code Name
|
||||
*
|
||||
@ -460,7 +488,7 @@ class Get
|
||||
if ($name_code = ComponentbuilderHelper::getVar('joomla_component', $this->componentID, 'id', 'name_code'))
|
||||
{
|
||||
// set lang prefix
|
||||
$this->langPrefix .= ComponentbuilderHelper::safeString($name_code,'U');
|
||||
$this->langPrefix = 'COM_'.ComponentbuilderHelper::safeString($name_code,'U');
|
||||
// set component code name
|
||||
$this->componentCodeName = ComponentbuilderHelper::safeString($name_code);
|
||||
// set if placeholders should be added to customcode
|
||||
@ -2979,6 +3007,230 @@ class Get
|
||||
unset($this->$remove);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other languages
|
||||
*
|
||||
* @param array $values The lang strings to get
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public function getMultiLangStrings($values)
|
||||
{
|
||||
// Create a new query object.
|
||||
$query = $this->db->getQuery(true);
|
||||
$query->from($this->db->quoteName('#__componentbuilder_language_translation','a'));
|
||||
if (ComponentbuilderHelper::checkArray($values))
|
||||
{
|
||||
$query->select($this->db->quoteName(array('a.id','a.translation','a.entranslation','a.components')));
|
||||
$query->where($this->db->quoteName('a.entranslation') . ' IN (' . implode(',',array_map(function($a){ return $this->db->quote($a); }, $values)) . ')');
|
||||
$query->where($this->db->quoteName('a.published') . ' >= 1');
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
if ($this->db->getNumRows())
|
||||
{
|
||||
return $this->db->loadAssocList('entranslation');
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Current language values to DB
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public function setLangPlaceholders(&$strings)
|
||||
{
|
||||
$counterInsert = 0;
|
||||
$counterUpdate = 0;
|
||||
$today = JFactory::getDate()->toSql();
|
||||
foreach ($this->languages['en-GB'] as $area => $placeholders)
|
||||
{
|
||||
foreach ($placeholders as $placeholder => $string)
|
||||
{
|
||||
// to keep or remove
|
||||
$remove = false;
|
||||
// build the tranlations
|
||||
if (isset($this->multiLangString[$string]))
|
||||
{
|
||||
// make sure we have converted the string to array
|
||||
if (isset($this->multiLangString[$string]['translation']) && ComponentbuilderHelper::checkJson($this->multiLangString[$string]['translation']))
|
||||
{
|
||||
$this->multiLangString[$string]['translation'] = json_decode($this->multiLangString[$string]['translation'], true);
|
||||
}
|
||||
// if we have an array continue
|
||||
if (isset($this->multiLangString[$string]['translation'])
|
||||
&& ComponentbuilderHelper::checkArray($this->multiLangString[$string]['translation'])
|
||||
&& isset($this->multiLangString[$string]['translation']['translation'])
|
||||
&& isset($this->multiLangString[$string]['translation']['language'])
|
||||
&& ComponentbuilderHelper::checkArray($this->multiLangString[$string]['translation']['language'])
|
||||
&& ComponentbuilderHelper::checkArray($this->multiLangString[$string]['translation']['translation']))
|
||||
{
|
||||
// great lets build the multi languages strings
|
||||
foreach ($this->multiLangString[$string]['translation']['translation'] as $at => $lang)
|
||||
{
|
||||
$_tag = $this->multiLangString[$string]['translation']['language'][$at];
|
||||
// build arrays
|
||||
if (!isset($this->languages[$_tag]))
|
||||
{
|
||||
$this->languages[$_tag] = array();
|
||||
}
|
||||
if (!isset($this->languages[$_tag][$area]))
|
||||
{
|
||||
$this->languages[$_tag][$area] = array();
|
||||
}
|
||||
$this->languages[$_tag][$area][$placeholder] = $lang;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove this string not to be checked again
|
||||
$remove = true;
|
||||
}
|
||||
}
|
||||
// do the database managment
|
||||
if(($key = array_search($string, $strings)) !== false)
|
||||
{
|
||||
if (isset($this->multiLangString[$string]))
|
||||
{
|
||||
// update the existing placeholder in db
|
||||
$id = $this->multiLangString[$string]['id'];
|
||||
if (ComponentbuilderHelper::checkJson($this->multiLangString[$string]['components']))
|
||||
{
|
||||
$components = (array) json_decode($this->multiLangString[$string]['components'], true);
|
||||
if (in_array($this->componentID, $components))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$components[] = $this->componentID;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$components = array($this->componentID);
|
||||
}
|
||||
// start the bucket for this lang
|
||||
$this->existingLangStrings[$counterUpdate] = array();
|
||||
$this->existingLangStrings[$counterUpdate]['id'] = (int) $id;
|
||||
$this->existingLangStrings[$counterUpdate]['conditions'] = array();
|
||||
$this->existingLangStrings[$counterUpdate]['conditions'][] = $this->db->quoteName('id') . ' = ' . $this->db->quote($id);
|
||||
$this->existingLangStrings[$counterUpdate]['fields'] = array();
|
||||
$this->existingLangStrings[$counterUpdate]['fields'][] = $this->db->quoteName('components') . ' = ' . $this->db->quote(json_encode($components));
|
||||
|
||||
$counterUpdate++;
|
||||
|
||||
// load to db
|
||||
$this->setExistingLangStrings(50);
|
||||
// remove string if needed
|
||||
if ($remove)
|
||||
{
|
||||
unset($this->multiLangString[$string]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// add the new lang placeholder to the db
|
||||
$this->newLangStrings[$counterInsert] = array();
|
||||
$this->newLangStrings[$counterInsert][] = $this->db->quote(json_encode(array($this->componentID))); // 'components'
|
||||
$this->newLangStrings[$counterInsert][] = $this->db->quote($string); // 'entranslation'
|
||||
$this->newLangStrings[$counterInsert][] = $this->db->quote(1); // 'published'
|
||||
$this->newLangStrings[$counterInsert][] = $this->db->quote($today); // 'created'
|
||||
$this->newLangStrings[$counterInsert][] = $this->db->quote((int) $this->user->id); // 'created_by'
|
||||
$this->newLangStrings[$counterInsert][] = $this->db->quote(1); // 'version'
|
||||
$this->newLangStrings[$counterInsert][] = $this->db->quote(1); // 'access'
|
||||
|
||||
$counterInsert++;
|
||||
|
||||
// load to db
|
||||
$this->setNewLangStrings(100);
|
||||
}
|
||||
// only set the string once
|
||||
unset($strings[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// just to make sure all is done
|
||||
$this->setExistingLangStrings();
|
||||
$this->setNewLangStrings();
|
||||
}
|
||||
|
||||
/**
|
||||
* store the language placeholders
|
||||
*
|
||||
* @param int $when To set when to update
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function setNewLangStrings($when = 1)
|
||||
{
|
||||
if (count($this->newLangStrings) >= $when)
|
||||
{
|
||||
// Create a new query object.
|
||||
$query = $this->db->getQuery(true);
|
||||
$continue = false;
|
||||
// Insert columns.
|
||||
$columns = array('components','entranslation','published','created','created_by','version','access');
|
||||
// Prepare the insert query.
|
||||
$query->insert($this->db->quoteName('#__componentbuilder_language_translation'));
|
||||
$query->columns($this->db->quoteName($columns));
|
||||
foreach($this->newLangStrings as $values)
|
||||
{
|
||||
if (count($values) == 7)
|
||||
{
|
||||
$query->values(implode(',', $values));
|
||||
$continue = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO line mismatch... should not happen
|
||||
}
|
||||
}
|
||||
// clear the values array
|
||||
$this->newLangStrings = array();
|
||||
if (!$continue)
|
||||
{
|
||||
return false; // insure we dont continue if no values were loaded
|
||||
}
|
||||
// Set the query using our newly populated query object and execute it.
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* update the language placeholders
|
||||
*
|
||||
* @param int $when To set when to update
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function setExistingLangStrings($when = 1)
|
||||
{
|
||||
if (count($this->existingLangStrings) >= $when)
|
||||
{
|
||||
foreach($this->existingLangStrings as $values)
|
||||
{
|
||||
// Create a new query object.
|
||||
$query = $this->db->getQuery(true);
|
||||
// Prepare the update query.
|
||||
$query->update($this->db->quoteName('#__componentbuilder_language_translation'))->set($values['fields'])->where($values['conditions']);
|
||||
// Set the query using our newly populated query object and execute it.
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
}
|
||||
// clear the values array
|
||||
$this->existingLangStrings = array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the custom code from the system
|
||||
*
|
||||
|
@ -1790,7 +1790,7 @@ class Fields extends Structure
|
||||
// set the custom builder
|
||||
if (ComponentbuilderHelper::checkArray($custom) && $typeName != 'category' && $typeName != 'repeatable')
|
||||
{
|
||||
$this->customBuilder[$listViewName][] = array('type' => $typeName, 'code' => $name, 'lang' => $listLangName, 'custom' => $custom);
|
||||
$this->customBuilder[$listViewName][] = array('type' => $typeName, 'code' => $name, 'lang' => $listLangName, 'custom' => $custom, 'method' => $field['settings']->store);
|
||||
// set the custom fields needed in content type data
|
||||
if (!isset($this->customFieldLinksBuilder[$viewName]))
|
||||
{
|
||||
|
@ -5092,20 +5092,14 @@ class Interpretation extends Fields
|
||||
if (isset($this->langContent['admin']) && ComponentbuilderHelper::checkArray($this->langContent['admin']))
|
||||
{
|
||||
ksort($this->langContent['admin']);
|
||||
foreach ($this->langContent['admin'] as $key => $value)
|
||||
{
|
||||
if (strlen($key) > 0)
|
||||
{
|
||||
if (!isset($lang))
|
||||
{
|
||||
$lang = '';
|
||||
}
|
||||
$lang .= $key.'="'.$value.'"'.PHP_EOL;
|
||||
}
|
||||
}
|
||||
return $lang;
|
||||
// load to global languages
|
||||
$this->languages['en-GB']['admin'] = $this->langContent['admin'];
|
||||
// remove tmp array
|
||||
unset($this->langContent['admin']);
|
||||
|
||||
return true;
|
||||
}
|
||||
return '';
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setLangSite()
|
||||
@ -5141,20 +5135,14 @@ class Interpretation extends Fields
|
||||
if (isset($this->langContent['site']) && ComponentbuilderHelper::checkArray($this->langContent['site']))
|
||||
{
|
||||
ksort($this->langContent['site']);
|
||||
foreach ($this->langContent['site'] as $key => $value)
|
||||
{
|
||||
if (strlen($key) > 0)
|
||||
{
|
||||
if (!isset($lang))
|
||||
{
|
||||
$lang = '';
|
||||
}
|
||||
$lang .= $key.'="'.$value.'"'.PHP_EOL;
|
||||
}
|
||||
}
|
||||
return $lang;
|
||||
// load to global languages
|
||||
$this->languages['en-GB']['site'] = $this->langContent['site'];
|
||||
// remove tmp array
|
||||
unset($this->langContent['site']);
|
||||
|
||||
return true;
|
||||
}
|
||||
return '';
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setLangSiteSys()
|
||||
@ -5165,20 +5153,14 @@ class Interpretation extends Fields
|
||||
if (isset($this->langContent['sitesys']) && ComponentbuilderHelper::checkArray($this->langContent['sitesys']))
|
||||
{
|
||||
ksort($this->langContent['sitesys']);
|
||||
foreach ($this->langContent['sitesys'] as $key => $value)
|
||||
{
|
||||
if (strlen($key) > 0)
|
||||
{
|
||||
if (!isset($lang))
|
||||
{
|
||||
$lang = '';
|
||||
}
|
||||
$lang .= $key.'="'.$value.'"'.PHP_EOL;
|
||||
}
|
||||
}
|
||||
return $lang;
|
||||
// load to global languages
|
||||
$this->languages['en-GB']['sitesys'] = $this->langContent['sitesys'];
|
||||
// remove tmp array
|
||||
unset($this->langContent['sitesys']);
|
||||
|
||||
return true;
|
||||
}
|
||||
return '';
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setLangAdminSys()
|
||||
@ -5186,20 +5168,14 @@ class Interpretation extends Fields
|
||||
if (isset($this->langContent['adminsys']) && ComponentbuilderHelper::checkArray($this->langContent['adminsys']))
|
||||
{
|
||||
ksort($this->langContent['adminsys']);
|
||||
foreach ($this->langContent['adminsys'] as $key => $value)
|
||||
{
|
||||
if (strlen($key) > 0)
|
||||
{
|
||||
if (!isset($lang))
|
||||
{
|
||||
$lang = '';
|
||||
}
|
||||
$lang .= $key.'="'.$value.'"'.PHP_EOL;
|
||||
}
|
||||
}
|
||||
return $lang;
|
||||
// load to global languages
|
||||
$this->languages['en-GB']['adminsys'] = $this->langContent['adminsys'];
|
||||
// remove tmp array
|
||||
unset($this->langContent['adminsys']);
|
||||
|
||||
return true;
|
||||
}
|
||||
return '';
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setCustomAdminViewListLink($view,$viewName_list)
|
||||
@ -7206,7 +7182,7 @@ class Interpretation extends Fields
|
||||
$query .= PHP_EOL."\t\t\tif (\$db->getNumRows())";
|
||||
$query .= PHP_EOL."\t\t\t{";
|
||||
$query .= PHP_EOL."\t\t\t\t\$items = \$db->loadObjectList();";
|
||||
$query .= $this->setGetItemsMethodStringFix($viewName_single,$this->fileContentStatic['###Component###'],"\t\t",true);
|
||||
$query .= $this->setGetItemsMethodStringFix($viewName_single, $this->fileContentStatic['###Component###'], "\t\t", true);
|
||||
// add custom php to getitems method after all
|
||||
$query .= $this->getCustomScriptBuilder('php_getitems_after_all', $viewName_single, PHP_EOL.PHP_EOL."\t\t");
|
||||
$query .= PHP_EOL."\t\t\t\treturn \$items;";
|
||||
@ -7572,7 +7548,8 @@ class Interpretation extends Fields
|
||||
&& ComponentbuilderHelper::checkArray($this->customBuilderList[$viewName_list])
|
||||
&& in_array($filter['code'],$this->customBuilderList[$viewName_list])
|
||||
&& isset($filter['custom']['table'])
|
||||
&& ComponentbuilderHelper::checkString($filter['custom']['table']))
|
||||
&& ComponentbuilderHelper::checkString($filter['custom']['table'])
|
||||
&& $filter['method'] == 0)
|
||||
{
|
||||
$query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." From the ".ComponentbuilderHelper::safeString(ComponentbuilderHelper::safeString($filter['custom']['table'],'w'))." table.";
|
||||
$query .= PHP_EOL."\t\t\$query->select(\$db->quoteName('".$filter['custom']['db'].".".$filter['custom']['text']."','".$filter['code']."_".$filter['custom']['text']."'));";
|
||||
@ -10643,7 +10620,7 @@ class Interpretation extends Fields
|
||||
return $checkin;
|
||||
}
|
||||
|
||||
public function setGetItemsMethodStringFix($view,$Component,$tab = '',$export = false)
|
||||
public function setGetItemsMethodStringFix($view, $Component, $tab = '', $export = false)
|
||||
{
|
||||
// add the fix if this view has the need for it
|
||||
$fix = '';
|
||||
@ -10849,7 +10826,15 @@ class Interpretation extends Fields
|
||||
{
|
||||
// TODO we check if this works well.
|
||||
$fix .= PHP_EOL."\t".$tab."\t\t\t//".$this->setLine(__LINE__)." convert ".$item['name'];
|
||||
$fix .= PHP_EOL."\t".$tab."\t\t\t\$item->".$item['name']." = ".$Component."Helper::jsonToString(\$item->".$item['name'].", ', ', '".$item['name']."');";
|
||||
if (isset($item['custom']['table']))
|
||||
{
|
||||
$keyTableNAme = str_replace('#__'.$this->fileContentStatic['###component###'] .'_', '', $item['custom']['table']);
|
||||
$fix .= PHP_EOL."\t".$tab."\t\t\t\$item->".$item['name']." = ".$Component."Helper::jsonToString(\$item->".$item['name'].", ', ', '".$keyTableNAme."');";
|
||||
}
|
||||
else
|
||||
{
|
||||
$fix .= PHP_EOL."\t".$tab."\t\t\t\$item->".$item['name']." = ".$Component."Helper::jsonToString(\$item->".$item['name'].", ', ', '".$item['name']."');";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1067,33 +1067,124 @@ class Infusion extends Interpretation
|
||||
* @return boolean on success
|
||||
*
|
||||
*/
|
||||
|
||||
public function setLangFileData()
|
||||
{
|
||||
// First we build the strings
|
||||
$lang = array();
|
||||
// ###LANG_ADMIN###
|
||||
$lang['###LANG_ADMIN###'] = $this->setLangAdmin();
|
||||
// ###LANG_ADMIN_SYS###
|
||||
$lang['###LANG_ADMIN_SYS###'] = $this->setLangAdminSys();
|
||||
// ###LANG_SITE###
|
||||
$lang['###LANG_SITE###'] = $this->setLangSite();
|
||||
// ###LANG_SITE_SYS###
|
||||
$lang['###LANG_SITE_SYS###'] = $this->setLangSiteSys();
|
||||
// now we insert the values into the files
|
||||
if (ComponentbuilderHelper::checkArray($this->langFiles))
|
||||
$values = array();
|
||||
$mainLangLoader = array();
|
||||
// check the admin lang is set
|
||||
if ($this->setLangAdmin())
|
||||
{
|
||||
foreach ($this->langFiles as $file)
|
||||
$values[] = array_values($this->languages['en-GB']['admin']);
|
||||
$mainLangLoader['admin'] = count($this->languages['en-GB']['admin']);
|
||||
}
|
||||
// check the admin system lang is set
|
||||
if ($this->setLangAdminSys())
|
||||
{
|
||||
$values[] = array_values($this->languages['en-GB']['adminsys']);
|
||||
$mainLangLoader['adminsys'] = count($this->languages['en-GB']['adminsys']);
|
||||
}
|
||||
// check the site lang is set
|
||||
if (!$this->removeSiteFolder && $this->setLangSite())
|
||||
{
|
||||
$values[] = array_values($this->languages['en-GB']['site']);
|
||||
$mainLangLoader['site'] = count($this->languages['en-GB']['site']);
|
||||
}
|
||||
// check the site system lang is set
|
||||
if (!$this->removeSiteFolder && $this->setLangSiteSys())
|
||||
{
|
||||
$values[] = array_values($this->languages['en-GB']['sitesys']);
|
||||
$mainLangLoader['sitesys'] = count($this->languages['en-GB']['sitesys']);
|
||||
}
|
||||
$values = array_unique(ComponentbuilderHelper::mergeArrays($values));
|
||||
// get the other lang strings if there is any
|
||||
$this->multiLangString = $this->getMultiLangStrings($values);
|
||||
// update insert the current lang in to DB
|
||||
$this->setLangPlaceholders($values);
|
||||
// path to INI file
|
||||
$getPAth = $this->templatePath . '/en-GB.com_admin.ini';
|
||||
// now we insert the values into the files
|
||||
if (ComponentbuilderHelper::checkArray($this->languages))
|
||||
{
|
||||
$langXML = array();
|
||||
foreach ($this->languages as $tag => $areas)
|
||||
{
|
||||
$string = file_get_contents($file['path']);
|
||||
// load the data
|
||||
$answer = $this->setPlaceholders($string, $lang, 3);
|
||||
// add to zip array
|
||||
$this->writeFile($file['path'],$answer);
|
||||
// set the line counter
|
||||
$this->lineCount = $this->lineCount + substr_count($answer, PHP_EOL);
|
||||
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)
|
||||
{
|
||||
// dont add
|
||||
continue;
|
||||
}
|
||||
$p = 'admin';
|
||||
$t = '';
|
||||
if (strpos($area, 'site') !== false)
|
||||
{
|
||||
if ($this->removeSiteFolder)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$p = 'site';
|
||||
}
|
||||
if (strpos($area, 'sys') !== false)
|
||||
{
|
||||
$t = '.sys';
|
||||
}
|
||||
// build the path to to place the lang file
|
||||
$path = $this->componentPath.'/'.$p.'/language/'.$tag;
|
||||
if (!JFolder::exists($path))
|
||||
{
|
||||
JFolder::create($path);
|
||||
// count the folder created
|
||||
$this->folderCount++;
|
||||
}
|
||||
// build the file name
|
||||
$fileName = $tag . '.com_' . $this->componentCodeName . $t . '.ini';
|
||||
// move the file to its place
|
||||
JFile::copy($getPAth, $path.'/'.$fileName);
|
||||
// count the file created
|
||||
$this->fileCount++;
|
||||
// add content to it
|
||||
$lang = '';
|
||||
foreach ($languageStrings as $place => $string)
|
||||
{
|
||||
$lang .= $place.'="'.$string.'"'.PHP_EOL;
|
||||
}
|
||||
// add to language file
|
||||
$this->writeFile($path.'/'.$fileName, $lang);
|
||||
// set the line counter
|
||||
$this->lineCount = $this->lineCount + substr_count($lang, PHP_EOL);
|
||||
// build xml strings
|
||||
if (!isset($langXML[$p]))
|
||||
{
|
||||
$langXML[$p] = array();
|
||||
}
|
||||
$langXML[$p][] = '<language tag="'.$tag.'">language/'.$tag.'/'.$fileName.'</language>';
|
||||
}
|
||||
}
|
||||
// load the lang xml
|
||||
if (ComponentbuilderHelper::checkArray($langXML))
|
||||
{
|
||||
$replace = array();
|
||||
if (isset($langXML['admin']) && ComponentbuilderHelper::checkArray($langXML['admin']))
|
||||
{
|
||||
$replace['###ADMIN_LANGUAGES###'] = implode(PHP_EOL."\t\t\t", $langXML['admin']);
|
||||
}
|
||||
if (!$this->removeSiteFolder && isset($langXML['site']) && ComponentbuilderHelper::checkArray($langXML['site']))
|
||||
{
|
||||
$replace['###SITE_LANGUAGES###'] = implode(PHP_EOL."\t\t", $langXML['site']);
|
||||
}
|
||||
// build xml path
|
||||
$xmlPath = $this->componentPath . '/'. $this->fileContentStatic['###component###']. '.xml';
|
||||
// get the content in xml
|
||||
$componentXML = file_get_contents($xmlPath);
|
||||
// update the xml content
|
||||
$componentXML = $this->setPlaceholders($componentXML, $replace);
|
||||
// store the values back to xml
|
||||
$this->writeFile($xmlPath,$componentXML);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user