Cleanup #12426: Reports: Localized all hard-coded strings in status reports
authorFrancois Suter <francois.suter@typo3.org>
Mon, 16 Nov 2009 21:17:42 +0000 (21:17 +0000)
committerFrancois Suter <francois.suter@typo3.org>
Mon, 16 Nov 2009 21:17:42 +0000 (21:17 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6433 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/install/report/class.tx_install_report_installstatus.php
typo3/sysext/install/report/locallang.xml [new file with mode: 0644]
typo3/sysext/reports/reports/locallang.xml
typo3/sysext/reports/reports/status/class.tx_reports_reports_status_configurationstatus.php
typo3/sysext/reports/reports/status/class.tx_reports_reports_status_securitystatus.php
typo3/sysext/reports/reports/status/class.tx_reports_reports_status_systemstatus.php

index 4f6e993..9a744c2 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2009-11-16  Francois Suter  <francois@typo3.org>
 
        * Fixed bug #12565: Scheduler: Added option to turn off logging, which could be too verbose
+       * Cleanup #12426: Reports: Localized all hard-coded strings in status reports
 
 2009-11-16  Oliver Hader  <oliver@typo3.org>
 
index d7369ab..f363d57 100644 (file)
@@ -73,7 +73,7 @@ class tx_install_report_InstallStatus implements tx_reports_StatusProvider {
         * @return unknown_type
         */
        protected function getFileSystemStatus() {
-               $value    = 'Writable';
+               $value    = $GLOBALS['LANG']->sL('LLL:EXT:install/report/locallang.xml:status_writable');
                $message  = '';
                $severity = tx_reports_reports_status_Status::OK;
 
@@ -112,18 +112,18 @@ class tx_install_report_InstallStatus implements tx_reports_StatusProvider {
                        if (!@is_dir(PATH_site . $relPath)) {
                                if ($requirementLevel > 0) {
                                                // directory is required
-                                       $value = 'Required Directory Missing';
-                                       $message .= $relPath . ' does not exist and could not be created.<br />';
+                                       $value = $GLOBALS['LANG']->sL('LLL:EXT:install/report/locallang.xml:status_missingDirectory');
+                                       $message .= sprintf($GLOBALS['LANG']->sL('LLL:EXT:install/report/locallang.xml:status_directoryDoesNotExistCouldNotCreate'), $relPath) . '<br />';
                                        $severity = tx_reports_reports_status_Status::ERROR;
                                } else {
+                                       $message .= sprintf($GLOBALS['LANG']->sL('LLL:EXT:install/report/locallang.xml:status_directoryDoesNotExist'), $relPath);
                                        if ($requirementLevel == 0) {
-                                               $message .= $relPath . ' does not exist but should be writable if it does exist.<br />';
-                                       } else {
-                                               $message .= $relPath . ' does not exist.<br />';
+                                               $message .= ' ' . $GLOBALS['LANG']->sL('LLL:EXT:install/report/locallang.xml:status_directoryShouldAlsoBeWritable');
                                        }
+                                       $message .= '<br />';
 
                                        if ($severity < tx_reports_reports_status_Status::WARNING) {
-                                               $value = 'Directory not existing';
+                                               $value = $GLOBALS['LANG']->sL('LLL:EXT:install/report/locallang.xml:status_nonExistingDirectory');
                                                $severity = tx_reports_reports_status_Status::WARNING;
                                        }
                                }
@@ -131,16 +131,16 @@ class tx_install_report_InstallStatus implements tx_reports_StatusProvider {
                                if (!is_writable(PATH_site . $relPath)) {
                                        switch ($requirementLevel) {
                                                case 0:
-                                                       $message .= PATH_site . $relPath . ' should be writable.<br />';
+                                                       $message .= sprintf($GLOBALS['LANG']->sL('LLL:EXT:install/report/locallang.xml:status_directoryShouldBeWritable'), PATH_site . $relPath) . '<br />';
 
                                                        if ($severity < tx_reports_reports_status_Status::WARNING) {
-                                                               $value = 'Directory should be writable';
+                                                               $value = $GLOBALS['LANG']->sL('LLL:EXT:install/report/locallang.xml:status_recommendedWritableDirectory');
                                                                $severity = tx_reports_reports_status_Status::WARNING;
                                                        }
                                                        break;
                                                case 2:
-                                                       $value = 'Directory not writable';
-                                                       $message .= PATH_site . $relPath . ' must be writable.<br />';
+                                                       $value = $GLOBALS['LANG']->sL('LLL:EXT:install/report/locallang.xml:status_requiredWritableDirectory');
+                                                       $message .= sprintf($GLOBALS['LANG']->sL('LLL:EXT:install/report/locallang.xml:status_directoryMustBeWritable'), PATH_site . $relPath) . '<br />';
                                                        $severity = tx_reports_reports_status_Status::ERROR;
                                                        break;
                                        }
@@ -149,7 +149,7 @@ class tx_install_report_InstallStatus implements tx_reports_StatusProvider {
                }
 
                return t3lib_div::makeInstance('tx_reports_reports_status_Status',
-                       'File System',
+                       $GLOBALS['LANG']->sL('LLL:EXT:install/report/locallang.xml:status_fileSystem'),
                        $value,
                        $message,
                        $severity
@@ -180,7 +180,7 @@ class tx_install_report_InstallStatus implements tx_reports_StatusProvider {
                }
 
                return t3lib_div::makeInstance('tx_reports_reports_status_Status',
-                       'Remaining Updates', $value, $message, $severity
+                       $GLOBALS['LANG']->sL('LLL:EXT:install/report/locallang.xml:status_remainingUpdates'), $value, $message, $severity
                );
        }
 
diff --git a/typo3/sysext/install/report/locallang.xml b/typo3/sysext/install/report/locallang.xml
new file mode 100644 (file)
index 0000000..e3a05b2
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <type>module</type>
+               <description>Language labels for the Install Tool status reports</description>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="status_fileSystem">File System</label>
+                       <label index="status_writable">Writable</label>
+                       <label index="status_missingDirectory">Required Directory Missing</label>
+                       <label index="status_nonExistingDirectory">Directory not existing</label>
+                       <label index="status_recommendedWritableDirectory">Directory should be writable</label>
+                       <label index="status_requiredWritableDirectory">Directory not writable</label>
+                       <label index="status_directoryDoesNotExist">%s does not exist.</label>
+                       <label index="status_directoryDoesNotExistCouldNotCreate">%s does not exist and could not be created.</label>
+                       <label index="status_directoryShouldAlsoBeWritable">Also note that it should be writable, if it did exist.</label>
+                       <label index="status_directoryShouldBeWritable">%s should be writable.</label>
+                       <label index="status_directoryMustBeWritable">%s must be writable.</label>
+                       <label index="status_remainingUpdates">Remaining Updates</label>
+               </languageKey>
+       </data>
+</T3locallang>
\ No newline at end of file
index 52ac107..7bb9652 100644 (file)
@@ -2,7 +2,7 @@
 <T3locallang>
        <meta type="array">
                <type>module</type>
-               <description>Language labels for module 'tools_txreportsM1'</description>
+               <description>Language labels for the status reports</description>
        </meta>
        <data type="array">
                <languageKey index="default" type="array">
                        <label index="status_system">System</label>
                        <label index="status_security">Security</label>
                        <label index="status_configuration">Configuration</label>
+                       <label index="status_referenceIndex">Reference Index</label>
+                       <label index="status_memcachedConfiguration">Memcached Configuration</label>
+                       <label index="status_adminUserAccount">Admin User Account</label>
+                       <label index="status_encryptionKey">Encryption Key</label>
+                       <label index="status_fileDenyPattern">File Deny Pattern</label>
+                       <label index="status_htaccessUploadProtection">.htaccess Upload Protection</label>
+                       <label index="status_installToolPassword">Install Tool Password</label>
+                       <label index="status_installTool">Install Tool</label>
+                       <label index="status_phpVersion">PHP Version</label>
+                       <label index="status_phpTooOld">Your PHP installation is too old.</label>
+                       <label index="status_phpMemory">PHP Memory Limit</label>
+                       <label index="status_phpMemoryRecommendation">Depending on your configuration, TYPO3 can run with a %1$s PHP memory limit. However, a %2$s PHP memory limit or above is recommended, especially if your site uses additional extensions.</label>
+                       <label index="status_phpMemoryRequirement">Depending on your configuration, TYPO3 can run with a %1$s PHP memory limit. However, a %2$s PHP memory limit or above is required especially if your site uses additional extensions.</label>
+                       <label index="status_phpMemoryEditLimit">Increase the memory limit by editing the memory_limit parameter in the file %s and then restart your web server (or contact your system administrator or hosting provider for assistance).</label>
+                       <label index="status_phpMemoryContactAdmin">Depending on your configuration, TYPO3 can run with a %1$s PHP memory limit. However, a %2$s PHP memory limit or above is required especially if your site uses additional extensions.</label>
+                       <label index="status_phpRegisterGlobals">PHP Register Globals</label>
+                       <label index="status_phpRegisterGlobalsEnabled">%s is enabled. TYPO3 requires this configuration directive to be disabled.</label>
+                       <label index="status_phpRegisterGlobalsSecurity">Your site may not be secure when %s is enabled.</label>
+                       <label index="status_phpRegisterGlobalsHowToChange">how to change configuration settings</label>
+                       <label index="status_phpRegisterGlobalsPHPManual">The PHP manual has instructions for %s.</label>
+                       <label index="status_webServer">Web Server</label>
                </languageKey>
        </data>
 </T3locallang>
\ No newline at end of file
index 9cbb733..11963b9 100644 (file)
@@ -75,7 +75,7 @@ class tx_reports_reports_status_ConfigurationStatus implements tx_reports_Status
                }\r
 \r
                return t3lib_div::makeInstance('tx_reports_reports_status_Status',\r
-                       'Reference Index', $value, $message, $severity\r
+                       $GLOBALS['LANG']->getLL('status_referenceIndex'), $value, $message, $severity\r
                );\r
        }\r
 \r
@@ -171,7 +171,7 @@ class tx_reports_reports_status_ConfigurationStatus implements tx_reports_Status
                }\r
 \r
                return t3lib_div::makeInstance('tx_reports_reports_status_Status',\r
-                       'Memcached Configuration', $value, $message, $severity\r
+                       $GLOBALS['LANG']->getLL('status_memcachedConfiguration'), $value, $message, $severity\r
                );\r
        }\r
 \r
index acff551..3af76b9 100644 (file)
@@ -84,7 +84,7 @@ class tx_reports_reports_status_SecurityStatus implements tx_reports_StatusProvi
                $GLOBALS['TYPO3_DB']->sql_free_result($res);\r
 \r
                return t3lib_div::makeInstance('tx_reports_reports_status_Status',\r
-                       'Admin User Account', $value, $message, $severity\r
+                       $GLOBALS['LANG']->getLL('status_adminUserAccount'), $value, $message, $severity\r
                );\r
        }\r
 \r
@@ -113,7 +113,7 @@ class tx_reports_reports_status_SecurityStatus implements tx_reports_StatusProvi
                }\r
 \r
                return t3lib_div::makeInstance('tx_reports_reports_status_Status',\r
-                       'Encryption Key', $value, $message, $severity\r
+                       $GLOBALS['LANG']->getLL('status_encryptionKey'), $value, $message, $severity\r
                );\r
        }\r
 \r
@@ -143,7 +143,7 @@ class tx_reports_reports_status_SecurityStatus implements tx_reports_StatusProvi
                }\r
 \r
                return t3lib_div::makeInstance('tx_reports_reports_status_Status',\r
-                       'File Deny Pattern', $value, $message, $severity\r
+                       $GLOBALS['LANG']->getLL('status_fileDenyPattern'), $value, $message, $severity\r
                );\r
        }\r
 \r
@@ -165,7 +165,7 @@ class tx_reports_reports_status_SecurityStatus implements tx_reports_StatusProvi
                }\r
 \r
                return t3lib_div::makeInstance('tx_reports_reports_status_Status',\r
-                       '.htaccess Upload Protection', $value, $message, $severity\r
+                       $GLOBALS['LANG']->getLL('status_htaccessUploadProtection'), $value, $message, $severity\r
                );\r
        }\r
 \r
@@ -226,7 +226,7 @@ class tx_reports_reports_status_SecurityStatus implements tx_reports_StatusProvi
                }\r
 \r
                return t3lib_div::makeInstance('tx_reports_reports_status_Status',\r
-                       'Install Tool Password', $value, $message, $severity\r
+                       $GLOBALS['LANG']->getLL('status_installToolPassword'), $value, $message, $severity\r
                );\r
        }\r
 \r
@@ -261,7 +261,7 @@ class tx_reports_reports_status_SecurityStatus implements tx_reports_StatusProvi
                }\r
 \r
                return t3lib_div::makeInstance('tx_reports_reports_status_Status',\r
-                       'Install Tool', $value, $message, $severity\r
+                       $GLOBALS['LANG']->getLL('status_installTool'), $value, $message, $severity\r
                );\r
        }\r
 \r
index 88e91c9..eba6267 100644 (file)
@@ -59,12 +59,12 @@ class tx_reports_reports_status_SystemStatus implements tx_reports_StatusProvide
                $severity = tx_reports_reports_status_Status::OK;
 
                if (version_compare(phpversion(), TYPO3_REQUIREMENTS_MINIMUM_PHP) < 0) {
-                       $message  = 'Your PHP installation is too old.';
+                       $message  = $GLOBALS['LANG']->getLL('status_phpTooOld');
                        $severity = tx_reports_reports_status_Status::ERROR;
                }
 
                return t3lib_div::makeInstance('tx_reports_reports_status_Status',
-                       'PHP',
+                       $GLOBALS['LANG']->getLL('status_phpVersion'),
                        phpversion(),
                        $message,
                        $severity
@@ -82,25 +82,25 @@ class tx_reports_reports_status_SystemStatus implements tx_reports_StatusProvide
                $severity    = tx_reports_reports_status_Status::OK;
 
                if ($memoryLimit && t3lib_div::getBytesFromSizeMeasurement($memoryLimit) < t3lib_div::getBytesFromSizeMeasurement(TYPO3_REQUIREMENTS_RECOMMENDED_PHP_MEMORY_LIMIT)) {
-                       $message = 'Depending on your configuration, TYPO3 can run with a ' . $memoryLimit . ' PHP memory limit. However, a ' . TYPO3_REQUIREMENTS_RECOMMENDED_PHP_MEMORY_LIMIT . ' PHP memory limit or above is recommended, especially if your site uses additional extensions.';
+                       $message = sprintf($GLOBALS['LANG']->getLL('status_phpMemoryRecommendation'), $memoryLimit, TYPO3_REQUIREMENTS_RECOMMENDED_PHP_MEMORY_LIMIT);
                        $severity = tx_reports_reports_status_Status::WARNING;
                }
 
                if ($memoryLimit && t3lib_div::getBytesFromSizeMeasurement($memoryLimit) < t3lib_div::getBytesFromSizeMeasurement(TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT)) {
-                       $message = 'Depending on your configuration, TYPO3 can run with a ' . $memoryLimit . ' PHP memory limit. However, a ' . TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT . ' PHP memory limit or above is required, especially if your site uses additional extensions.';
+                       $message = sprintf($GLOBALS['LANG']->getLL('status_phpMemoryRequirement'), $memoryLimit, TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT);
                        $severity = tx_reports_reports_status_Status::ERROR;
                }
 
                if ($severity > tx_reports_reports_status_Status::OK) {
                        if ($php_ini_path = get_cfg_var('cfg_file_path')) {
-                               $message .= ' Increase the memory limit by editing the memory_limit parameter in the file ' . $php_ini_path . ' and then restart your web server (or contact your system administrator or hosting provider for assistance).';
+                               $message .= ' ' . sprintf($GLOBALS['LANG']->getLL('status_phpMemoryEditLimit'), $php_ini_path);
                        } else {
-                               $message .= ' Contact your system administrator or hosting provider for assistance with increasing your PHP memory limit.';
+                               $message .= ' ' . $GLOBALS['LANG']->getLL('status_phpMemoryContactAdmin');
                        }
                }
 
                return t3lib_div::makeInstance('tx_reports_reports_status_Status',
-                       'PHP Memory Limit', $memoryLimit, $message, $severity
+                       $GLOBALS['LANG']->getLL('status_phpMemory'), $memoryLimit, $message, $severity
                );
        }
 
@@ -118,14 +118,18 @@ class tx_reports_reports_status_SystemStatus implements tx_reports_StatusProvide
 
                        // can't reliably check for 'on', therefore checking for the oposite 'off', '', or 0
                if (!empty($registerGlobals) && strtolower($registerGlobals) != 'off') {
-                       $message = '<em>register_globals</em> is enabled. TYPO3 requires this configuration directive to be disabled. Your site may not be secure when <em>register_globals</em> is enabled. The PHP manual has instructions for <a href="http://php.net/configuration.changes">how to change configuration settings</a>.';
+                       $registerGlobalsHighlight = '<em>register_globals</em>';
+                       $phpManualLink .= '<a href="http://php.net/configuration.changes">' . $GLOBALS['LANG']->getLL('status_phpRegisterGlobalsHowToChange') . '</a>';
+                       $message  = sprintf($GLOBALS['LANG']->getLL('status_phpRegisterGlobalsEnabled'), $registerGlobalsHighlight);
+                       $message .= ' ' . sprintf($GLOBALS['LANG']->getLL('status_phpRegisterGlobalsSecurity'), $registerGlobalsHighlight);
+                       $message .= ' ' . sprintf($GLOBALS['LANG']->getLL('status_phpRegisterGlobalsPHPManual'), $phpManualLink);
                        $severity = tx_reports_reports_status_Status::ERROR;
                        $value = $GLOBALS['LANG']->getLL('status_enabled')
                                . ' (\'' . $registerGlobals . '\')';
                }
 
                return t3lib_div::makeInstance('tx_reports_reports_status_Status',
-                       'PHP Register Globals', $value, $message, $severity
+                       $GLOBALS['LANG']->getLL('status_phpRegisterGlobals'), $value, $message, $severity
                );
        }
 
@@ -136,7 +140,7 @@ class tx_reports_reports_status_SystemStatus implements tx_reports_StatusProvide
         */
        protected function getWebserverStatus() {
                return t3lib_div::makeInstance('tx_reports_reports_status_Status',
-                       'Web Server',
+                       $GLOBALS['LANG']->getLL('status_webServer'),
                        $_SERVER['SERVER_SOFTWARE']
                );
        }