Skip to content

Commit

Permalink
fallback id if desc is null
Browse files Browse the repository at this point in the history
* when in pretty mode for yamldumper, fallback to id to allow
  people to search for translations based on id using Desc
  • Loading branch information
ibrahimab committed Nov 1, 2016
1 parent 06da85e commit 94149e0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Translation/Dumper/YamlDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ private function dumpStructureRecursively(array $structure)
$precededByMessage = false;
foreach ($structure as $k => $v) {
if ($isMessage = $v instanceof Message) {
$desc = $v->getDesc();

// fallback to id if in pretty print mode and desc is null
$desc = ($this->prettyPrint ? ($v->getDesc() ?: $v->getId()) : $v->getDesc());
$meaning = $v->getMeaning();

if (!$isFirst && (!$precededByMessage || $desc || $meaning)) {
Expand Down

0 comments on commit 94149e0

Please sign in to comment.