From 2047b393091d03d44cbec7e657b14e1b6c106649 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Mon, 13 Jan 2014 14:37:16 +0100 Subject: [PATCH] identities: for fields using a ChoiceWidget translate the options --- authentic/identities.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/authentic/identities.py b/authentic/identities.py index cf36ee7..7388cc3 100644 --- a/authentic/identities.py +++ b/authentic/identities.py @@ -217,6 +217,16 @@ class Field: value = keywords.pop('value', None) if identity: value = getattr(identity, self.key, value) + if 'options' in keywords: + # translate caption + new_options = [] + for p in keywords['options']: + if isinstance(p, (list, tuple)): + p = (p[0], _(p[1])) + else: + p = _(p) + new_options.append(p) + keywords['options'] = new_options if not self.read_only or admin: if self.multivalued: keywords['render_br'] = False