Translation updates and UI improvements

This commit is contained in:
gamonoid
2018-03-17 19:09:52 +01:00
parent a0d77cb944
commit afc069afaa
38 changed files with 11401 additions and 14426 deletions

View File

@@ -1,8 +1,12 @@
<?php
class PHPUnit_Framework_TestCase extends \PHPUnit\Framework\TestCase{
if (!class_exists('PHPUnit_Framework_TestCase')) {
class PHPUnit_Framework_TestCase extends \PHPUnit\Framework\TestCase
{
}
}
class TestTemplate extends PHPUnit_Framework_TestCase
{

View File

@@ -2,6 +2,7 @@
namespace Test\Unit;
use Classes\LanguageManager;
use Gettext\Translations;
class LanguageManagerUnit extends \TestTemplate
{
@@ -10,7 +11,7 @@ class LanguageManagerUnit extends \TestTemplate
{
parent::setUp();
}
public function testTran()
{
$this->assertEquals('cat', LanguageManager::tran('cat'));
@@ -20,4 +21,23 @@ class LanguageManagerUnit extends \TestTemplate
$this->assertEquals('User Logged In now', LanguageManager::translateTnrText('User <t>Logged In</t> now'));
fwrite(STDOUT, __METHOD__ . " End\n");
}
public function testGetTranslations() {
$enCount = $this->getTranslationCount('en');
$this->assertEquals($enCount, $this->getTranslationCount('de'));
$this->assertEquals($enCount, $this->getTranslationCount('es'));
$this->assertEquals($enCount, $this->getTranslationCount('fr'));
$this->assertEquals($enCount, $this->getTranslationCount('hi'));
$this->assertEquals($enCount, $this->getTranslationCount('it'));
$this->assertEquals($enCount, $this->getTranslationCount('ja'));
$this->assertEquals($enCount, $this->getTranslationCount('pl'));
$this->assertEquals($enCount, $this->getTranslationCount('zh'));
}
private function getTranslationCount($lang) {
$trans = json_decode(LanguageManager::getTranslations($lang), true);
$count = count(array_keys($trans['messages']['']));
}
}