/**
  * test all languages
  *
  * @group Plugins
  *
  * @dataProvider getTestDataForLanguageFiles
  */
 function testGetTranslationsForLanguages($language, $plugin)
 {
     $translationWriter = new Writer($language, $plugin);
     $baseTranslations = $translationWriter->getTranslations('en');
     $translationWriter->addValidator(new NoScripts());
     if (empty($plugin)) {
         $translationWriter->addValidator(new CoreTranslations($baseTranslations));
     }
     // prevent build from failing when translations string have been deleted
     //        $translationWriter->addFilter(new ByBaseTranslations($baseTranslations));
     $translationWriter->addFilter(new EmptyTranslations());
     $translationWriter->addFilter(new ByParameterCount($baseTranslations));
     $translationWriter->addFilter(new UnnecassaryWhitespaces($baseTranslations));
     $translationWriter->addFilter(new EncodedEntities());
     $translations = $translationWriter->getTranslations($language);
     if (empty($translations)) {
         return;
         // skip language / plugin combinations that aren't present
     }
     $translationWriter->setTranslations($translations);
     $this->assertTrue($translationWriter->isValid(), $translationWriter->getValidationMessage());
     if ($translationWriter->wasFiltered()) {
         $translationWriter->saveTemporary();
         $this->markTestSkipped(implode("\n", $translationWriter->getFilterMessages()) . "\n" . 'Translation file errors detected in ' . $language . "...\n" . "To synchronise the language files with the english strings, you can manually edit the language files or run the following command may work if you have access to Transifex: \n" . "\$ ./console translations:update [--plugin=XYZ] \n");
     }
 }
 /**
  * @group Core
  */
 public function testSaveTranslation()
 {
     $translations = json_decode(file_get_contents(PIWIK_INCLUDE_PATH . '/lang/en.json'), true);
     $translationsToWrite = array();
     $translationsToWrite['General'] = $translations['General'];
     $translationsToWrite['Mobile'] = $translations['Mobile'];
     $translationsToWrite['General']['Yes'] = 'string with %1$s';
     $translationsToWrite['Plugin'] = array('Body' => "Message\nBody");
     $translationWriter = new Writer('fr');
     $translationWriter->addFilter(new UnnecassaryWhitespaces($translations));
     $translationWriter->addFilter(new ByBaseTranslations($translations));
     $translationWriter->addFilter(new ByParameterCount($translations));
     $translationWriter->setTranslations($translationsToWrite);
     $rc = $translationWriter->saveTemporary();
     @unlink(PIWIK_INCLUDE_PATH . '/tmp/fr.json');
     $this->assertGreaterThan(25000, $rc);
     $this->assertCount(4, $translationWriter->getFilterMessages());
 }