Skip to content

Commit

Permalink
[4.1] com_media: hardcoded language strings (#37588)
Browse files Browse the repository at this point in the history
* [4.1] com_media: hardcoded language strings
  • Loading branch information
pe7er committed Apr 21, 2022
1 parent 34d4eeb commit d39e01a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
Expand Up @@ -11,6 +11,7 @@

\defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\Component\Media\Administrator\Adapter\AdapterInterface;

/**
Expand Down Expand Up @@ -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];
Expand All @@ -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];
Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
Expand Up @@ -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();
Expand Down
5 changes: 5 additions & 0 deletions administrator/language/en-GB/com_media.ini
Expand Up @@ -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"
Expand Down

0 comments on commit d39e01a

Please sign in to comment.