Skip to content

Commit 94149e0

Browse files
committed
fallback id if desc is null
* when in pretty mode for yamldumper, fallback to id to allow people to search for translations based on id using Desc
1 parent 06da85e commit 94149e0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Translation/Dumper/YamlDumper.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ private function dumpStructureRecursively(array $structure)
5858
$precededByMessage = false;
5959
foreach ($structure as $k => $v) {
6060
if ($isMessage = $v instanceof Message) {
61-
$desc = $v->getDesc();
61+
62+
// fallback to id if in pretty print mode and desc is null
63+
$desc = ($this->prettyPrint ? ($v->getDesc() ?: $v->getId()) : $v->getDesc());
6264
$meaning = $v->getMeaning();
6365

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

0 commit comments

Comments
 (0)