Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#16298 closed New feature (wontfix)

Gettext by default on generated labels

Reported by: vzima Owned by: nobody
Component: Translations Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

For model and form fields it would be nice to have default labels derived from its names translated.

It is much easier to make extra translations and add them to LOCALE_PATHS or merge them with generated translation than mess up code with extra parameter for every model field and form field.

Attachments (0)

Change History (3)

comment:1 follow-up: Changed 3 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

If I understand correctly, the idea is to make this definition of Meta unnecessary:

from django.db import models
from django.utils.translation import ugettext_lazy as _
class Stuff(models.Model):
    class Meta:
        verbose_name = _("stuff")
        verbose_name_plural = _("stuffs")

One problem is that, if "stuff" and "stuffs" don't appear in Meta, they will no longer be discovered by makemessages.

comment:2 Changed 3 years ago by jezdez

  • Resolution set to wontfix
  • Status changed from new to closed

Nope, sorry, this is a bad idea.

comment:3 in reply to: ↑ 1 Changed 3 years ago by vzima

Replying to aaugustin:

If I understand correctly, the idea is to make this definition of Meta unnecessary:
One problem is that, if "stuff" and "stuffs" don't appear in Meta, they will no longer be discovered by makemessages.

No only that, mostly I have this problem with form fields such as

class SomeForm(forms.Form):
    name = forms.CharField(_('Name'))
    address = forms.CharField(_('Address'))
    country = forms.CharField(_('Country'))

For me this looks much worse than problem of discovery. Especially when adding extra translations could be done easily in LOCALE_PATHS. Create files with translations for such labels can be easily done by hand and does not have to be generated.

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.