trans tag working wrong

22 views
Skip to first unread message

TX

unread,
Oct 29, 2016, 2:32:33 AM10/29/16
to chicagoboss
Hi,

I sent below mail to erlydtl group but no one answered,
can anyone here help?

I almost finished coding my program and wanted to make multi lingual UI, originally the log in screen is as attached NoTrans.png. Then I add trans tag as:

<h3><font color="red">{% trans "Log in" %}</font></h3>
              <hr>

{% if errors %}
<ul>
{% for error in errors %}
<li><font color=red>{{ error }}</font></li>
{% endfor %}
</ul>
{% endif %}

{% if error %}
<font color=red>{{ error }}</font>
{% endif %}  
      
<label>{% trans "E-mail as username" %}
              <input type="email" name="username" required/>
          <span class="form-error">
                An valid e-mail address is required.
              </span>
</label>

 <label>{% trans "Password" %}
              <input type="password" name="password" required/>
          <span class="form-error">
              password is required!
              </span>
  </label>   
    
  <button class="button" type="submit" value="submit">{% trans "Log in" %}</button>


In my strings.zh-cn.po, I have these:

msgid "Log in"
msgstr "登录"

msgid "Password"
msgstr "密码"

msgid "E-mail as username"
msgstr "E-mail作为用户名"

msgid "Kindly note!"
msgstr "请注意!"

When visit the page, I got attached Trans.png screen. only the two "Log in" were translated, with all strings in, those
"E-mail as username" and "Password" were not translated.

This seems to be quite tricky, the msgid's in the PO file were copied and should be correct. What mistake did I make?

Thanks

NoTrans.png
Trans.png

Konstantin

unread,
Oct 31, 2016, 10:00:37 AM10/31/16
to chica...@googlegroups.com

Try to run in the erlang shell this command:

> boss_translator:reload_all(boss_web:translator_pid( %your_appname_atom% ), 'zh-cn').

--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.
Visit this group at https://groups.google.com/group/chicagoboss.
To view this discussion on the web visit https://groups.google.com/d/msgid/chicagoboss/tencent_57D60FD13661BA741DB08AE9%40qq.com.
For more options, visit https://groups.google.com/d/optout.

TX

unread,
Nov 4, 2016, 2:06:16 AM11/4/16
to chicagoboss
Hi Konstantin,

I didn't run your command as I already solved the problem. When I edit a new po file under OSX, everything works perferctly, so it is because of the encoding of vim under Windows XP.

Thank you anyway.

------------------ 原始邮件 ------------------
发件人: "Konstantin";<k.n.go...@gmail.com>;
发送时间: 2016年10月31日(星期一) 晚上10:00
收件人: "chicagoboss"<chica...@googlegroups.com>;
主题: Re: [chicagoboss] trans tag working wrong
Reply all
Reply to author
Forward
0 new messages