3
我有一個模板,我想在其中翻譯一個字符串。Django塊變量與變量
{% blocktrans with "www.mywebsite.com" as website_name %}footer-slogan{{ website_name }}{% endblocktrans %}
我已經生成PO我的文件,在其中我翻譯的字符串如下:
msgid "footer-slogan %(website_name)s"
msgstr "This is a test %(website_name)s"
在我生成的HTML文件,我得到這個翻譯元素:
footer-slogan www.mywebsite.com
如果我從翻譯的字符串中刪除變量,它將起作用:
msgid "footer-slogan %(website_name)s"
msgstr "This is a test"
我甚至試圖刪除從源翻譯的變量,但保持變量翻譯字符串中,這個問題是一樣的:
template.html
{% blocktrans with "www.mywebsite.com" as website_name %}footer-slogan{% endblocktrans %}
django.po
msgid "footer-slogan"
msgstr "This is a test %(website_name)s"
我寧願只能夠設置變量在翻譯的字符串上。
我在翻譯的字符串上做錯了什麼?
我試過你建議什麼,它仍然沒有工作。 – Fab
@Fab,有一個'typo'錯誤。現在試試吧,讓我知道它。 –
我以前見過你的類型。即使糾正之後,它也不起作用。 – Fab