• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python i18n._函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: render_card_actions

def render_card_actions(self, h, comp, *args):
    with h.div(class_='span2 cardactions'):
        with h.form:
            with h.ul():
                with h.li(class_="buttonAddChecklist"):
                    h << self.checklists.render(h, 'button')
                with h.li(class_="buttonAddFile"):
                    h << self.gallery.render(h, 'download')
                with h.li(class_="buttonVote"):
                    h << self.votes.render(h.AsyncRenderer(), 'edit')
                with h.li(class_="buttonDueDate"):
                    h << self.due_date.render(h.AsyncRenderer(), 'button')
                with h.li(class_="buttonDeleteCard"):
                    if security.has_permissions('edit', self) and not self.column.is_archive:
                        action = h.a.action(lambda: comp.answer('delete')).get('onclick')
                        close_func = 'function (){%s;}' % (action)
                        h << h.button(h.i(class_='icon-remove icon-grey'),
                                      _('Delete'),
                                      class_='btn btn-small',
                                      onclick=("if (confirm(\"%(confirm_msg)s\"))"
                                               " { YAHOO.kansha.app.archiveCard(%(close_func)s, '%(id)s', '%(col_id)s', '%(archive_col_id)s'); }return false;" %
                                               dict(close_func=close_func, id=self.id, col_id=self.column.id,
                                                    archive_col_id=self.column.board.archive_column.id,
                                                    confirm_msg=_(u'This card will be deleted. Are you sure ?'))))
                if self.board.weighting_cards:
                    with h.li(class_="actionWeight"):
                        h << self._weight.on_answer(lambda v: self._weight.call(model='edit_weight' if v else None))
                h << comp.render(h, 'members')

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


示例17: render_CardsCounter_edit

def render_CardsCounter_edit(self, h, comp, *args):
    """Render the title of the associated object"""
    text = var.Var(self.text)
    with h.form(class_='title-form'):
        id_ = h.generate_id()
        h << h.input(id=id_, type='text', value=self.column.nb_max_cards or '').action(text)
        h << h.script(
            """YAHOO.util.Event.on(%s, 'keyup', function (e) {
                    var result =this.value.replace(/[^0-9]/g, '')
                    if (this.value !=result) {
                           this.value = result;
                        }
             });""" % ajax.py2js(id_)
        )
        h << h.button(_('Save'), class_='btn btn-primary btn-small').action(
            lambda: self.validate(text(), comp))
        h << ' '
        h << h.button(_('Cancel'), class_='btn btn-small').action(self.cancel, comp)
        if self.error is not None:
            with h.div(class_='nagare-error-message'):
                h << self.error
        h << h.script(
            "YAHOO.kansha.app.selectElement(%s);"
            "YAHOO.kansha.app.hideOverlay()" % ajax.py2js(id_)
        )
    return h.root
开发者ID:gpaugam,项目名称:kansha,代码行数:26,代码来源:view.py


示例18: render_profile_box_profile_view

def render_profile_box_profile_view(self, h, comp, *args):
    user = self.user

    # expert's business area
    if user.di_business_area and security.has_permissions('view_di_business_area', self):
        with h.h2:
            h << _(u"Expert's Business Area")
        with h.p:
            h << user.di_business_area or ''

    with h.div(class_='group'):
        h << h.h2(_(u'Who am I?'))
        if user.description:
            with h.p:
                h << '"%s"' % user.description

    with h.div(class_='group'):
        with h.table:
            with h.tbody:
                with h.tr:
                    with h.td:
                        h << h.h2(_(u'Skills'))
                        if user.competencies:
                            h << text_to_html_elements(h, user.competencies)
                    with h.td:
                        h << h.h2(_(u'Expertises'))
                        if user.expertises:
                            h << text_to_html_elements(h, user.expertises)
                    with h.td:
                        h << h.h2(_(u'Hobbies'))
                        if user.hobbies:
                            h << text_to_html_elements(h, user.hobbies)

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


示例19: render_comments_form

def render_comments_form(self, h, comp, *args):
    """Add a comment to the current card"""
    if security.has_permissions('comment', self):
        text = var.Var()
        with h.form:
            txt_id, buttons_id = h.generate_id(), h.generate_id()
            sub_id = h.generate_id()
            kw = {
                "id": txt_id,
                "placeholder": _("Add comment."),
                "onfocus": "YAHOO.kansha.app.show('%s', true);YAHOO.util.Dom.addClass(this, 'expanded'); " % buttons_id,
            }
            h << h.textarea(**kw).action(text)
            h.head.javascript(
                h.generate_id(),
                'YAHOO.kansha.app.addCtrlEnterHandler(%s, %s)' % (
                    ajax.py2js(txt_id), ajax.py2js(sub_id)
                )
            )
            with h.div(id=buttons_id, class_="buttons hidden"):
                h << h.input(value=_("Save"), id=sub_id, type='submit',
                             class_="btn btn-primary").action(lambda: comp.answer(text()))
                h << ' '
                h << h.input(value=_("Cancel"), type='submit',
                             class_="btn").action(lambda: comp.answer(''))

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


示例20: render_profile_box_points

def render_profile_box_points(self, h, comp, *args):
    # display a shop button if I'm looking my own profile
    if self.is_mine:
        h << component.Component(self.online_shop).render(h, model='link_box')

    with h.div(class_='point-details'):
        # finds out the points
        points_by_label = self.user.get_points_by_category()
        used_point_labels = points_by_label.keys()

        # no points?
        if len(points_by_label) == 0:
            h << h.h2(_(u'You do not have any point yet.'))
            return h.root

        # renders the available points
        h << h.h2(_(u'Available points: %d') % self.user.available_points)

        # renders the acquired points
        h << h.h2(_(u'Acquired points: %d') % self.user.acquired_points)
        labels = [l for l in get_acquired_point_categories() if l in used_point_labels]
        render_point_labels(self, h, comp, labels, points_by_label)

        # renders the spent points
        h << h.h2(_(u'Spent points: %d') % self.user.spent_points)
        labels = [l for l in get_sorted_spent_point_categories() if l in used_point_labels]
        render_point_labels(self, h, comp, labels, points_by_label)

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python i18n._L函数代码示例发布时间:2022-05-27
下一篇:
Python session.query函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap