コード例 #1
0
ファイル: __init__.py プロジェクト: guoyu07/tower-2
def ugettext(message, context=None):
    """Always return a stripped string, localized if possible"""
    stripped = strip_whitespace(message)

    message = add_context(context, stripped) if context else stripped

    ret = django_ugettext(message)

    # If the context isn't found, we need to return the string without it
    return stripped if ret == message else ret
コード例 #2
0
ファイル: __init__.py プロジェクト: thijstriemstra/tower
def ugettext(message, context=None):
    """Always return a stripped string, localized if possible"""
    stripped = strip_whitespace(message)

    message = add_context(context, stripped) if context else stripped

    ret = django_ugettext(message)

    # If the context isn't found, we need to return the string without it
    return stripped if ret == message else ret
コード例 #3
0
ファイル: markup.py プロジェクト: wkoha/edx-platform
def ugettext(text):
    """Translate a string, and escape it as plain text.

    Use like this in Mako::

        <% from util.markup import ugettext as _ %>
        <p>${_("Hello, world!")}</p>

    Or with formatting::

        <% from util.markup import HTML, ugettext as _ %>
        ${_("Write & send {start}email{end}").format(
            start=HTML("<a href='mailto:[email protected]'>"),
            end=HTML("</a>"),
           )}

    """
    return markupsafe.escape(django_ugettext(text))
コード例 #4
0
ファイル: translation.py プロジェクト: subc/anchovy
def ugettext(message):
    return smart_unicode(django_ugettext(message))
コード例 #5
0
def ugettext(message):
    return smart_unicode(django_ugettext(message))