Release of v1.2.1
This commit is contained in:
parent
cd57598f50
commit
1801eb5977
@ -12,24 +12,23 @@
|
|||||||
// No direct access to this file
|
// No direct access to this file
|
||||||
defined('_JEXEC') or die('Restricted access');
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
|
||||||
|
|
||||||
use Joomla\CMS\Application\CMSApplication;
|
use Joomla\CMS\Application\CMSApplication;
|
||||||
use Joomla\CMS\Plugin\CMSPlugin;
|
use Joomla\CMS\Plugin\CMSPlugin;
|
||||||
|
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
|
||||||
|
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
|
||||||
|
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||||
use VDM\Joomla\Utilities\JsonHelper;
|
use VDM\Joomla\Utilities\JsonHelper;
|
||||||
use VDM\Joomla\Utilities\ArrayHelper;
|
use VDM\Joomla\Utilities\ArrayHelper;
|
||||||
use VDM\Joomla\Utilities\StringHelper;
|
use VDM\Joomla\Utilities\StringHelper;
|
||||||
use VDM\Joomla\Utilities\GetHelper;
|
use VDM\Joomla\Utilities\GetHelper;
|
||||||
|
|
||||||
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
|
|
||||||
|
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
|
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
|
|
||||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension - Componentbuilder Language Packaging plugin.
|
* Extension - Componentbuilder Language Packaging plugin.
|
||||||
*
|
*
|
||||||
* @package ComponentbuilderLanguagePackaging
|
* @package ComponentbuilderLanguagePackaging
|
||||||
* @since 1.2.0
|
* @since 1.2.1
|
||||||
*/
|
*/
|
||||||
class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
||||||
{
|
{
|
||||||
@ -301,7 +300,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
*
|
*
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public function jcb_ce_onBeforeBuildPluginLangFiles(&$plugin, &$languages)
|
public function jcb_ce_onBeforeBuildPluginLangFiles(&$plugin)
|
||||||
{
|
{
|
||||||
// get component id
|
// get component id
|
||||||
$id = (int) CFactory::_('Config')->component_id;
|
$id = (int) CFactory::_('Config')->component_id;
|
||||||
@ -311,7 +310,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
// set file name
|
// set file name
|
||||||
$file_name = 'plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->code_name);
|
$file_name = 'plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->code_name);
|
||||||
// extrude the languages that should not remain in the plugin
|
// extrude the languages that should not remain in the plugin
|
||||||
$this->extrudeLanguages($id, $languages, CFactory::_('Config')->lang_tag, $file_name, 'admin');
|
$this->extrudeLanguages($id, 'plugins', CFactory::_('Config')->lang_tag, $file_name, 'admin');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +321,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
*
|
*
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public function jcb_ce_onBeforeBuildModuleLangFiles(&$module, &$languages)
|
public function jcb_ce_onBeforeBuildModuleLangFiles(&$module)
|
||||||
{
|
{
|
||||||
// get component id
|
// get component id
|
||||||
$id = (int) CFactory::_('Config')->component_id;
|
$id = (int) CFactory::_('Config')->component_id;
|
||||||
@ -330,7 +329,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
if (ArrayHelper::check($this->activeComponents) && isset($this->activeComponents[$id]))
|
if (ArrayHelper::check($this->activeComponents) && isset($this->activeComponents[$id]))
|
||||||
{
|
{
|
||||||
// extrude the languages that should not remain in the module
|
// extrude the languages that should not remain in the module
|
||||||
$this->extrudeLanguages($id, $languages, CFactory::_('Config')->lang_tag, $module->file_name, $module->target_client);
|
$this->extrudeLanguages($id, 'modules', CFactory::_('Config')->lang_tag, $module->file_name, $module->target_client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +340,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
*
|
*
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public function jcb_ce_onBeforeBuildAllLangFiles(&$languages)
|
public function jcb_ce_onBeforeBuildAllLangFiles($targetArea)
|
||||||
{
|
{
|
||||||
// get component id
|
// get component id
|
||||||
$id = (int) CFactory::_('Config')->component_id;
|
$id = (int) CFactory::_('Config')->component_id;
|
||||||
@ -351,7 +350,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
// set file name
|
// set file name
|
||||||
$file_name = 'com_' . $this->activeComponentsNames[$id];
|
$file_name = 'com_' . $this->activeComponentsNames[$id];
|
||||||
// extrude the languages that should not remain in the module
|
// extrude the languages that should not remain in the module
|
||||||
$this->extrudeLanguages($id, $languages, CFactory::_('Config')->lang_tag, $file_name);
|
$this->extrudeLanguages($id, $targetArea, CFactory::_('Config')->lang_tag, $file_name);
|
||||||
}
|
}
|
||||||
// build the language packages
|
// build the language packages
|
||||||
$this->buildLanguages($id, CFactory::_('Config')->lang_tag);
|
$this->buildLanguages($id, CFactory::_('Config')->lang_tag);
|
||||||
@ -364,7 +363,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
*
|
*
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
protected function extrudeLanguages(&$id, &$languages, $langTag, &$file_name, $target_client = 'both')
|
protected function extrudeLanguages(&$id, $targetArea, $langTag, &$file_name, $target_client = 'both')
|
||||||
{
|
{
|
||||||
$mainLangLoader = [];
|
$mainLangLoader = [];
|
||||||
// check if this id was set before
|
// check if this id was set before
|
||||||
@ -379,14 +378,14 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
$this->languages[$id][$file_name] = [];
|
$this->languages[$id][$file_name] = [];
|
||||||
}
|
}
|
||||||
// set all the extra languages not excluded
|
// set all the extra languages not excluded
|
||||||
foreach ($languages as $key => $language)
|
foreach (CFactory::_('Compiler.Builder.Languages')->get($targetArea) as $key => $language)
|
||||||
{
|
{
|
||||||
if ($key !== $langTag && ArrayHelper::check($language) && (!isset($this->excludedLang[$id]) || !in_array($key, $this->excludedLang[$id])))
|
if ($key !== $langTag && ArrayHelper::check($language) && (!isset($this->excludedLang[$id]) || !in_array($key, $this->excludedLang[$id])))
|
||||||
{
|
{
|
||||||
// add to our bucket
|
// add to our bucket
|
||||||
$this->languages[$id][$file_name][$key] = $language;
|
$this->languages[$id][$file_name][$key] = $language;
|
||||||
// remove from the JCB build
|
// remove from the JCB build
|
||||||
unset($languages[$key]);
|
CFactory::_('Compiler.Builder.Languages')->remove("{$targetArea}.{$key}");
|
||||||
}
|
}
|
||||||
// count the area strings
|
// count the area strings
|
||||||
if ($langTag === $key)
|
if ($langTag === $key)
|
||||||
@ -463,7 +462,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
// get the file name
|
// get the file name
|
||||||
$fileName = $this->getLanguageFileName($file_name, $tag, $area);
|
$fileName = $this->getLanguageFileName($file_name, $tag, $area);
|
||||||
// check if language should be added
|
// check if language should be added
|
||||||
if ($this->shouldLanguageBeAdded($tag, $languageStrings, $mainLangLoader[$area], $fileName) && ($actions = $this->getLangActions($file_name, $tag, $area, $target_client)) !== false)
|
if (CFactory::_('Language.Translation')->check($tag, $languageStrings, $mainLangLoader[$area], $fileName) && ($actions = $this->getLangActions($file_name, $tag, $area, $target_client)) !== false)
|
||||||
{
|
{
|
||||||
// set the language data
|
// set the language data
|
||||||
$lang = array_map(
|
$lang = array_map(
|
||||||
@ -677,53 +676,13 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
|
|||||||
* check if a translation should be added
|
* check if a translation should be added
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
* @deprecated 3.4 Use CFactory::_('Language.Translation')->check(...);
|
||||||
*/
|
*/
|
||||||
protected function shouldLanguageBeAdded(&$tag, &$languageStrings, &$total,
|
protected function shouldLanguageBeAdded(&$tag, &$languageStrings, &$total, &$file_name) {
|
||||||
&$file_name
|
|
||||||
) {
|
|
||||||
// only log messages for none $this->langTag translations
|
// only log messages for none $this->langTag translations
|
||||||
if ($this->langTag !== $tag)
|
CFactory::_('Language.Translation')->check(
|
||||||
{
|
$tag, $languageStrings, $total, $file_name
|
||||||
$langStringNr = count($languageStrings);
|
|
||||||
$langStringSum = ComponentbuilderHelper::bcmath(
|
|
||||||
'mul', $langStringNr, 100
|
|
||||||
);
|
);
|
||||||
$percentage = ComponentbuilderHelper::bcmath(
|
|
||||||
'div', $langStringSum, $total
|
|
||||||
);
|
|
||||||
$stringNAme = ($langStringNr == 1) ? '(string '
|
|
||||||
. $tag . ' translated)'
|
|
||||||
: '(strings ' . $tag . ' translated)';
|
|
||||||
|
|
||||||
// force load if debug lines are added
|
|
||||||
if (!$this->debugLinenr)
|
|
||||||
{
|
|
||||||
// check if we should install this translation
|
|
||||||
if ($percentage < $this->percentageLanguageAdd)
|
|
||||||
{
|
|
||||||
// dont add
|
|
||||||
CFactory::_('Compiler.Builder.Language.Messages')->set("exclude.$file_name",
|
|
||||||
'<b>' . $total . '</b>(total '
|
|
||||||
. $this->langTag . ' strings) only <b>'
|
|
||||||
. $langStringNr . '</b>' . $stringNAme
|
|
||||||
. ' = ' . $percentage
|
|
||||||
);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// show if it was added as well
|
|
||||||
CFactory::_('Compiler.Builder.Language.Messages')->set("include.$file_name",
|
|
||||||
'<b>' . $total . '</b>(total '
|
|
||||||
. $this->langTag . ' strings) and <b>'
|
|
||||||
. $langStringNr . '</b>' . $stringNAme . ' = '
|
|
||||||
. $percentage
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<extension type="plugin" version="3.10" group="extension" method="upgrade">
|
<extension type="plugin" version="3.10" group="extension" method="upgrade">
|
||||||
<name>PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING</name>
|
<name>PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING</name>
|
||||||
<creationDate>27th July, 2024</creationDate>
|
<creationDate>14th August, 2024</creationDate>
|
||||||
<author>Llewellyn van der Merwe</author>
|
<author>Llewellyn van der Merwe</author>
|
||||||
<authorEmail>joomla@vdm.io</authorEmail>
|
<authorEmail>joomla@vdm.io</authorEmail>
|
||||||
<authorUrl>https://dev.vdm.io</authorUrl>
|
<authorUrl>https://dev.vdm.io</authorUrl>
|
||||||
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
||||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||||
<version>1.2.0</version>
|
<version>1.2.1</version>
|
||||||
<description>PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION</description>
|
<description>PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION</description>
|
||||||
|
|
||||||
<!-- Scripts to run on installation -->
|
<!-- Scripts to run on installation -->
|
||||||
@ -17,6 +17,8 @@
|
|||||||
<languages folder="language">
|
<languages folder="language">
|
||||||
<language tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.ini</language>
|
<language tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.ini</language>
|
||||||
<language tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.sys.ini</language>
|
<language tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.sys.ini</language>
|
||||||
|
<language tag="af-ZA">af-ZA/af-ZA.plg_extension_componentbuilderlanguagepackaging.ini</language>
|
||||||
|
<language tag="af-ZA">af-ZA/af-ZA.plg_extension_componentbuilderlanguagepackaging.sys.ini</language>
|
||||||
</languages>
|
</languages>
|
||||||
|
|
||||||
<!-- Plugin files -->
|
<!-- Plugin files -->
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja"
|
||||||
|
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee"
|
@ -0,0 +1,2 @@
|
|||||||
|
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja"
|
||||||
|
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee"
|
@ -1,3 +1,3 @@
|
|||||||
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING="Extension - Componentbuilder Language Packaging"
|
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING="Extension - Componentbuilder Language Packaging"
|
||||||
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_DESCRIPTION="This plugin is used to add language packaging to JCB. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field."
|
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_DESCRIPTION="This plugin is used to add language packaging to JCB. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field."
|
||||||
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION="<h1>Extension - Componentbuilder Language Packaging (v.1.2.0)</h1> <div style='clear: both;'></div><p>This plugin is used to add language packaging to JCB. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 12th October, 2019</small></p>"
|
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION="<h1>Extension - Componentbuilder Language Packaging (v.1.2.1)</h1> <div style='clear: both;'></div><p>This plugin is used to add language packaging to JCB. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 12th October, 2019</small></p>"
|
@ -1,3 +1,3 @@
|
|||||||
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING="Extension - Componentbuilder Language Packaging"
|
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING="Extension - Componentbuilder Language Packaging"
|
||||||
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_DESCRIPTION="This plugin is used to add language packaging to JCB. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field."
|
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_DESCRIPTION="This plugin is used to add language packaging to JCB. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field."
|
||||||
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION="<h1>Extension - Componentbuilder Language Packaging (v.1.2.0)</h1> <div style='clear: both;'></div><p>This plugin is used to add language packaging to JCB. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 12th October, 2019</small></p>"
|
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION="<h1>Extension - Componentbuilder Language Packaging (v.1.2.1)</h1> <div style='clear: both;'></div><p>This plugin is used to add language packaging to JCB. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 12th October, 2019</small></p>"
|
Loading…
Reference in New Issue
Block a user