summaryrefslogtreecommitdiffstats
path: root/ipalib/parameter.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib/parameter.py')
-rw-r--r--ipalib/parameter.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/ipalib/parameter.py b/ipalib/parameter.py
index 55a9bc6d..93a9a693 100644
--- a/ipalib/parameter.py
+++ b/ipalib/parameter.py
@@ -23,6 +23,7 @@ Parameter system for command plugins.
from types import NoneType
from util import make_repr
+from request import ugettext
from plugable import ReadOnly, lock, check_name
from constants import NULLS, TYPE_ERROR, CALLABLE_ERROR
@@ -199,6 +200,7 @@ class Param(ReadOnly):
kwargs = (
('cli_name', str, None),
+ ('label', callable, None),
('doc', str, ''),
('required', bool, True),
('multivalue', bool, False),
@@ -301,6 +303,14 @@ class Param(ReadOnly):
**self.__kw
)
+ def get_label(self):
+ """
+ Return translated label using `request.ugettext`.
+ """
+ if self.label is None:
+ return self.cli_name.decode('UTF-8')
+ return self.label(ugettext)
+
def normalize(self, value):
"""
Normalize ``value`` using normalizer callback.