40π
{% trans %}Questions{% endtrans %}
is not the correct format.
{% load i18n %}
should be at the top of your template, or any extended template using translations.
You can use {% trans "Questions." %}
If youβre going to use blocks, they need to be in the format below:
{% blocktrans %}{{ value2translate }}{% endblocktrans %}
More info here.
5π
Probably you should use {% blocktrans %}Questions{% endblocktrans %}
and you forget to put {% load i18n %}
toward the top of your template.
- Django Rest Framework: Serialize data from nested json fields to plain object
- Django sub-applications & module structure
3π
this is because you have not loaded i18n in this template{% load i18n %}
you must add this in each of your template.
- Is there a command for creating an app using cookiecutter-django?
- Django-admin.py startproject opens notepad, instead of creating a project
- How to dynamically add EC2 ip addresses to Django ALLOWED_HOSTS
2π
You must place at the beginning of your extended template code: {% load i18n %}
, so you can use the trans Tags:
{% extends 'home/base.html' %}
{% block title %}INICIO{% endblock %}
{% load i18n %}
{% block opcionesMenu %}
<!-- =====START====== -->
<a href="#sTop" class="subNavBtn">{% trans "Inicio" %}</a>
<a href="#s1" class="subNavBtn">{% trans "Proyectos" %}</a>
<a href="#s2" class="subNavBtn">{% trans "DiseΓ±o Web" %}</a>
<a href="#s3" class="subNavBtn">{% trans "Marketing" %}</a>
<a href="#s4" class="subNavBtn">{% trans "Conocenos" %}</a>
<a href="#s5" class="subNavBtn">{% trans "Contacto" %}</a>
<!-- =====END ====== -->
{% endblock %}
- How to resolve the "psycopg2.errors.UndefinedTable: relation "auth_user" does not exist" when running django unittests on Travis
- Django QuerySet Custom Ordering by ID
0π
In addition to other answers, you need to put {% load i18n %} after {% extends %} to use {% trans %} or {% translate %} as shown below:
{% extends "two_column_body.html" %}
{% load i18n %}
{% extends %}
is explained in Template inheritance as shown below:
- If you use
{% extends %}
in a template, it must be the first template tag in that template. Template inheritance wonβt work, otherwise.
So, if you put {% load i18n %}
before {% extends %}
as shown below:
{% load i18n %}
{% extends "two_column_body.html" %}
Then, the error below occurs:
<ExtendsNode: extends "β¦"> must be the first tag in the template.
- In django, is there a way to directly annotate a query with a related object in single query?
- How to upgrade Django on ubuntu?
- Django admin dropdown of 1000s of users
- How do you use Django-filter's '__in' lookup?
- How to write unit tests for django-rest-framework api's?