当前位置: 首页>>代码示例>>Python>>正文


Python i18n._函数代码示例

本文整理汇总了Python中nagare.i18n._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: render_Kansha_resync

def render_Kansha_resync(self, h, comp, model):
    with h.div(id="resync", style='display:none'):
        h << h.h2(_(u'Synchronization error'), class_='title')
        with h.div(class_='content'):
            link = h.a(_(u'click here to resync'), id='resync-action').action(self.initialization)
            h << h.p(_(u'Your board is out of sync, please '), link, '.')
    return h.root
开发者ID:ygravrand,项目名称:kansha,代码行数:7,代码来源:view.py

示例2: render_ideas_by_fi_list

def render_ideas_by_fi_list(self, h, comp, *args):
    ideas_count_by_fi = self.get_ideas_count_by_fi()
    with h.table(class_='phantom'):
        with h.thead:
            with h.tr:
                h << h.th(_(u'Facilitator'))
                h << h.th(_(u'Ideas count'))
                h << h.th(_(u'To process'))

        with h.tfoot:
            total_ideas = sum(map(operator.itemgetter(2), ideas_count_by_fi))
            total_ideas_to_review = sum(
                map(operator.itemgetter(3), ideas_count_by_fi))
            with h.tr(class_='totals'):
                h << h.th(_(u"Totals"), class_='label')
                h << h.td(str(total_ideas), class_='value')
                h << h.td(str(total_ideas_to_review), class_='value')

        with h.tbody:
            days = 15
            latecomer_fi = self.get_latecomer_fi(days)
            for uid, fullname, ideas, ideas_to_review in ideas_count_by_fi:
                with h.tr(class_='highlight' if uid in latecomer_fi else ''):
                    h << h.td(h.a(fullname).action(
                        lambda user_uid=uid: event_management._emit_signal(
                            self, "VIEW_FI_IDEA_SELECTOR",
                            user_uid=user_uid)), class_='label')
                    h << h.td(str(ideas), class_='value')
                    h << h.td(str(ideas_to_review), class_='value')

    h << h.p(_(u'In red, facilitators that have ideas '
               u'to process older than %d days.') % days,
             class_='legend')

    return h.root
开发者ID:droodle,项目名称:eureka-opensource,代码行数:35,代码来源:dashboard.py

示例3: commit

    def commit(self, application_url):
        """ Commit method

        If email changes, send confirmation mail to user
        If password changes, check passwords rules
        """
        if not self.is_validated(self.fields):
            return
        # Test if email_to_confirm has changed
        if (self.target.email_to_confirm != self.email_to_confirm() and
                self.target.email != self.email_to_confirm()):
            # Change target email_to_confirm (need it to send mail)
            self.target.email_to_confirm = self.email_to_confirm()
            confirmation = self._create_email_confirmation(application_url)
            confirmation.send_email(self.mail_sender)
            self.email_to_confirm.info = _(
                'A confirmation email has been sent.')
        # Test if password has changed
        if (len(self.password()) > 0 and
                not(self.old_password.error) and
                not(self.password_repeat.error)):
            user = security.get_user()
            user.data.change_password(self.password())
            user.update_password(self.password())
            self.password_repeat.info = _('The password has been changed')
        super(BasicUserForm, self).commit(self.fields)
开发者ID:daamien,项目名称:kansha,代码行数:26,代码来源:user_profile.py

示例4: render_article_list_item

def render_article_list_item(self, h, comp, *args):
    limit = 500
    date = format_datetime(self.article.creation_date, format='short')

    if len(self.article.content) > limit:
        if self.display_full_description():
            content = html(h, self.article.content)
        else:
            content = html(h, self.article.content, limit)

        display_more = True
    else:
        content = html(h, self.article.content)
        display_more = False

    with h.li:
        with h.h1:
            h << h.a(self.article.title, href=self.url)
        h << h.span(self.article.topic.label or '', class_='thematic')
        h << h.span(date, class_='date')

        with h.div:
            h << content

        if display_more and not self.display_full_description():
            h << h.a(_(u'Read more'), class_='more').action(lambda: self.display_full_description(True))
        elif display_more and self.display_full_description():
            h << h.a(_(u'Read less'), class_='more').action(lambda: self.display_full_description(False))

    return h.root
