Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

478
Vistas
Django Translation on Heroku is not fully working

I deployed my Django app on Heroku and I added https://github.com/piotras/heroku-buildpack-gettext.git this ugettext buildpack and some parts of the application are note translated. Locally it's working, I don't know where is the issue coming from.

For example, the menu item Classes Types is not translated but other parts are.

{% trans "Class Types" %}

template

{% load i18n %}
....
<li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans "Class Types" %}<span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="{% url 'class_type-list' %}">
                                <span class="glyphicon glyphicon-list" aria-hidden="true"></span> {% trans "All" %}</a>
                        </li>
                        <li>
                            <a href="{% url 'class_type-new' %}">
                                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> {% trans "New" %}</a>
                        </li>
                    </ul>
                </li>
....

ar/LC_MESSAGES.po

#: templates/back_office/class_type_list.html:4
#: templates/back_office/menu.html:37
msgid "Class Types"
msgstr "انواع الحلقات"

en/LC_MESSAGES.po

#: templates/back_office/class_type_list.html:4
#: templates/back_office/menu.html:37
msgid "Class Types"
msgstr "Class Types"
over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

After some research, I found it's better to commit the compiled messages files (*.mo) to Heroku, and translation will work properly.

over 4 years ago · Santiago Trujillo Denunciar

0

You can generate those files during the build.

Add a post compile file in bin/post_compile (no extension like procfile) with the following line:

python manage.py compilemessages

Optionally you can add the specific language (e.g. python manage.py compilemessages -l nl)

Since Heroku 20, gettext is automatically added for the default Python build package. This is only during build and not at runtime. Therefore the command should be added in post_compile and not under release: in the procfile.

Older info links to buildpacks for gettext on Heroku (e.g. in the question above). Those are not needed anymore with this configuration.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda