Beispiel #1
0
 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)
         )
Beispiel #2
0
 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)
         )
Beispiel #3
0
 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
Beispiel #4
0
 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
Beispiel #5
0
 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
         )
Beispiel #6
0
 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
         )
Beispiel #7
0
# 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
Beispiel #8
0
# 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
Beispiel #9
0
 def description (self) :
     age = self.age
     return "%s %s %s" % (self.desc, age, _Tn ("year", "years", age))