开发者ID:droodle,项目名称:eureka-opensource,代码行数:30,代码来源:article.py

示例5: render

def render(self, h, comp, *args):
    """Render description component in edit mode"""
    text = var.Var(self.text)
    with h.div(class_="description"):
        with h.form(class_='description-form'):
            txt_id, btn_id, buttons_id = h.generate_id(
            ), h.generate_id(), h.generate_id()
            h << h.textarea(text(), id_=txt_id, placeholder=_("Add description."),
                            onfocus="YAHOO.kansha.app.show('%s', true);" % buttons_id,
                            class_="expanded", style="resize:none").action(text)
            with h.div(id=buttons_id, class_="hidden"):
                h << h.button(_('Save'), class_='btn btn-primary btn-small',
                              id=btn_id).action(lambda: comp.answer(text()))
                h << ' '
                h << h.button(
                    _('Cancel'), class_='btn btn-small').action(comp.answer)

            h.head.javascript(h.generate_id(), 'YAHOO.kansha.app.addCtrlEnterHandler(%r, %r)' % (txt_id, btn_id))
            h.head.javascript(
                h.generate_id(), 'YAHOO.kansha.app.autoHeight(%r)' % (txt_id))

        # Put the focus on the text area
        h << h.script("""document.getElementById('%s').focus()""" %
                      txt_id, type="text/javascript", language="javascript")

    return h.root
开发者ID:ygravrand,项目名称:kansha,代码行数:26,代码来源:view.py

示例6: init_app__new_mail

def init_app__new_mail(self, url, comp, http_method, request):
    username, token = (url[1], url[2])
    get_user = lambda: UserManager.get_by_username(username)
    confirmation = self._services(
        forms.EmailConfirmation,
        self.app_title,
        self.app_banner,
        self.custom_css,
        get_user
    )
    if confirmation.confirm_email_address(token):
        log.debug(_('Change email success for user %s') % get_user().username)
        comp.becomes(self._services(
            forms.ChangeEmailConfirmation,
            self.app_title,
            self.app_banner,
            self.custom_css,
            request.application_url
        ),
            model='success'
        )
        confirmation.reset_token(token)
    else:
        log.debug(_('Change email failure for user %s') % get_user().username)
        comp.becomes(
            self._services(
                forms.ChangeEmailConfirmation,
                self.app_title,
                self.app_banner,
                self.custom_css,
                request.application_url
            ),
            model='failure'
        )
开发者ID:droodle,项目名称:kansha,代码行数:34,代码来源:urls.py

示例7: render_SaveTemplateEditor_saved

def render_SaveTemplateEditor_saved(self, h, comp, *args):
    with h.div(class_='success'):
        h << h.i(class_='icon-checkmark')
        h << _(u'Template saved!')
        with h.div(class_='buttons'):
            h << h.SyncRenderer().a(_(u'OK'), class_='btn btn-primary').action(comp.answer)
    return h.root
开发者ID:Net-ng,项目名称:kansha,代码行数:7,代码来源:templates.py

示例8: get_2weeks_chart

    def get_2weeks_chart(self, width, height):
        start_date = datetime.today().date() - timedelta(days=14)

        ideas = {}
        for item in self.get_ideas_count_day_by_day(start_date):
            ideas[item.formatted_date] = item.count

        connections = {}
        for item in self.get_connection_count_day_by_day(start_date):
            connections[item.formatted_date] = item.count

        labels = [
            format_date(start_date + timedelta(days=days), format="short")
            for days in range(0, 14)]

        data = [(ideas.get(item, 0), connections.get(item, 0))
                for item in labels]

        legend_labels = [_(u'Ideas count'), _(u'Connections count')]
        chart = DoubleHorizontalLineChart(labels, zip(*data),
                                          width=width, height=height,
                                          legend=True,
                                          legendlabels=legend_labels)

        return chart.get_png()
开发者ID:ephilippot,项目名称:eureka-opensource,代码行数:25,代码来源:comp.py

