开发者

Automark model names/attributes for translation

开发者 https://www.devze.com 2023-01-03 23:28 出处:网络
Is there any way one could automatically mark all model names and attributes for translation, without specifying verbose_name/_plural on each one of them?

Is there any way one could automatically mark all model names and attributes for translation, without specifying verbose_name/_plural on each one of them?

Doesn't feel very DRY to do this every time:

class Profile(models.Model):
    length = models.IntegerField(_('length'))
    weight = models.IntegerField(_('weight'))
    favorite_movies = models.CharField(_('favorite movies'), max_length=100)
    favorite_quote = models.CharField(_('favorite quote'), max_length=30)
    religious_views = models.CharField(_('religious views'), ma开发者_StackOverflowx_length=30)
    political_views = models.CharField(_('political views'), max_length=30)

    class Meta:
        verbose_name = _('profile')
        verbose_name_plural = _('profiles')
0

精彩评论

暂无评论...
验证码 换一张
取 消