From ae9e2485a5a552aa2f96e9ba06a2bcade6fb05ea Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 2 Sep 2014 18:59:37 +0200 Subject: [i18n] Remove empty tags from json output --- modules/translation.inc.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'modules/translation.inc.php') diff --git a/modules/translation.inc.php b/modules/translation.inc.php index fc04fc52..d42066f3 100644 --- a/modules/translation.inc.php +++ b/modules/translation.inc.php @@ -384,10 +384,16 @@ class Page_Translation extends Page Message::addWarning('i18n-empty-tag'); continue; } + $value = trim($value); if ($tag !== 'newtag') { - $json[$lang][$tag] = $value; + if (empty($value)) { + unset($json[$lang][$tag]); + } else { + $json[$lang][$tag] = $value; + } } else { - $json[$lang][$_REQUEST['newtag']] = $value; + if (!empty($value)) // TODO: Error message if new tag's name collides with existing + $json[$lang][$_REQUEST['newtag']] = $value; } } -- cgit v1.2.3-55-g7522