2023-09-11 16:11:48 +00:00
|
|
|
import os
|
|
|
|
|
2024-10-28 08:01:52 +00:00
|
|
|
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
|
2023-09-11 16:11:48 +00:00
|
|
|
|
2024-10-28 08:01:52 +00:00
|
|
|
|
|
|
|
def create_mo_files():
|
2023-07-24 17:36:11 +00:00
|
|
|
from babel.messages.frontend import compile_catalog
|
|
|
|
|
|
|
|
cmd = compile_catalog()
|
2023-09-11 16:11:48 +00:00
|
|
|
cmd.directory = os.path.join(os.path.dirname(__file__), "canaille", "translations")
|
2023-07-24 17:36:11 +00:00
|
|
|
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()
|
2022-05-14 16:37:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
create_mo_files({})
|