Package: django-translate-gettext
Django-translate-getetxtThis is a django app that allows you to wrap django applications files fields with a translation field (not for Pycharm and docker-compose python interpretator).It uses gettext package to achieve this and wrapping fields.v.0.2.2 - Added support for clean models methods and ValidationError messagesv0.2.0 - Added support for admin filesv0.1.0 - Initial release with models files supportInstallationpoetryadddjango-translate-gettext# orpoetryaddgit+https://github.com/alpden550/django-translate-gettext.gitUsageAdddjango_translateto yourINSTALLED_APPSsetting like this:INSTALLED_APPS=[...,'django_translate_gettext',...]Call django commands to create the translation fields for your apps, use--formatflag to call ruff format tool after files changed.Example:pythonmanage.pytranslateapp1app2app3app4--formatModels files before:demo/models/base.pyfromdjango.dbimportmodelsclassBase(models.Model):created_at=models.DateTimeField("Date Created",auto_now_add=True)updated_at=models.DateTimeField(verbose_name="Date Updated",auto_now=True)items=models.JSONField(default=dict,blank=True,null=True)classMeta:abstract=Truedemo/models/user.pyimportcsvfrompathlibimportPathfromdjango.dbimportmodelsfromdemo.modelsimportBaseclassCustomQuerySet(models.QuerySet):deffilter(self,*args,**kwargs):returnsuper().filter(*args,**kwargs).order_by("id")classUserTypes(models.TextChoices):ADMIN="admin","Admin"USER="user","User"STAFF="staff","Staff"classCustomUser(Base):class_InnerTypes(models.TextChoices):NEW="new","New"OLD="old","Old"username=models.CharField("User Name",max_length=100,help_text="This is the help text")email=models.EmailField()password=models.CharField(max_length=100)created_at=models.DateTimeField("Date Created",auto_now_add=True)updated_at=models.DateTimeField(verbose_name="Date Updated",auto_now=True)first_name=models.CharField(verbose_name="First_Name",max_length=25)last_name=models.CharField("Last_Name",max_length=25)is_active=models.BooleanField(default=True)choices=models.CharField(max_length=5,choices=UserTypes.choices,default=UserTypes.USER)groups=models.ManyToManyField("auth.Group",verbose_name="Custom Groups",blank=True)owner=models.ForeignKey("auth.User",related_name="users",on_delete=models.CASCADE,blank=True,null=True)objects=CustomQuerySet.as_manager()classMeta:verbose_name="Own Custom User"verbose_name_plural="Own Custom Users"ordering=("-created_at",)get_latest_by=("-created_at","is_active")Models files after:demo/models/base.pyfromdjango.dbimportmodelsfromdjango.utils.translationimportgettext_lazyas_classBase(models.Model):created_at=models.DateTimeField(_("Date Created"),auto_now_add=True)updated_at=models.DateTimeField(verbose_name=_("Date Updated"),auto_now=True)items=models.JSONField(verbose_name=_("Items"),default=dict,blank=True,null=True)classMeta:abstract=Truedemo/models/user.pyimportcsvfrompathlibimportPathfromdjango.dbimportmodelsfromdemo.modelsimportBasefromdjango.utils.translationimportgettext_lazyas_classCustomQuerySet(models.QuerySet):deffilter(self,*args,**kwargs):returnsuper().filter(*args,**kwargs).order_by("id")classUserTypes(models.TextChoices):ADMIN=("admin",_("Admin"))USER=("user",_("User"))STAFF=("staff",_("Staff"))classCustomUser(Base):class_InnerTypes(models.TextChoices):NEW=("new",_("New"))OLD=("old",_("Old"))username=models.CharField(_("User Name"),max_length=100,help_text=_("This is the help text"))email=models.EmailField(_("Email"))password=models.CharField(verbose_name=_("Password"),max_length=100)created_at=models.DateTimeField(_("Date Created"),auto_now_add=True)updated_at=models.DateTimeField(verbose_name=_("Date Updated"),auto_now=True)first_name=models.CharField(verbose_name=_("First_Name"),max_length=25)last_name=models.CharField(_("Last_Name"),max_length=25)is_active=models.BooleanField(verbose_name=_("Is_Active"),default=True)choices=models.CharField(verbose_name=_("Choices"),max_length=5,choices=UserTypes.choices,default=UserTypes.USER)groups=models.ManyToManyField("auth.Group",verbose_name=_("Custom Groups"),blank=True)owner=models.ForeignKey("auth.User",verbose_name=_("Owner"),related_name="users",on_delete=models.CASCADE,blank=True,null=True)objects=CustomQuerySet.as_manager()classMeta:verbose_name=_("Own Custom User")verbose_name_plural=_("Own Custom Users")ordering=("-created_at",)get_latest_by=("-created_at","is_active")Don't forget to check the changes before callmakemigrationsandmigratecommands.Don't forget to fill the settings.py like example file with the recommended Django settings before calling themakemessagingcommand.# settings.pyLANGUAGE_CODE="en"USE_I18N=TrueUSE_L10N=TrueUSE_TZ=TrueLOCALE_PATHS=[Path(BASE_DIR,"locale")]LANGUAGES=[("en","English"),("ru","Russian"),]