From 30cb1a531a014e32f1754fe3ea9841a7dcc64e09 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Mon, 18 Jan 2021 19:37:05 +0200 Subject: [PATCH] Improved how the filters in the langauge translation are behave when no language is found. gh-651 --- README.md | 2 +- admin/README.txt | 2 +- .../en-GB/en-GB.com_componentbuilder.ini | 3 +- admin/models/language_translations.php | 30 +++++++++++++++---- .../en-GB/en-GB.com_componentbuilder.ini | 2 +- 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 37c00cd22..f61976c9e 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,7 @@ TODO + *Version*: 2.12.5 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **292966** ++ *Line count*: **292985** + *Field count*: **1611** + *File count*: **1934** + *Folder count*: **322** diff --git a/admin/README.txt b/admin/README.txt index 37c00cd22..f61976c9e 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -147,7 +147,7 @@ TODO + *Version*: 2.12.5 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **292966** ++ *Line count*: **292985** + *Field count*: **1611** + *File count*: **1934** + *Folder count*: **322** diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 287b5df7d..31c60440b 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -8092,6 +8092,7 @@ COM_COMPONENTBUILDER_NO_FILES_LINKED="No Files Linked" COM_COMPONENTBUILDER_NO_FOUND="No Found" COM_COMPONENTBUILDER_NO_ITEM_FOUND="No Item Found" COM_COMPONENTBUILDER_NO_KEYS_WERE_FOUND_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY="No keys were found. To add an export key simply open the component, go to the tab called settings, bottom right there is a field called Export Key." +COM_COMPONENTBUILDER_NO_LANGUAGES_FOUND="No Languages Found" COM_COMPONENTBUILDER_NO_LANGUAGES_UPDATE_SERVER_FOUND="No Languages Update server found." COM_COMPONENTBUILDER_NO_NEED_TO_GET_IT_SINCE_IT_IS_ALREADY_IN_SYNC_WITH_YOUR_LOCAL_VERSION="No need to get it since it is already in sync with your local version" COM_COMPONENTBUILDER_NO_RESULTS_MATCH="No results match" @@ -8284,7 +8285,7 @@ COM_COMPONENTBUILDER_SELECT_ADMIN_VIEW="Select Admin View" COM_COMPONENTBUILDER_SELECT_AN_OPTION="Select an option" COM_COMPONENTBUILDER_SELECT_A_PROPERTY="Select a property" COM_COMPONENTBUILDER_SELECT_A_SNIPPET="select a snippet" -COM_COMPONENTBUILDER_SELECT_EXTENSION="Select extension" +COM_COMPONENTBUILDER_SELECT_EXTENSION="Select Extension" COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_TO_COMPILE="Select the component to compile" COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_YOUR_WOULD_LIKE_TO_IMPORT="Select the component your would like to import." COM_COMPONENTBUILDER_SELECT_THE_PACKAGE_TO_IMPORT="Select the package to import" diff --git a/admin/models/language_translations.php b/admin/models/language_translations.php index 42e9d77a1..1169ebdc6 100644 --- a/admin/models/language_translations.php +++ b/admin/models/language_translations.php @@ -69,11 +69,20 @@ class ComponentbuilderModelLanguage_translations extends JModelList 'type' => 'list', 'onchange' => 'this.form.submit();', ); + // no languages found notice $options = array( - '' => '- ' . JText::_('COM_COMPONENTBUILDER_TRANSLATED_IN') . ' -', - 'all' => JText::_('COM_COMPONENTBUILDER_EVERY_LANGUAGE') + '' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_LANGUAGES_FOUND') . ' -' ); - $options = array_merge($options, ComponentbuilderHelper::getAvailableLanguages()); + // check if we have languages set + if (($languages = ComponentbuilderHelper::getAvailableLanguages()) !== false) + { + $options = array( + '' => '- ' . JText::_('COM_COMPONENTBUILDER_TRANSLATED_IN') . ' -', + 'all' => JText::_('COM_COMPONENTBUILDER_EVERY_LANGUAGE') + ); + + $options = array_merge($options, $languages); + } $form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter'); $form->setValue( @@ -89,11 +98,20 @@ class ComponentbuilderModelLanguage_translations extends JModelList 'type' => 'list', 'onchange' => 'this.form.submit();', ); + // no languages found notice $options = array( - '' => '- ' . JText::_('COM_COMPONENTBUILDER_NOT_TRANSLATED_IN') . ' -', - 'none' => JText::_('COM_COMPONENTBUILDER_ANY_LANGUAGE') + '' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_LANGUAGES_FOUND') . ' -' ); - $options = array_merge($options, ComponentbuilderHelper::getAvailableLanguages()); + // check if we have languages set + if ($languages) + { + $options = array( + '' => '- ' . JText::_('COM_COMPONENTBUILDER_NOT_TRANSLATED_IN') . ' -', + 'none' => JText::_('COM_COMPONENTBUILDER_ANY_LANGUAGE') + ); + + $options = array_merge($options, $languages); + } $form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter'); $form->setValue( diff --git a/site/language/en-GB/en-GB.com_componentbuilder.ini b/site/language/en-GB/en-GB.com_componentbuilder.ini index 532d6f61c..31d1c9ab4 100644 --- a/site/language/en-GB/en-GB.com_componentbuilder.ini +++ b/site/language/en-GB/en-GB.com_componentbuilder.ini @@ -68,7 +68,7 @@ COM_COMPONENTBUILDER_PAIDLOCKED="Paid/Locked" COM_COMPONENTBUILDER_PLUGIN="Plugin" COM_COMPONENTBUILDER_PROPERTY="Property" COM_COMPONENTBUILDER_SBR_YOU_CAN_ADD_A_BGITHUB_ACCESS_TOKENB_TO_COMPONENTBUILDER_GLOBAL_OPTIONS_TO_MAKE_AUTHENTICATED_REQUESTS_TO_GITHUB_AN_ACCESS_TOKEN_WITH_ONLY_PUBLIC_ACCESS_WILL_DO_TO_RETRIEVE_S="%s
You can add a gitHub Access Token to Componentbuilder global options to make authenticated requests to gitHub. An access token with only public access will do to retrieve %s." -COM_COMPONENTBUILDER_SELECT_EXTENSION="Select extension" +COM_COMPONENTBUILDER_SELECT_EXTENSION="Select Extension" COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_BIMPORT_PROCESSB_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_BDOES_NOTB_HAVE_THE_KEY_THEY_CAN_SEE_BWHERE_TO_GET_ITB="Since the owner details are displayed during import process before adding the key, this way if the user/dev does not have the key they can see where to get it." COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_IMPORT_PROCESS_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_DOES_NOT_HAVE_THE_KEY_THEY_CAN_SEE_WHERE_TO_GET_IT="Since the owner details are displayed during import process before adding the key, this way if the user/dev does not have the key they can see where to get it." COM_COMPONENTBUILDER_SORRY_THIS_PLACEHOLDER_IS_ALREADY_IN_USE="Sorry this placeholder is already in use!"