From a56f449eb5704aa32bd74bee11f075400dd117cf Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Sat, 9 May 2015 12:49:14 -0400 Subject: [PATCH] Remove some hardcoded English --- .../Controller/DisplayController.php | 2 +- .../PatchTester/Model/PullModel.php | 24 ++++++++++++------- .../language/en-GB/en-GB.com_patchtester.ini | 4 ++++ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/administrator/components/com_patchtester/PatchTester/Controller/DisplayController.php b/administrator/components/com_patchtester/PatchTester/Controller/DisplayController.php index 63616b9..a37c694 100644 --- a/administrator/components/com_patchtester/PatchTester/Controller/DisplayController.php +++ b/administrator/components/com_patchtester/PatchTester/Controller/DisplayController.php @@ -101,7 +101,7 @@ class DisplayController extends \JControllerBase if (!class_exists($viewClass)) { throw new \RuntimeException( - sprintf('The view class for the %1$s view in the %2$s was not found.', $view, $format), 500 + sprintf('The view class for the %1$s view in the %2$s format was not found.', $view, $format), 500 ); } } diff --git a/administrator/components/com_patchtester/PatchTester/Model/PullModel.php b/administrator/components/com_patchtester/PatchTester/Model/PullModel.php index 837cc93..88ddd40 100644 --- a/administrator/components/com_patchtester/PatchTester/Model/PullModel.php +++ b/administrator/components/com_patchtester/PatchTester/Model/PullModel.php @@ -224,7 +224,11 @@ class PullModel extends \JModelBase if (!\JFile::copy(\JPath::clean(JPATH_ROOT . '/' . $file->old), JPATH_COMPONENT . '/backups/' . md5($file->old) . '.txt')) { throw new \RuntimeException( - sprintf('Can not copy file %s to %s', JPATH_ROOT . '/' . $file->old, JPATH_COMPONENT . '/backups/' . md5($file->old) . '.txt') + \JText::sprintf( + 'COM_PATCHTESTER_ERROR_CANNOT_COPY_FILE', + JPATH_ROOT . '/' . $file->old, + JPATH_COMPONENT . '/backups/' . md5($file->old) . '.txt' + ) ); } } @@ -235,7 +239,7 @@ class PullModel extends \JModelBase case 'added': if (!\JFile::write(\JPath::clean(JPATH_ROOT . '/' . $file->new), $file->body)) { - throw new \RuntimeException(sprintf('Can not write the file: %s', JPATH_ROOT . '/' . $file->new)); + throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_CANNOT_WRITE_FILE', JPATH_ROOT . '/' . $file->new)); } break; @@ -243,7 +247,7 @@ class PullModel extends \JModelBase case 'deleted': if (!\JFile::delete(\JPath::clean(JPATH_ROOT . '/' . $file->old))) { - throw new \RuntimeException(sprintf('Can not delete the file: %s', JPATH_ROOT . '/' . $file->old)); + throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', JPATH_ROOT . '/' . $file->old)); } break; @@ -292,7 +296,7 @@ class PullModel extends \JModelBase if (!$files) { - throw new \RuntimeException(sprintf(\JText::_('%s - Error retrieving table data (%s)'), __METHOD__, htmlentities($table->data))); + throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_READING_DATABASE_TABLE', __METHOD__, htmlentities($table->data))); } jimport('joomla.filesystem.file'); @@ -306,8 +310,8 @@ class PullModel extends \JModelBase if (!\JFile::copy(JPATH_COMPONENT . '/backups/' . md5($file->old) . '.txt', JPATH_ROOT . '/' . $file->old)) { throw new \RuntimeException( - sprintf( - \JText::_('Can not copy file %s to %s'), + \JText::sprintf( + 'COM_PATCHTESTER_ERROR_CANNOT_COPY_FILE', JPATH_COMPONENT . '/backups/' . md5($file->old) . '.txt', JPATH_ROOT . '/' . $file->old ) @@ -316,7 +320,9 @@ class PullModel extends \JModelBase if (!\JFile::delete(JPATH_COMPONENT . '/backups/' . md5($file->old) . '.txt')) { - throw new \RuntimeException(sprintf(\JText::_('Can not delete the file: %s'), JPATH_COMPONENT . '/backups/' . md5($file->old) . '.txt')); + throw new \RuntimeException( + \JText::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', JPATH_COMPONENT . '/backups/' . md5($file->old) . '.txt') + ); } break; @@ -324,7 +330,9 @@ class PullModel extends \JModelBase case 'added': if (!\JFile::delete(\JPath::clean(JPATH_ROOT . '/' . $file->new))) { - throw new \RuntimeException(sprintf(\JText::_('Can not delete the file: %s'), JPATH_ROOT . '/' . $file->new)); + throw new \RuntimeException( + \JText::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', JPATH_ROOT . '/' . $file->new) + ); } break; diff --git a/administrator/components/com_patchtester/language/en-GB/en-GB.com_patchtester.ini b/administrator/components/com_patchtester/language/en-GB/en-GB.com_patchtester.ini index 7b77c51..8b0a169 100644 --- a/administrator/components/com_patchtester/language/en-GB/en-GB.com_patchtester.ini +++ b/administrator/components/com_patchtester/language/en-GB/en-GB.com_patchtester.ini @@ -15,8 +15,12 @@ COM_PATCHTESTER_CONFIGURATION="Joomla! Patch Tester Settings" COM_PATCHTESTER_CONFLICT_S="The patch could not be applied because it conflicts with a previously applied patch: %s" COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB="Could not connect to GitHub with the following error: %s" COM_PATCHTESTER_ERROR_APPLIED_PATCHES="Cannot fetch data from GitHub while there are applied patches. Please revert those patches before continuing." +COM_PATCHTESTER_ERROR_CANNOT_COPY_FILE="Cannot copy source file %1$s to destination %2$s" +COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE="Cannot delete file %s" +COM_PATCHTESTER_ERROR_CANNOT_WRITE_FILE="Cannot write file %s" COM_PATCHTESTER_ERROR_GITHUB_FETCH="Error retrieving pull requests from GitHub: %s" COM_PATCHTESTER_ERROR_INSERT_DATABASE="Error inserting pull request data into the database: %s" +COM_PATCHTESTER_ERROR_READING_DATABASE_TABLE="%1$s - Error retrieving table data (%2$s)" COM_PATCHTESTER_FETCH_AN_ERROR_HAS_OCCURRED="An error has occurred while fetching the data from GitHub." COM_PATCHTESTER_FETCH_COMPLETE_CLOSE_WINDOW="All data has been retrieved. Please close this modal window to refresh the page." COM_PATCHTESTER_FETCH_INITIALIZING="Preparing to fetch GitHub data"