how to deal with not translated strings in html

26 views
Skip to first unread message

Jaap van Wingerde

unread,
Mar 3, 2015, 12:43:08 PM3/3/15
to django...@googlegroups.com
../locale/en/LC_MESSAGES/django.po:

...
#: template.html:4
msgid "jaar"
msgstr "year"

#: templates.html:4
msgid "maand"
msgstr ""
...

../templates/template.html:

{% load i18n %}<!DOCTYPE html><html
lang="{{ LANGUAGE_CODE }}">
...
{% trans "jaar" %}<br />{% trans "maand" %}
...

resulting html:

<!DOCTYPE html><html
lang="en">
...
year<br />maand
...

better html:

<!DOCTYPE html><html
lang="en">
...
year<br /><span lang="nl">maand</span>
...

How can i get the better html?

--

Jaap van Wingerde
e-mail: 12345...@vanwingerde.nl

Jaap van Wingerde

unread,
Mar 4, 2015, 9:53:38 AM3/4/15
to django...@googlegroups.com
Op 2015-03-03T17:41:21 UTC schreef Jaap van Wingerde
<mailin...@vanwingerde.nl> in the message <how to deal with not
translated strings in html>,
mid:20150303174...@jaap.custard.shrl.nl the following text.
A solution with handwork:

#: templates.html:4
msgid "maand"
msgstr "<span lang="nl">maand</span>"

Can this be done automagical?

Ilya Kazakevich

unread,
Mar 6, 2015, 1:44:00 PM3/6/15
to django...@googlegroups.com
What is the point of NOT translating "month" to English? 
There are several solutions:

1) Create custom templates / custom tags and include them based on language. For example you may have "foo.nl.html" and "foo.en.html" and include "foo.<your_lang>.html". But I believe using different HTMLs for different language is bad practice.
2) Use different styles for different languages. In your nl.css you may set "display:none" to "month" span. Different skins (skin is css + images) for different languages are ok, it is much better then different HTML.


On Wednesday, March 4, 2015 at 5:53:38 PM UTC+3, Jaap van Wingerde wrote:
Op 2015-03-03T17:41:21 UTC schreef Jaap van Wingerde
<mailin...@vanwingerde.nl> in the message <how to deal with not
translated strings in html>,
Reply all
Reply to author
Forward
0 new messages