canaille-globuzma/hatch_build.py

24 lines
541 B
Python
Raw Permalink Normal View History

import os
2024-10-28 08:01:52 +00:00
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
2024-10-28 08:01:52 +00:00
def create_mo_files():
from babel.messages.frontend import compile_catalog
cmd = compile_catalog()
cmd.directory = os.path.join(os.path.dirname(__file__), "canaille", "translations")
cmd.quiet = True
cmd.statistics = True
cmd.finalize_options()
cmd.run()
2024-10-28 08:01:52 +00:00
class CustomBuildHook(BuildHookInterface):
def initialize(self, version, build_data):
create_mo_files()
if __name__ == "__main__":
create_mo_files({})