support.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Hawkeye 作者: tozhengxq 项目源码 文件源码
def __init__(self, fp=None):
        """Initialize a simple translations class which is not backed by a
        real catalog. Behaves similar to gettext.NullTranslations but also
        offers Babel's on *gettext methods (e.g. 'dgettext()').

        :param fp: a file-like object (ignored in this class)
        """
        # These attributes are set by gettext.NullTranslations when a catalog
        # is parsed (fp != None). Ensure that they are always present because
        # some *gettext methods (including '.gettext()') rely on the attributes.
        self._catalog = {}
        self.plural = lambda n: int(n != 1)
        super(NullTranslations, self).__init__(fp=fp)
        self.files = filter(None, [getattr(fp, 'name', None)])
        self.domain = self.DEFAULT_DOMAIN
        self._domains = {}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号