Have the following css section:
.introduction:before { content: 'Who is going to translate me in a graceful way?'; }
Probably there is no easy way to handle i18n for css file, two possible choices:
Any new possible solutions will be appreciated, thanks.
I would serve the css file that needs translating through Django and cache it per language to mitigate the performance hit.
urls.py
url(r'^static/css/translated.css$', TemplateView.as_view(template_name='translated.css')),
translated.css
{% load cache %}
{% cache 60*60*24 translated_css LANGUAGE_CODE %}
{# write css here, translate as a normal template #}
.introduction:before { content:
{% trans 'Who is going to translate me in a graceful way?' %}
; }
{% endcache %}
I think that this is impossible. Only you can translate it if the css is a template (like the html template). But this is a bad solution.... efficiency
But if you have a class language in the body for example, you can have something like this:
body.language_en .introduction:before { content: 'Who is going to translate me in a graceful way?'; }
body.language_es .introduction:before { content: 'El traductor de google es terrible :-)'; }
And in your base.html something like this:
....
<body class="language_{{ LANGUAGE_CODE }}">
....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With