diff options
author | Simon Rettberg | 2014-09-02 18:59:37 +0200 |
---|---|---|
committer | Simon Rettberg | 2014-09-02 18:59:37 +0200 |
commit | ae9e2485a5a552aa2f96e9ba06a2bcade6fb05ea (patch) | |
tree | 6baae0f34312bcbcaed2f71d957db8e9ee642e08 /modules | |
parent | [i18n] Also add submit button at the top of the edit template, so hitting ent... (diff) | |
download | slx-admin-ae9e2485a5a552aa2f96e9ba06a2bcade6fb05ea.tar.gz slx-admin-ae9e2485a5a552aa2f96e9ba06a2bcade6fb05ea.tar.xz slx-admin-ae9e2485a5a552aa2f96e9ba06a2bcade6fb05ea.zip |
[i18n] Remove empty tags from json output
Diffstat (limited to 'modules')
-rw-r--r-- | modules/translation.inc.php | 10 |
1 files changed, 8 insertions, 2 deletions
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; } } |