52
0

Compare commits

...

36 Commits
5.x ... 3.x

Author SHA1 Message Date
616824c352
Update on v1.2.1 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-08-23 18:12:51 +02:00
47ebc5c0fb
Update on v1.2.1 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-08-21 21:34:32 +02:00
332b11d644
Update on v1.2.1 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-08-20 22:32:57 +02:00
368ec6139a
Update on v1.2.1 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-08-16 19:20:22 +02:00
1801eb5977
Release of v1.2.1 2024-08-15 01:37:23 +02:00
cd57598f50
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-07-27 22:48:41 +02:00
c152276605
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-07-26 15:33:16 +02:00
1f92d9d44b
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-07-20 22:39:19 +02:00
b26f64f4c3
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-07-18 14:57:53 +02:00
622421c531
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-07-17 02:39:35 +02:00
2f566e06fd
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-07-08 22:53:46 +02:00
d5c0fca707
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-06-28 03:48:57 +02:00
9268eb5e5f
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-06-21 01:32:05 +02:00
0770cf5511
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-06-07 22:29:57 +02:00
d932a2f9e0
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-06-05 16:29:28 +02:00
eea6b5d1f0
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-05-16 15:13:36 +02:00
4c0877e7aa
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-05-13 12:23:57 +02:00
d63e4a6ea2
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-05-10 18:07:21 +02:00
8ed3b60d95
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-05-06 07:40:18 +02:00
22e92e9064
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-05-03 07:54:09 +02:00
d480b023e6
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-05-02 16:10:47 +02:00
c3f73a893f
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-04-30 10:29:24 +02:00
550f34cd31
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-04-27 15:45:07 +02:00
bf70d406ab
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-04-24 21:10:42 +02:00
4f9d794de0
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-04-22 15:32:19 +02:00
c1ebe7ce34
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-04-22 00:59:42 +02:00
8fa464000d
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-04-16 19:05:17 +02:00
dfdf245004
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-04-09 13:07:08 +02:00
620d9225d8
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-04-06 19:48:58 +02:00
eb10fd630f
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-03-27 15:04:19 +02:00
73750896ae
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-03-26 22:30:10 +02:00
bae1c71653
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-03-20 14:19:16 +02:00
c0c3445e97
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-03-15 12:00:50 +02:00
3019950beb
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-03-12 12:40:25 +02:00
2cd4de00ca
Update on v1.2.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-03-11 16:56:07 +02:00
b39c9c5355
Update on v1.2.0 (beta for next version)
Here's an update on the current version, which includes changes towards the next release still in beta.
2024-03-10 13:40:49 +02:00
7 changed files with 33 additions and 111 deletions

View File

@ -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",
'<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;
CFactory::_('Language.Translation')->check(
$tag, $languageStrings, $total, $file_name
);
}
}

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="3.10" group="extension" method="upgrade">
<name>PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING</name>
<creationDate>9th March, 2024</creationDate>
<creationDate>23rd August, 2024</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<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>
<!-- Scripts to run on installation -->
@ -17,6 +17,8 @@
<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.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>
<!-- Plugin files -->

View File

@ -0,0 +1,2 @@
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee"

View File

@ -0,0 +1,2 @@
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee"

View File

@ -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="<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>"

View File

@ -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="<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>"

View File

@ -48,49 +48,6 @@ class plgExtensionComponentbuilderLanguagePackagingInstallerScript
if ('install' === $route)
{
// needs fix
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
// load the helper class
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
// block install
$blockInstall = true;
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 3.0.0 or higher installed
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 &&
(
($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 0) ||
($jcbVersion[0] == 3 && $jcbVersion[1] > 0) ||
$jcbVersion[0] > 3)
)
{
$blockInstall = false;
}
}
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB v3.0.0 or higher before installing this plugin.', 'error');
return false;
}
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))