[英]How can I put link into translation label in django
My issue is, how can I translate label, where is link, inside the label. 我的问题是,如何翻译标签,标签内的链接在哪里。 I am trying but I get only translate for
msgid
not for msgid
. 我正在尝试,但是我只翻译
msgid
而不翻译msgid
。
site.html site.html
<label for="id_data_protection" class="checkbox">
{% blocktrans %}Lorem <a href="/en/policy" target="_blank">Lorem ipsum</a> lorem ipsum test test {% endblocktrans %}
</label>
django.po file django.po文件
#: templates/pages/templates/contact.html:72
msgid ""
"Text <a href=\"/de/datenschutz\" target=\"_blank\">Text</a> "
"TextTextTextTextText"
msgstr ""
"Text <a href=\"/en/policy\" target=\"_blank\">Text Text</a> Text "
"TextTextText TextText"
Block trans allows us to say which part should be translated and which need not be. Block trans允许我们说出应翻译的部分,而不必翻译的部分。
In your case here is a rough attempt (Untested) 在您的情况下,这是一个粗略的尝试(未经测试)
{% blocktrans with link="/en/policy" target="_blank" %}
Lorem <a href="{{ link }}" target="{{ target }}">Lorem ipsum</a> lorem ipsum test test
{% endblocktrans %}
That way the translator will skip the link tags (he should) and the link location. 这样,翻译人员将跳过链接标签(他应该)和链接位置。 Does this help.
这有帮助吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.