Skip to content

ephios-dev/hatch-django-locales

Repository files navigation

hatch-django-locales

This package provides a hatchling plugin (build hook) for Django projects that automatically compiles locale files when building the package.

Usage

In your projects pyproject.toml, make sure you are using the hatchling build system and configure the hook. For uv, add the following:

[tool.hatch.build.hooks.django-locales]
dependencies = ["hatch-django-locales>=0.1.5", "django"]
search-directories = ["src"]

The search-directories option should be a list of directories to glob for locale directories and is your project root by default.

Make sure that the .mo files are actually included in the wheels produced by your build process. Hatchling ignores files mentioned in .gitignore by default, which would include, but uv builds wheels in a temporary directory that does not contain the .gitignore file, so it still does work. If it does not work for you,explicitly include the .mo files in your wheel (see hatchling documentation for details on how to do this).

About

A hatchling build hook to compile django locale files during build time

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages