[TASK] Move language file to XLIFF 12/47512/2
authorFrancois Suter <francois@typo3.org>
Tue, 5 Apr 2016 10:58:02 +0000 (12:58 +0200)
committerFrancois Suter <francois@typo3.org>
Tue, 5 Apr 2016 10:59:29 +0000 (12:59 +0200)
And place in Resources/Private/Language folder.

Releases: 2.0
Resolves: #75411
Change-Id: Iec5e09e67683bb334d01626b265bb98266cecf59
Reviewed-on: https://review.typo3.org/47512
Reviewed-by: Francois Suter <francois@typo3.org>
Tested-by: Francois Suter <francois@typo3.org>
Classes/Controller/SandboxController.php
Classes/Controller/locallang.xml [deleted file]
Resources/Private/Language/locallang.xlf [new file with mode: 0644]

index aadc3cd..3cbd59b 100644 (file)
@@ -14,6 +14,9 @@ namespace Cobweb\ExpressionsSandbox\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Cobweb\Expressions\ExpressionParser;
+use TYPO3\CMS\Core\Utility\DebugUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Plugin 'Expressions sandbox' for the 'expressions_sandbox' extension.
@@ -28,10 +31,10 @@ class SandboxController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
        public $extKey        = 'expressions_sandbox';  // The extension key.
 
        /**
-        * The main method of the PlugIn
+        * The main method of the Plugin
         *
-        * @param string $content The PlugIn's content (empty in this case)
-        * @param array $conf The PlugIn configuration
+        * @param string $content The Plugin's content (empty in this case)
+        * @param array $conf The Plugin configuration
         * @return string The content that is displayed on the website
         */
        public function main($content, $conf) {
@@ -40,12 +43,12 @@ class SandboxController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
                $content = '';
 
                $expressionsField = $this->conf['expressionsField'];
-               $expressions = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode("\n", $expressionsField, TRUE);
+               $expressions = GeneralUtility::trimExplode("\n", $expressionsField, TRUE);
                foreach ($expressions as $anExpression) {
                        try {
-                               $result = \Cobweb\Expressions\ExpressionParser::evaluateExpression($anExpression);
+                               $result = ExpressionParser::evaluateExpression($anExpression);
                                if (is_array($result)) {
-                                       $result = \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($result);
+                                       $result = DebugUtility::viewArray($result);
                                }
                                $content .= '<p>' . sprintf($this->pi_getLL('expression_parsed'), '<code>' . $anExpression . '</code>', '<strong>' . $result . '</strong>') . '</p>';
                        }
@@ -63,7 +66,7 @@ class SandboxController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
         * @return void
         */
        protected function init($conf) {
-               $this->pi_loadLL();
+               $this->pi_loadLL('EXT:expressions_sandbox/Resources/Private/Language/locallang.xlf');
                // Base configuration is equal to the plug-in's TS setup
                $this->conf = $conf;
 
diff --git a/Classes/Controller/locallang.xml b/Classes/Controller/locallang.xml
deleted file mode 100644 (file)
index a5825b5..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<T3locallang>
-       <meta type="array">
-               <type>module</type>
-               <description>Language labels for plugin &quot;tx_expressionssandbox_pi1&quot;</description>
-       </meta>
-       <data type="array">
-               <languageKey index="default" type="array">
-                       <label index="expression_parsed">Expression: %1$s => Result: %2$s</label>
-                       <label index="expression_not_parsed">Expression: %s could not be parsed</label>
-               </languageKey>
-       </data>
-</T3locallang>
\ No newline at end of file
diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf
new file mode 100644 (file)
index 0000000..7d258eb
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<xliff version="1.0">
+       <file source-language="en" datatype="plaintext" original="messages" date="2014-08-13T22:46:35Z" product-name="expressions_sandbox">
+               <header />
+               <body>
+                       <trans-unit id="expression_parsed">
+                               <source>Expression: %1$s => Result: %2$s</source>
+                       </trans-unit>
+                       <trans-unit id="expression_not_parsed">
+                               <source>Expression: %s could not be parsed</source>
+                       </trans-unit>
+               </body>
+       </file>
+</xliff>