示例9: get_2months_chart

    def get_2months_chart(self, width, height):
        today = datetime.today().date()
        start_date = today - timedelta(days=today.weekday(), weeks=7)

        ideas = {}
        for item in self.get_ideas_count_day_by_day(start_date):
            week_number = item.date.isocalendar()[1]
            ideas.setdefault(week_number, 0)
            ideas[week_number] += item.count

        connections = {}
        for item in self.get_connection_count_day_by_day(start_date):
            week_number = item.date.isocalendar()[1]
            connections.setdefault(week_number, 0)
            connections[week_number] += item.count

        # last 2 months labels
        week_numbers = [(start_date + timedelta(weeks=n)).isocalendar()[1]
                        for n in range(0, 8)]

        data = [(ideas.get(item, 0), connections.get(item, 0))
                for item in week_numbers]

        labels = [u'%s %s' % (_(u'week'), n) for n in week_numbers]
        legend_labels = [_(u'Ideas count'), _(u'Connections count')]
        chart = DoubleHorizontalLineChart(labels, zip(*data),
                                          width=width, height=height,
                                          legend=True,
                                          legendlabels=legend_labels)

        return chart.get_png()
开发者ID:ephilippot,项目名称:eureka-opensource,代码行数:31,代码来源:comp.py

示例10: render_Board_item

def render_Board_item(self, h, comp, *args):
    def answer():
        comp.answer(self.data.id)

    url = self.data.url
    with h.li(class_="row-fluid"):
        with h.a(self.data.title, href=url, class_="boardItemLabel").action(answer):
            if self.data.description:
                h << {'data-tooltip': self.data.description}
        h << {'onmouseover': """YAHOO.kansha.app.highlight(this, 'members', false);
                                YAHOO.kansha.app.highlight(this, 'archive', false);
                                YAHOO.kansha.app.highlight(this, 'leave', false);""",
              'onmouseout': """YAHOO.kansha.app.highlight(this, 'members', true);
                               YAHOO.kansha.app.highlight(this, 'archive', true);
                               YAHOO.kansha.app.highlight(this, 'leave', true);"""}

        h << self.comp_members.render(h.AsyncRenderer(), 'members')

        if security.has_permissions('manage', self):
            h << h.a(class_='archive', title=_(u'Archive this board')).action(self.archive_board)
        else:
            h << h.a(class_='leave',
                     title=_(u'Leave this board'),
                     onclick='return confirm("%s")' % _("You won't be able to access this board anymore. Are you sure you want to leave it anyway?")
                     ).action(self.leave)
    return h.root
开发者ID:droodle,项目名称:kansha,代码行数:26,代码来源:view.py

示例11: render_BoardDescription

def render_BoardDescription(self, h, comp, *args):
    """Render description component in edit mode"""
    text = var.Var(self.text)
    with h.form(class_='description-form'):
        txt_id, btn_id = h.generate_id(), h.generate_id()
        h << h.label(_(u'Description'), for_=txt_id)
        ta = h.textarea(text(), id_=txt_id).action(text)
        if not security.has_permissions('edit', self):
            ta(disabled='disabled')
        h << ta
        with h.div:
            if security.has_permissions('edit', self):
                h << h.button(_('Save'), class_='btn btn-primary btn-small',
                              id=btn_id).action(remote.Action(lambda: self.change_text(text())))
                h << ' '
                h << h.button(
                    _('Cancel'), class_='btn btn-small').action(remote.Action(lambda: self.change_text(None)))

        h.head.javascript(
            h.generate_id(),
            'YAHOO.kansha.app.addCtrlEnterHandler(%s, %s)' % (
                ajax.py2js(txt_id), ajax.py2js(btn_id)
            )
        )

    return h.root
开发者ID:droodle,项目名称:kansha,代码行数:26,代码来源:view.py

示例12: render_idea_basket_dsig

def render_idea_basket_dsig(self, h, comp, *args):
    labels = dict(default_states_labels())
    with h.div(class_="state_selector rounded"):
        sorted_ideas = self.get_sorted_ideas()

        if len(sorted_ideas) == 0:
            h << _(u'No idea in basket')
        else:
            with h.ul(class_="ideaBoard"):
                for state, nb in sorted_ideas:
                    label = labels.get(state, None)
                    if label:
                        with h.li(class_='ideas-list'):
                            if self.state_id == state:
                                h << h.a(
                                    '[-] ', label % nb, class_="selected_link"
                                ).action(lambda: event_management._emit_signal(self, "HIDE_IDEAS"))
                                with h.table:
                                    with h.tbody:
                                        with h.tr(class_='filter'):
                                            h << h.td
                                            h << h.td(_('Comments'))
                                            h << h.td(_('Votes'))
                                h << self.pager
                            else:
                                h << h.a(
                                    '[+] ', label % nb
                                ).action(lambda v=state: event_management._emit_signal(self, "VIEW_DSIG_IDEAS", state=v))

    return h.root
