def head (self) : n = len (self.needed) return \ ( _Tn ( "%s needs the attribute: %s" , "%s needs the attributes: %s" , n ) % (_T (self.e_type.ui_name), self.needed) )
def _error_as_json_cargo__Required_Missing(self, error): result = self._error_as_json_cargo__Error(error) missing = self.attr_name_replacer(", ".join(error.missing)) n = len(error.missing) result.update \ ( head = _Tn ( "%s needs the attribute: %s" , "%s needs the attributes: %s" , n ) % (_T (self.entity.label), missing) , description = _Tn ( "Please enter a value for the missing attribute" , "Please enter values for the missing attributes" , n ) ) result.pop("explanation", None) return result
def _error_as_json_cargo__Required_Missing (self, error) : result = self._error_as_json_cargo__Error (error) missing = self.attr_name_replacer (", ".join (error.missing)) n = len (error.missing) result.update \ ( head = _Tn ( "%s needs the attribute: %s" , "%s needs the attributes: %s" , n ) % (_T (self.entity.label), missing) , description = _Tn ( "Please enter a value for the missing attribute" , "Please enter values for the missing attributes" , n ) ) result.pop ("explanation", None) return result
def _m_create_link_ref_attr(cls, role, role_type, plural): name = cls._m_link_ref_attr_name(role, plural) Attr_Type = MOM.Attr.A_Link_Ref_List if plural else MOM.Attr.A_Link_Ref return cls._m_create_rev_ref_attr \ ( Attr_Type, name, role, role_type, cls , assoc = cls ### XXX remove after auto_cache_roles are removed , description = ( _Tn ( "`%s` link", "`%s` links", 7 if plural else 1) % (_T (cls.ui_name), ) ) , hidden = cls.rev_ref_attr_hidden or (plural and role.max_links == 1) , hidden_nested = 1 )
def _m_create_link_ref_attr (cls, role, role_type, plural) : name = cls._m_link_ref_attr_name (role, plural) Attr_Type = MOM.Attr.A_Link_Ref_List if plural else MOM.Attr.A_Link_Ref return cls._m_create_rev_ref_attr \ ( Attr_Type, name, role, role_type, cls , assoc = cls ### XXX remove after auto_cache_roles are removed , description = ( _Tn ( "`%s` link", "`%s` links", 7 if plural else 1) % (_T (cls.ui_name), ) ) , hidden = cls.rev_ref_attr_hidden or (plural and role.max_links == 1) , hidden_nested = 1 )
# Revision Dates # 15-Apr-2010 (MG) Creation # 10-Oct-2016 (CT) Make Python-3 compatible # ««revision-date»»··· #-- from __future__ import absolute_import from __future__ import division from __future__ import print_function from _TFL.I18N import _, _T, _Tn, Translations, Config import os _("Just markup") print(_T("Markup and translation")) print(_Tn("Singular", "Plural", 2)) path = os.path.join(os.path.dirname(__file__), "-I18N", "de.mo") Config.current = Translations(open(path), "messages") print("_T tests") print(_T("Just markup")) print(_T("Markup and translation")) print(_T("Singular")) print(_T("Plural")) print("_Tn tests") print(_Tn("Singular", "Plural", 0)) print(_Tn("Singular", "Plural", 1)) print(_Tn("Singular", "Plural", 2)) ### __END__ TFL.Babel._Test
# Revision Dates # 15-Apr-2010 (MG) Creation # 10-Oct-2016 (CT) Make Python-3 compatible # ««revision-date»»··· # -- from __future__ import absolute_import from __future__ import division from __future__ import print_function from _TFL.I18N import _, _T, _Tn, Translations, Config import os _("Just markup") print(_T("Markup and translation")) print(_Tn("Singular", "Plural", 2)) path = os.path.join(os.path.dirname(__file__), "-I18N", "de.mo") Config.current = Translations(open(path), "messages") print("_T tests") print(_T("Just markup")) print(_T("Markup and translation")) print(_T("Singular")) print(_T("Plural")) print("_Tn tests") print(_Tn("Singular", "Plural", 0)) print(_Tn("Singular", "Plural", 1)) print(_Tn("Singular", "Plural", 2)) ### __END__ TFL.Babel._Test
def description (self) : age = self.age return "%s %s %s" % (self.desc, age, _Tn ("year", "years", age))