[B] web: weird display with internationalizable (Closes: #503071) stable
authorJulien Jehannet <julien.jehannet@logilab.fr>
Mon, 02 Nov 2009 16:37:19 +0100
branchstable
changeset 3790 34fdb8fb49d1
parent 3789 fb22b55f80f8
child 3791 62d6ab877694
[B] web: weird display with internationalizable (Closes: #503071)
web/formfields.py
--- a/web/formfields.py	Mon Nov 02 16:10:03 2009 +0100
+++ b/web/formfields.py	Mon Nov 02 16:37:19 2009 +0100
@@ -203,7 +203,10 @@
         else:
             vocab = form.form_field_vocabulary(self)
         if self.internationalizable:
-            vocab = [(form.req._(label), value) for label, value in vocab]
+            # the short-cirtcuit 'and' boolean operator is used here to permit
+            # a valid empty string in vocabulary without attempting to translate
+            # it by gettext (which can lead to weird strings display)
+            vocab = [(label and form.req._(label), value) for label, value in vocab]
         if self.sort:
             vocab = vocab_sort(vocab)
         return vocab