开发者ID:droodle,项目名称:eureka-opensource,代码行数:30,代码来源:basket.py

示例13: render

def render(p, r, comp, *args):
    # finds out the currently selected page index and the total page count
    current = p.get_current_page()
    page_count = p.find_page_count()

    if page_count <= 1:
        return r.root

    # finds out the items that are not ellipsizable
    unellipsizable = set(xrange(current - p.radius, current + p.radius + 1))
    unellipsizable.add(0)
    unellipsizable.add(page_count - 1)

    with r.ul(class_='pager'):
        # renders the 'previous' link
        render_page_item(r, _(u'Previous'), current - 1,
                         'disabled' if current == 0 else 'unselected', p)

        last_was_ellipsized = False

        for i in xrange(page_count):
            if i in unellipsizable:
                type = 'selected' if i == current else 'unselected'
                render_page_item(r, unicode(1 + i), i, type, p)
            elif not last_was_ellipsized:
                render_page_item(r, u'\N{HORIZONTAL ELLIPSIS}', None, 'disabled', p)
                last_was_ellipsized = True

        # renders the 'next' link
        render_page_item(r, _(u'Next'), current + 1,
                         'disabled' if current >= page_count - 1
                         else 'unselected', p)

    return r.root
开发者ID:droodle,项目名称:eureka-opensource,代码行数:34,代码来源:pager.py

示例14: render_comment

def render_comment(self, h, comp, model, *args):
    with h.div(class_='comment'):
        with h.div(class_='left'):
            h << self.author.render(h, model='avatar')
        with h.div(class_='right'):
            h << self.author.render(h, model='fullname')
            h << ' ' << _('wrote') << ' '
            h << h.span(
                _(u'on'), ' ',
                format_datetime(self.creation_date),
                class_="date")
            if security.has_permissions('delete_comment', self):
                onclick = (
                    u"if (confirm(%(message)s)){%(action)s;}return false" %
                    {
                        'action': h.a.action(
                            comp.answer, comp
                        ).get('onclick'),
                        'message': ajax.py2js(
                            _(u'Your comment will be deleted. Are you sure?')
                        ).decode('UTF-8')
                    }
                )
                h << h.a(h.i(class_='icon-cross'), title=_('Delete'),
                         class_="comment-delete", onclick=onclick, href='')
            h << self.comment_label.render(h.AsyncRenderer())
    return h.root
开发者ID:Net-ng,项目名称:kansha,代码行数:27,代码来源:view.py

示例15: write

    def write(self):
        sty = ''
        header_sty = xlwt.easyxf(sty + 'font: bold on; align: wrap on, vert centre, horiz center;')
        sty = xlwt.easyxf(sty)
        ws = self.workbook.add_sheet(self.sheet_name)

        titles = [_(u'Column'), _(u'Title')] + self.extension_titles
        for col, title in enumerate(titles):
            ws.write(0, col, title, style=header_sty)

        row = 1
        for column in self.board.columns:
            column = column()
            colname = _('Archived cards') if column.is_archive else column.get_title()
            for card in column.cards:
                card = card()
                ws.write(row, 0, colname, sty)
                ws.write(row, 1, card.get_title(), sty)
                card_extensions = dict(card.extensions)
                for col, key in enumerate(self.extensions, 2):
                    ext = card_extensions[key]()
                    write_extension_data(ext, ws, row, col, sty)
                row += 1
        for col in xrange(len(titles)):
            ws.col(col).width = 0x3000
        ws.set_panes_frozen(True)
        ws.set_horz_split_pos(1)
开发者ID:Net-ng,项目名称:kansha,代码行数:27,代码来源:excel_export.py


注:本文中的nagare.i18n._函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。