Code

Opened 6 years ago

Closed 5 years ago

#9710 closed (worksforme)

Models translations in applications does not work

Reported by: me_22 Owned by: nobody
Component: Internationalization Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

There is a project and an application with a model like this:

from django.utils.translation import gettext_lazy as _
class MODEL(models.Model):
    name = models.TextField(_("NAME"))

When creating the *.po file running manage.py makemessages in the application directory and translating and compiling messages, it does not work in the admin panel. It behaves like there isn't any translation.

All works when I create translations in the project directory, then everything is OK without any changes in the settings.py file or anything else.

I can't have translations for the whole project as I need to have some applications in many projects so I want to translate the models once.

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by ramiro

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

I can't reproduce this.

Make sure your .po and .mo files are located in locale/xx_YY/LC_MESSSAGES/ under your application directory as explained at http://docs.djangoproject.com/en/dev/topics/i18n/#using-translations-in-your-own-projects and that the language you are translating your app to is one of the languages Django has been translated to as explained at http://docs.djangoproject.com/en/dev/topics/i18n/#id1 (or use the workaround described there there).

Closing as worksforme.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.