I am doing a website in Django where I have a customview, deleteview and so on. My problem is that I have written my apps in English and want the program to understand that when I print it out in a template it should be in another language. So I want to write some kind of translation. But all the tutorials I have found is how you translate the values you put inside your model and not the field name. Some one who has a tip on a link or how I should make the translation?
See the verbose_name
of Model itself and the verbose_name
and verbose_name_plural
class Meta additionally.
class MyModel(models.Model):
my_field = models.CharField(_("My field"), max_length=255)
my_another_field = models.CharField(_("My another field"), max_length=255)
class Meta:
verbose_name = _("My model")
verbose_name_plural = _("My models")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.