diff options
author | sgiehl <stefan@piwik.org> | 2015-06-12 23:16:11 +0300 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2015-06-20 12:21:12 +0300 |
commit | c0905e36b971aa4eb4321ed302441ba17eecdebb (patch) | |
tree | 9ccdc172f3d4f4d2982036ddcbeb485aabf960f9 /plugins/LanguagesManager | |
parent | 1eb82eab48c744bb050ae205f72d338cf3dd7c34 (diff) |
fetch layout direction from cldr
Diffstat (limited to 'plugins/LanguagesManager')
3 files changed, 1 insertions, 28 deletions
diff --git a/plugins/LanguagesManager/Test/Unit/TranslationWriter/Validate/CoreTranslationsTest.php b/plugins/LanguagesManager/Test/Unit/TranslationWriter/Validate/CoreTranslationsTest.php index cd0ed02093..2b25f14f5b 100644 --- a/plugins/LanguagesManager/Test/Unit/TranslationWriter/Validate/CoreTranslationsTest.php +++ b/plugins/LanguagesManager/Test/Unit/TranslationWriter/Validate/CoreTranslationsTest.php @@ -73,21 +73,9 @@ class CoreTranslationsTest extends \PHPUnit_Framework_TestCase array( array( 'General' => array( - 'Locale' => 'de_DE.UTF-8', - 'TranslatorName' => 'name', - 'TranslatorEmail' => 'emails', - 'LayoutDirection' => 'afd' - ) - ), - CoreTranslations::ERRORSTATE_LAYOUTDIRECTIONINVALID - ), - array( - array( - 'General' => array( 'Locale' => 'invalid', 'TranslatorName' => 'name', 'TranslatorEmail' => 'emails', - 'LayoutDirection' => 'ltr' ) ), CoreTranslations::ERRORSTATE_LOCALEINVALID @@ -98,7 +86,6 @@ class CoreTranslationsTest extends \PHPUnit_Framework_TestCase 'Locale' => 'xx_DE.UTF-8', 'TranslatorName' => 'name', 'TranslatorEmail' => 'emails', - 'LayoutDirection' => 'ltr' ) ), CoreTranslations::ERRORSTATE_LOCALEINVALIDLANGUAGE @@ -109,7 +96,6 @@ class CoreTranslationsTest extends \PHPUnit_Framework_TestCase 'Locale' => 'de_XX.UTF-8', 'TranslatorName' => 'name', 'TranslatorEmail' => 'emails', - 'LayoutDirection' => 'ltr' ) ), CoreTranslations::ERRORSTATE_LOCALEINVALIDCOUNTRY diff --git a/plugins/LanguagesManager/Test/Unit/TranslationWriter/WriterTest.php b/plugins/LanguagesManager/Test/Unit/TranslationWriter/WriterTest.php index 00966cbe95..69f7f457e7 100644 --- a/plugins/LanguagesManager/Test/Unit/TranslationWriter/WriterTest.php +++ b/plugins/LanguagesManager/Test/Unit/TranslationWriter/WriterTest.php @@ -105,10 +105,6 @@ class WriterTest extends \PHPUnit_Framework_TestCase array(array('General' => array('Locale' => 'de_DE.UTF-8')) + $translations, CoreTranslations::ERRORSTATE_TRANSLATORINFOREQUIRED), array(array('General' => array('Locale' => 'de_DE.UTF-8', 'TranslatorName' => 'name')) + $translations, CoreTranslations::ERRORSTATE_TRANSLATOREMAILREQUIRED), - array(array('General' => array('Locale' => 'de_DE.UTF-8', - 'TranslatorName' => 'name', - 'TranslatorEmail' => 'name@domain.com', - 'LayoutDirection' => 'fail')) + $translations, CoreTranslations::ERRORSTATE_LAYOUTDIRECTIONINVALID), array(array('General' => array('Locale' => 'invalid', 'TranslatorName' => 'name', 'TranslatorEmail' => 'name@domain.com')) + $translations, CoreTranslations::ERRORSTATE_LOCALEINVALID), diff --git a/plugins/LanguagesManager/TranslationWriter/Validate/CoreTranslations.php b/plugins/LanguagesManager/TranslationWriter/Validate/CoreTranslations.php index 5da73db3f1..4c4fa065aa 100644 --- a/plugins/LanguagesManager/TranslationWriter/Validate/CoreTranslations.php +++ b/plugins/LanguagesManager/TranslationWriter/Validate/CoreTranslations.php @@ -21,7 +21,6 @@ class CoreTranslations extends ValidateAbstract const ERRORSTATE_LOCALEREQUIRED = 'Locale required'; const ERRORSTATE_TRANSLATORINFOREQUIRED = 'Translator info required'; const ERRORSTATE_TRANSLATOREMAILREQUIRED = 'Translator email required'; - const ERRORSTATE_LAYOUTDIRECTIONINVALID = 'Layout direction must be rtl or ltr'; const ERRORSTATE_LOCALEINVALID = 'Locale is invalid'; const ERRORSTATE_LOCALEINVALIDLANGUAGE = 'Locale is invalid - invalid language code'; const ERRORSTATE_LOCALEINVALIDCOUNTRY = 'Locale is invalid - invalid country code'; @@ -40,9 +39,8 @@ class CoreTranslations extends ValidateAbstract /** * Validates the given translations - * * There need to be more than 250 translations presen + * * There need to be more than 250 translations present * * Locale, TranslatorName and TranslatorEmail needs to be set in plugin General - * * LayoutDirection needs to be ltr or rtl if present * * Locale must be valid (format, language & country) * * @param array $translations @@ -68,13 +66,6 @@ class CoreTranslations extends ValidateAbstract return false; } - if (!empty($translations['General']['LayoutDirection']) && - !in_array($translations['General']['LayoutDirection'], array('ltr', 'rtl')) - ) { - $this->message = self::ERRORSTATE_LAYOUTDIRECTIONINVALID; - return false; - } - /** @var LanguageDataProvider $languageDataProvider */ $languageDataProvider = StaticContainer::get('Piwik\Intl\Data\Provider\LanguageDataProvider'); /** @var RegionDataProvider $regionDataProvider */ |