还有个关于i18n的问题

似乎写在base里的正常,但是写在post.jade还有mixins.jade里的都不起作用

·```

extends base

+i18n('Newer', '新一篇', 'zh_cn')

+i18n('Older', '旧一篇', 'zh_cn')

+i18n('Already First', '已是第一篇', 'zh_cn')

+i18n('No More', '已是最后一篇', 'zh_cn')

block title

       post.title

 

 

block content

       .post.detail-post

              h2.title= post.title

              .info

                     i.fa.fa-calendar  

                     time.date= post.date.format('%Y.%m.%d')+' '

                     |

                     span.visitors

                            i.fa.fa-book  

                            |{{post.visits}} |

 

                     if post.category.parents

                            category_path = post.category.parents[-1].title

                     else

                            category_path = post.category.title

                     span.category

                            i.fa.fa-list  

                            a(href="/category/{{category_path}}")= category_path

                            |

                     span.tags-source

                            if post.tags

                                   span.tags

                                          i.fa.fa-tags  

                                          for tag in post.tags

                                                 a(href="/tag/{{tag}}")= tag

                                           |

                     a(class="source",target="_blank",style="cursor:pointer;",onmouseover="javascript:this.href=window.location.href.split('#')[0]+'?action=show_raw'")= '源码' if lang=='zh_cn' else 'Source'

                            if request.is_admin == 1

                                   a(class="edit",href="?action=edit",target="_blank")= '编辑' if lang=='zh_cn' else 'Edit'

              .post_body= post.content

 

              .other_posts.pager

                     pre_one = get_connected_one(post, position='<')

                     next_one = get_connected_one(post, position='>')

                     if pre_one

                            a(href=pre_one.url, title=pre_one.title, class='pre')=_('Newer')

                     else

                            span.pre.unavailable= 'Already First'

                     if next_one

                            a(href=next_one.url, title=next_one.title, class='next')=_('Older')

                     elif pre_one

                            span.next.unavailable=_('No More')

 

              include include.comments

2017-07-01 21:12 from X X
Comments
Write a Comment
  • Hepo reply

    @X X, 网站地址? 具体页面的 URL ?

  • @Hepo https://ted423.bitcron.com/

    就是下方仍然是Already First,文章里面也都是

  • Hepo reply

    @XX

    在多个 block (extends后)组成的 template 中,在 block 之间的代码是不生效的。

    extends xxx

    block x

    working

    not-working

    block y

    working

    :)

  • Hepo reply

    @XX 评论没有缩进,抱歉, working 是有缩进的, not-working 这段没有缩进。

  • @Hepo 能用我的那个post.jade给个例子么?我感觉写在哪都没用

    https://github.com/ted423/Bitcron-Ink-modify

  • Hepo reply

    @XX 不是 i18n 的问题, get_connected_one 这个函数在 Bitcron 中不存在,返回的结果为 None

    使用 posts.next_one or posts.previous_one 代替或者自己另外获取 https://api.bitcron.com/read/posts#toc_24

    :)

    • @Hepo post里的是搞定了

      mixins.jade里的呢?

      mixin make_paginator()

      if pager.has_pre or pager.has_next

      div.clear

      .pager

      +i18n('Pre Page', '上一页', 'zh_cn')

      +i18n('Next Page', '下一页', 'zh_cn')

      +i18n('Already First', '已是第一页', 'zh_cn')

      +i18n('Already Last', '已是最后一页', 'zh_cn')

      if pager.has_pre

      a.pre(href=pager.pre_page_url)='Pre Page'

      else

      span.pre.unavailable='Already First'

      if pager.has_next

      a.next(href=pager.next_page_url)='Next Page'

      else

      span.next.unavailable='Already Last'

      mixin make_posts_list(_posts=None)

      if _posts

      posts = _posts

      .posts

      for post in posts

      .post

      h2.title

      a(href=post.url, title=post.title)= post.title

      .info

      i.fa.fa-calendar &nbsp;

      span.date= post.date.format('%Y.%m.%d')+' '

      |

      span.visitors

      i.fa.fa-book &nbsp;

      | {{post.visits}}&nbsp;|

      path_parts = post.path.split('/')

      if post.category.parents

      category_path = post.category.parents[-1].title

      else

      category_pat

    • @Hepo https://github.com/ted423/Bitcron-Ink-modify/blob/master/template/mixins.jade

  • X X reply

    ted423.bitcron.com

    <https://github.com/ted423/Bitcron-Ink-modify/blob/master/template/mixins.jade>

    [](https://github.com/ted423/Bitcron-Ink-modify/blob/master/template/mixins.jade)

    [ted423/Bitcron-Ink-modify](https://github.com/ted423/Bitcron-Ink-modify/blob/master/template/mixins.jade)

    github.com

    Bitcron-Ink-modify - https://ted423.bitcron.com

    发送自 [Outlook](http://aka.ms/weboutlook)

    - - - - - - - - - - -

    **发件人:** pi@bitcron.com <pi+98f232b436744d0ab196044d95271f57feaa3e19@bitcron.com>

    **发送时间:** 2017年7月4日 15:47

    **收件人:** priston910423@gmail.com

    **主题:** New Comment

    New Comment

    Hey,

    **Hepo** Said on [还有个关于i18n的问题](https://pi.bitcron.com/post/wen-da/2017-07/2017-07-01-21-12-56)

    @XX 不是 i18n 的问题, get\_connected\_one 这个函数在 Bitcron 中不存在,返回的结果为 None 使用 posts.next\_one or posts.previous\_one 代替或者自己另外获取 https://api.bitcron.com/read/posts#toc\_24 :)

    [>visit and reply comment](https://pi.bitcron.com/post/wen-da/2017-07/2017-07-01-21-12-56)

    - - - - - - - - - - -

    simple is everything, we try our best to make the Tech meet the needs of our lives.