Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.1] com_media: hardcoded language strings #167

Closed
joomlapl-bot opened this issue Apr 22, 2022 · 0 comments
Closed

[4.1] com_media: hardcoded language strings #167

joomlapl-bot opened this issue Apr 22, 2022 · 0 comments

Comments

@joomlapl-bot
Copy link
Collaborator

PR w związku ze zmianą oryginału joomla/joomla-cms#37588 Poniżej zmiany w oryginale:

Click to expand the diff!
diff --git a/administrator/components/com_media/src/Provider/ProviderManager.php b/administrator/components/com_media/src/Provider/ProviderManager.php
index 8f2c38d228ba..5b852e656702 100644
--- a/administrator/components/com_media/src/Provider/ProviderManager.php
+++ b/administrator/components/com_media/src/Provider/ProviderManager.php
@@ -11,6 +11,7 @@
 
 \defined('_JEXEC') or die;
 
+use Joomla\CMS\Language\Text;
 use Joomla\Component\Media\Administrator\Adapter\AdapterInterface;
 
 /**
@@ -96,7 +97,7 @@ public function getProvider($id)
 	{
 		if (!isset($this->providers[$id]))
 		{
-			throw new \Exception("Media Provider not found");
+			throw new \Exception(Text::_('COM_MEDIA_ERROR_MEDIA_PROVIDER_NOT_FOUND'));
 		}
 
 		return $this->providers[$id];
@@ -119,14 +120,14 @@ public function getAdapter($name)
 
 		if ($account == null)
 		{
-			throw new \Exception('Account was not set');
+			throw new \Exception(Text::_('COM_MEDIA_ERROR_ACCOUNT_NOT_SET'));
 		}
 
 		$adapters = $this->getProvider($provider)->getAdapters();
 
 		if (!isset($adapters[$account]))
 		{
-			throw new \Exception("The account was not found");
+			throw new \Exception(Text::_('COM_MEDIA_ERROR_ACCOUNT_NOT_FOUND'));
 		}
 
 		return $adapters[$account];
diff --git a/administrator/components/com_media/src/Provider/ProviderManagerHelperTrait.php b/administrator/components/com_media/src/Provider/ProviderManagerHelperTrait.php
index fb178eddf30f..7c9516560238 100644
--- a/administrator/components/com_media/src/Provider/ProviderManagerHelperTrait.php
+++ b/administrator/components/com_media/src/Provider/ProviderManagerHelperTrait.php
@@ -13,6 +13,7 @@
 
 use Joomla\CMS\Component\ComponentHelper;
 use Joomla\CMS\Factory;
+use Joomla\CMS\Language\Text;
 use Joomla\CMS\Plugin\PluginHelper;
 use Joomla\Component\Media\Administrator\Adapter\AdapterInterface;
 use Joomla\Component\Media\Administrator\Event\MediaProviderEvent;
@@ -117,7 +118,7 @@ protected function resolveAdapterAndPath(String $path): array
 
 		if (!$this->getDefaultAdapterName())
 		{
-			throw new \InvalidArgumentException('No adapter found');
+			throw new \InvalidArgumentException(Text::_('COM_MEDIA_ERROR_NO_ADAPTER_FOUND'));
 		}
 
 		// If we have less than 2 parts, we return a default adapter name
diff --git a/administrator/components/com_media/src/View/File/HtmlView.php b/administrator/components/com_media/src/View/File/HtmlView.php
index b01a6a1a069a..1681758459c8 100644
--- a/administrator/components/com_media/src/View/File/HtmlView.php
+++ b/administrator/components/com_media/src/View/File/HtmlView.php
@@ -49,7 +49,7 @@ public function display($tpl = null)
 		if (empty($this->file->content))
 		{
 			// @todo error handling controller redirect files
-			throw new \Exception('No content available!');
+			throw new \Exception(Text::_('COM_MEDIA_ERROR_NO_CONTENT_AVAILABLE'));
 		}
 
 		$this->addToolbar();
diff --git a/administrator/language/en-GB/com_media.ini b/administrator/language/en-GB/com_media.ini
index d23c6c8f904f..1a000702e845 100644
--- a/administrator/language/en-GB/com_media.ini
+++ b/administrator/language/en-GB/com_media.ini
@@ -24,6 +24,11 @@ COM_MEDIA_DELETE_SUCCESS="Item deleted."
 COM_MEDIA_DROP_FILE="Drop file(s) to Upload"
 COM_MEDIA_EDIT="Media Edit"
 COM_MEDIA_ERROR="An error occurred."
+COM_MEDIA_ERROR_ACCOUNT_NOT_FOUND="The account was not found"
+COM_MEDIA_ERROR_ACCOUNT_NOT_SET="Account was not set."
+COM_MEDIA_ERROR_MEDIA_PROVIDER_NOT_FOUND="Media Provider not found."
+COM_MEDIA_ERROR_NO_ADAPTER_FOUND="No adapter found."
+COM_MEDIA_ERROR_NO_CONTENT_AVAILABLE="No content available!"
 COM_MEDIA_ERROR_NO_PROVIDERS="No filesystem providers have been found. Please enable at least one <a href=\"%s\">filesystem plugin</a>."
 COM_MEDIA_ERROR_NOT_AUTHENTICATED="You are not authenticated. Please login."
 COM_MEDIA_ERROR_NOT_AUTHORIZED="You are not authorised"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants