mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #3994 from tractorcow/pulls/4.0/fix-translations
BUG Fix yaml generation to conform to version 1.1, accepted by transifex
This commit is contained in:
commit
a1d39780d8
@ -632,9 +632,13 @@ class i18nTextCollector_Writer_RailsYaml implements i18nTextCollector_Writer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write YAML
|
// Write YAML
|
||||||
|
$oldVersion = sfYaml::getSpecVersion();
|
||||||
|
sfYaml::setSpecVersion('1.1');
|
||||||
$yamlHandler = new sfYaml();
|
$yamlHandler = new sfYaml();
|
||||||
// TODO Dumper can't handle YAML comments, so the context information is currently discarded
|
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,6 +417,9 @@ PHP;
|
|||||||
$entities = array(
|
$entities = array(
|
||||||
'Level1.Level2.EntityName' => array('Text', 'Context'),
|
'Level1.Level2.EntityName' => array('Text', 'Context'),
|
||||||
'Level1.OtherEntityName' => array('Other Text', 'Other Context'),
|
'Level1.OtherEntityName' => array('Other Text', 'Other Context'),
|
||||||
|
'Level1.BoolTest' => array('True'),
|
||||||
|
'Level1.FlagTest' => array('No'),
|
||||||
|
'Level1.TextTest' => array('Maybe')
|
||||||
);
|
);
|
||||||
$yaml = <<<YAML
|
$yaml = <<<YAML
|
||||||
de:
|
de:
|
||||||
@ -424,6 +427,9 @@ de:
|
|||||||
Level2:
|
Level2:
|
||||||
EntityName: Text
|
EntityName: Text
|
||||||
OtherEntityName: 'Other Text'
|
OtherEntityName: 'Other Text'
|
||||||
|
BoolTest: 'True'
|
||||||
|
FlagTest: 'No'
|
||||||
|
TextTest: Maybe
|
||||||
|
|
||||||
YAML;
|
YAML;
|
||||||
$this->assertEquals($yaml, Convert::nl2os($writer->getYaml($entities, 'de')));
|
$this->assertEquals($yaml, Convert::nl2os($writer->getYaml($entities, 'de')));
|
||||||
|
Loading…
Reference in New Issue
Block a user