summaryrefslogtreecommitdiffstats
path: root/modules/translation.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2014-09-02 18:59:37 +0200
committerSimon Rettberg2014-09-02 18:59:37 +0200
commitae9e2485a5a552aa2f96e9ba06a2bcade6fb05ea (patch)
tree6baae0f34312bcbcaed2f71d957db8e9ee642e08 /modules/translation.inc.php
parent[i18n] Also add submit button at the top of the edit template, so hitting ent... (diff)
downloadslx-admin-ae9e2485a5a552aa2f96e9ba06a2bcade6fb05ea.tar.gz
slx-admin-ae9e2485a5a552aa2f96e9ba06a2bcade6fb05ea.tar.xz
slx-admin-ae9e2485a5a552aa2f96e9ba06a2bcade6fb05ea.zip
[i18n] Remove empty tags from json output
Diffstat (limited to 'modules/translation.inc.php')
-rw-r--r--modules/translation.inc.php10
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;
}
}