Skip to content

Commit

Permalink
WEB: Implemented variable substitution in lang.ini and use in Compati…
Browse files Browse the repository at this point in the history
…bility and Screenshots
  • Loading branch information
sev- committed Dec 12, 2015
1 parent b9aec44 commit 97c2e42
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 13 deletions.
24 changes: 14 additions & 10 deletions include/Pages/CompatibilityPage.php
Expand Up @@ -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',
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions include/Pages/ScreenshotsPage.php
Expand Up @@ -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,
),
Expand Down Expand Up @@ -74,7 +76,7 @@ public function getCategory($category, $game) {
'games' => array(ScreenshotsModel::getTargetScreenshots($game))
);
}

return $this->renderPage(
array(
'title' => 'Screenshots',
Expand Down
11 changes: 11 additions & 0 deletions 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"
11 changes: 11 additions & 0 deletions lang/lang.ru.ini
@@ -1 +1,12 @@
newsTitle = "Последние новости"

screenshotsTitle = "Скриншоты"
screenshotsContentTitle = "Скриншоты"

compatibilityUntested = "Не тестирована"
compatibilityBroken = "Сломана"
compatibilityBugged = "С багами"
compatibilityGood = "Хорошая"
compatibilityExcellent = "Превосходная"
compatibilityTitle = "Совместимость - {version}"
compatibilityContentTitle = "Совместимость версии {version}"

0 comments on commit 97c2e42

Please sign in to comment.