From d77625dfe0de85dec2611ea8db6dd2af924d3528 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 6 Dec 2015 20:58:25 +0100 Subject: [PATCH] WEB: Implemented variable substitution in lang.ini and use in Compatibility and Screenshots --- include/Pages/CompatibilityPage.php | 24 ++++++++++++++---------- include/Pages/ScreenshotsPage.php | 8 +++++--- lang/lang.ini | 11 +++++++++++ lang/lang.ru.ini | 11 +++++++++++ 4 files changed, 41 insertions(+), 13 deletions(-) diff --git a/include/Pages/CompatibilityPage.php b/include/Pages/CompatibilityPage.php index 2778297fb..1a5419acd 100644 --- a/include/Pages/CompatibilityPage.php +++ b/include/Pages/CompatibilityPage.php @@ -8,21 +8,22 @@ */ class CompatibilityPage extends Controller { private $_template; - private $_template_details; + private $_template_details; private $_supportLevelDesc; private $_supportLevelClass; /* Constructor. */ public function __construct() { parent::__construct(); + global $Smarty; $this->_template = 'compatibility.tpl'; $this->_template_details = 'compatibility_details.tpl'; $this->_supportLevelDesc = array( - 'untested' => 'Untested', - 'broken' => 'Broken', - 'bugged' => 'Bugged', - 'good' => 'Good', - 'excellent' => 'Excellent' + 'untested' => $Smarty->_config[0]['vars']['compatibilityUntested'], + 'broken' => $Smarty->_config[0]['vars']['compatibilityBroken'], + 'bugged' => $Smarty->_config[0]['vars']['compatibilityBugged'], + 'good' => $Smarty->_config[0]['vars']['compatibilityGood'], + 'excellent' => $Smarty->_config[0]['vars']['compatibilityExcellent'] ); $this->_supportLevelClass = array( 'untested' => 'pctU', @@ -53,12 +54,13 @@ public function index() { /* We should show detailed information for a specific target. */ public function getGame($target, $version, $oldLayout) { $game = CompatibilityModel::getGameData($version, $target); + global $Smarty; $this->addCSSFiles(array('chart.css', 'compatibility.css')); return $this->renderPage( array( - 'title' => "Compatibility - {$version}", - 'content_title' => "{$version} Compatibility", + 'title' => preg_replace('/{version}/', $version, $Smarty->_config[0]['vars']['compatibilityTitle']), + 'content_title' => preg_replace('/{version}/', $version, $Smarty->_config[0]['vars']['compatibilityContentTitle']), 'version' => $version, 'game' => $game, 'old_layout' => $oldLayout, @@ -85,11 +87,13 @@ public function getAll($version, $oldLayout) { $last_updated = date("F d, Y", @filemtime($filename)); $compat_data = CompatibilityModel::getAllData($version); + global $Smarty; + $this->addCSSFiles(array('chart.css', 'compatibility.css')); return $this->renderPage( array( - 'title' => "Compatibility - {$version}", - 'content_title' => "{$version} Compatibility", + 'title' => preg_replace('/{version}/', $version, $Smarty->_config[0]['vars']['compatibilityTitle']), + 'content_title' => preg_replace('/{version}/', $version, $Smarty->_config[0]['vars']['compatibilityContentTitle']), 'version' => $version, 'compat_data' => $compat_data, 'last_updated' => $last_updated, diff --git a/include/Pages/ScreenshotsPage.php b/include/Pages/ScreenshotsPage.php index d6bd87c8d..388982bd7 100644 --- a/include/Pages/ScreenshotsPage.php +++ b/include/Pages/ScreenshotsPage.php @@ -43,10 +43,12 @@ public function index() { $screenshot = ScreenshotsModel::getAllScreenshots(); $random_shot = ScreenshotsModel::getRandomScreenshot(); + global $Smarty; + return $this->renderPage( array( - 'title' => 'Screenshots', - 'content_title' => 'Screenshots', + 'title' => $Smarty->_config[0]['vars']['screenshotsTitle'], + 'content_title' => $Smarty->_config[0]['vars']['screenshotsContentTitle'], 'screenshots' => $screenshot, 'random_shot' => $random_shot, ), @@ -74,7 +76,7 @@ public function getCategory($category, $game) { 'games' => array(ScreenshotsModel::getTargetScreenshots($game)) ); } - + return $this->renderPage( array( 'title' => 'Screenshots', diff --git a/lang/lang.ini b/lang/lang.ini index 644dad67c..4a5c2c0bc 100644 --- a/lang/lang.ini +++ b/lang/lang.ini @@ -1 +1,12 @@ newsTitle = "Latest Developments" + +screenshotsTitle = "Screenshots" +screenshotsContentTitle = "Screenshots" + +compatibilityUntested = "Untested" +compatibilityBroken = "Broken" +compatibilityBugged = "Bugged" +compatibilityGood = "Good" +compatibilityExcellent = "Excellent" +compatibilityTitle = "Compatibility - {version}" +compatibilityContentTitle = "{version} Compatibility" diff --git a/lang/lang.ru.ini b/lang/lang.ru.ini index b9377d3af..47084f4a1 100644 --- a/lang/lang.ru.ini +++ b/lang/lang.ru.ini @@ -1 +1,12 @@ newsTitle = "Последние новости" + +screenshotsTitle = "Скриншоты" +screenshotsContentTitle = "Скриншоты" + +compatibilityUntested = "Не тестирована" +compatibilityBroken = "Сломана" +compatibilityBugged = "С багами" +compatibilityGood = "Хорошая" +compatibilityExcellent = "Превосходная" +compatibilityTitle = "Совместимость - {version}" +compatibilityContentTitle = "Совместимость версии {version}"