From 9651889f1bcb9ef1bb2bd9c1eceeb1ec5f8d630d Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Tue, 10 Mar 2015 13:42:22 +1300 Subject: [PATCH] BUG Fix yaml generation to conform to version 1.1, accepted by transifex --- i18n/i18nTextCollector.php | 6 +++++- tests/i18n/i18nTextCollectorTest.php | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/i18n/i18nTextCollector.php b/i18n/i18nTextCollector.php index 96d3c17dd..87a670ea2 100644 --- a/i18n/i18nTextCollector.php +++ b/i18n/i18nTextCollector.php @@ -628,9 +628,13 @@ class i18nTextCollector_Writer_RailsYaml implements i18nTextCollector_Writer { } // Write YAML + $oldVersion = sfYaml::getSpecVersion(); + sfYaml::setSpecVersion('1.1'); $yamlHandler = new sfYaml(); // TODO Dumper can't handle YAML comments, so the context information is currently discarded - return $yamlHandler->dump(array($locale => $entitiesNested), 99); + $result = $yamlHandler->dump(array($locale => $entitiesNested), 99); + sfYaml::setSpecVersion($oldVersion); + return $result; } } diff --git a/tests/i18n/i18nTextCollectorTest.php b/tests/i18n/i18nTextCollectorTest.php index 7ecc8381e..65f0a51b8 100644 --- a/tests/i18n/i18nTextCollectorTest.php +++ b/tests/i18n/i18nTextCollectorTest.php @@ -417,6 +417,9 @@ PHP; $entities = array( 'Level1.Level2.EntityName' => array('Text', 'Context'), 'Level1.OtherEntityName' => array('Other Text', 'Other Context'), + 'Level1.BoolTest' => array('True'), + 'Level1.FlagTest' => array('No'), + 'Level1.TextTest' => array('Maybe') ); $yaml = <<assertEquals($yaml, Convert::nl2os($writer->getYaml($entities, 'de')));