From 1801eb5977aa6b73ebe4327c50358d421498b3c2 Mon Sep 17 00:00:00 2001 From: aB0t Date: Thu, 15 Aug 2024 01:37:23 +0200 Subject: [PATCH] Release of v1.2.1 --- componentbuilderlanguagepackaging.php | 87 +++++-------------- componentbuilderlanguagepackaging.xml | 6 +- ...sion_componentbuilderlanguagepackaging.ini | 2 + ..._componentbuilderlanguagepackaging.sys.ini | 2 + ...sion_componentbuilderlanguagepackaging.ini | 2 +- ..._componentbuilderlanguagepackaging.sys.ini | 2 +- 6 files changed, 33 insertions(+), 68 deletions(-) create mode 100644 language/af-ZA/af-ZA.plg_extension_componentbuilderlanguagepackaging.ini create mode 100644 language/af-ZA/af-ZA.plg_extension_componentbuilderlanguagepackaging.sys.ini diff --git a/componentbuilderlanguagepackaging.php b/componentbuilderlanguagepackaging.php index ba93dc7..0387a5c 100644 --- a/componentbuilderlanguagepackaging.php +++ b/componentbuilderlanguagepackaging.php @@ -12,24 +12,23 @@ // No direct access to this file 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\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\ArrayHelper; use VDM\Joomla\Utilities\StringHelper; -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; +use VDM\Joomla\Utilities\GetHelper; /** * Extension - Componentbuilder Language Packaging plugin. * * @package ComponentbuilderLanguagePackaging - * @since 1.2.0 + * @since 1.2.1 */ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin { @@ -301,7 +300,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin * * @since 1.0 */ - public function jcb_ce_onBeforeBuildPluginLangFiles(&$plugin, &$languages) + public function jcb_ce_onBeforeBuildPluginLangFiles(&$plugin) { // get component id $id = (int) CFactory::_('Config')->component_id; @@ -311,7 +310,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin // set file name $file_name = 'plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->code_name); // 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 */ - public function jcb_ce_onBeforeBuildModuleLangFiles(&$module, &$languages) + public function jcb_ce_onBeforeBuildModuleLangFiles(&$module) { // get 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])) { // 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 */ - public function jcb_ce_onBeforeBuildAllLangFiles(&$languages) + public function jcb_ce_onBeforeBuildAllLangFiles($targetArea) { // get component id $id = (int) CFactory::_('Config')->component_id; @@ -351,7 +350,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin // set file name $file_name = 'com_' . $this->activeComponentsNames[$id]; // 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 $this->buildLanguages($id, CFactory::_('Config')->lang_tag); @@ -364,7 +363,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin * * @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 = []; // check if this id was set before @@ -379,14 +378,14 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin $this->languages[$id][$file_name] = []; } // 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]))) { // add to our bucket $this->languages[$id][$file_name][$key] = $language; // remove from the JCB build - unset($languages[$key]); + CFactory::_('Compiler.Builder.Languages')->remove("{$targetArea}.{$key}"); } // count the area strings if ($langTag === $key) @@ -463,7 +462,7 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin // get the file name $fileName = $this->getLanguageFileName($file_name, $tag, $area); // 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 $lang = array_map( @@ -677,53 +676,13 @@ class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin * check if a translation should be added * * @return bool - * + * @deprecated 3.4 Use CFactory::_('Language.Translation')->check(...); */ - protected function shouldLanguageBeAdded(&$tag, &$languageStrings, &$total, - &$file_name - ) { + protected function shouldLanguageBeAdded(&$tag, &$languageStrings, &$total, &$file_name) { // only log messages for none $this->langTag translations - if ($this->langTag !== $tag) - { - $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", - '' . $total . '(total ' - . $this->langTag . ' strings) only ' - . $langStringNr . '' . $stringNAme - . ' = ' . $percentage - ); - - return false; - } - } - - // show if it was added as well - CFactory::_('Compiler.Builder.Language.Messages')->set("include.$file_name", - '' . $total . '(total ' - . $this->langTag . ' strings) and ' - . $langStringNr . '' . $stringNAme . ' = ' - . $percentage - ); - } - - return true; + CFactory::_('Language.Translation')->check( + $tag, $languageStrings, $total, $file_name + ); } } diff --git a/componentbuilderlanguagepackaging.xml b/componentbuilderlanguagepackaging.xml index a6f1139..2fab1ec 100644 --- a/componentbuilderlanguagepackaging.xml +++ b/componentbuilderlanguagepackaging.xml @@ -1,13 +1,13 @@ PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING - 27th July, 2024 + 14th August, 2024 Llewellyn van der Merwe joomla@vdm.io https://dev.vdm.io Copyright (C) 2015 Vast Development Method. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt - 1.2.0 + 1.2.1 PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION @@ -17,6 +17,8 @@ en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.ini en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.sys.ini + af-ZA/af-ZA.plg_extension_componentbuilderlanguagepackaging.ini + af-ZA/af-ZA.plg_extension_componentbuilderlanguagepackaging.sys.ini diff --git a/language/af-ZA/af-ZA.plg_extension_componentbuilderlanguagepackaging.ini b/language/af-ZA/af-ZA.plg_extension_componentbuilderlanguagepackaging.ini new file mode 100644 index 0000000..ff80c61 --- /dev/null +++ b/language/af-ZA/af-ZA.plg_extension_componentbuilderlanguagepackaging.ini @@ -0,0 +1,2 @@ +PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja" +PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee" \ No newline at end of file diff --git a/language/af-ZA/af-ZA.plg_extension_componentbuilderlanguagepackaging.sys.ini b/language/af-ZA/af-ZA.plg_extension_componentbuilderlanguagepackaging.sys.ini new file mode 100644 index 0000000..ff80c61 --- /dev/null +++ b/language/af-ZA/af-ZA.plg_extension_componentbuilderlanguagepackaging.sys.ini @@ -0,0 +1,2 @@ +PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja" +PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee" \ No newline at end of file diff --git a/language/en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.ini b/language/en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.ini index 6f37179..4c32a29 100644 --- a/language/en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.ini +++ b/language/en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.ini @@ -1,3 +1,3 @@ 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_XML_DESCRIPTION="

Extension - Componentbuilder Language Packaging (v.1.2.0)

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.

Created by Llewellyn van der Merwe
Development started 12th October, 2019

" \ No newline at end of file +PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION="

Extension - Componentbuilder Language Packaging (v.1.2.1)

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.

Created by Llewellyn van der Merwe
Development started 12th October, 2019

" \ No newline at end of file diff --git a/language/en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.sys.ini b/language/en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.sys.ini index 6f37179..4c32a29 100644 --- a/language/en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.sys.ini +++ b/language/en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.sys.ini @@ -1,3 +1,3 @@ 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_XML_DESCRIPTION="

Extension - Componentbuilder Language Packaging (v.1.2.0)

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.

Created by Llewellyn van der Merwe
Development started 12th October, 2019

" \ No newline at end of file +PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION="

Extension - Componentbuilder Language Packaging (v.1.2.1)

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.

Created by Llewellyn van der Merwe
Development started 12th October, 2019

" \ No newline at end of file