https://github.com/ProgVal/Limnoria
Raw File
Tip revision: 06c88581ec5b6547de0012a75dfed6316ceda011 authored by Valentin Lorentz on 18 November 2023, 21:02:36 UTC
Services: Improve error on missing password or NickServ nick
Tip revision: 06c8858
update_pot.py
import pathlib
import subprocess

for plugin_path in pathlib.Path("plugins/").iterdir():
    assert plugin_path.exists()
    if not plugin_path.is_dir():
        continue
    plugin_name = plugin_path.name
    if plugin_name[0] == plugin_name[0].lower():
        continue
    subprocess.run(["pygettext3", "-D", "config.py", "plugin.py"], cwd=plugin_path)

    for po_path in plugin_path.glob("locales/*.po"):
        subprocess.run(["msgmerge", "--quiet", "--update", po_path, plugin_path / "messages.pot"], stdout=subprocess.DEVNULL)

core_files = pathlib.Path("src/").glob("**/*.py")
subprocess.run(["pygettext3", "-p", "locales/", *core_files])

pot_path = pathlib.Path("locales/messages.pot")
for po_path in pathlib.Path("").glob("locales/*.po"):
    subprocess.run(["msgmerge", "--quiet", "--update", po_path, pot_path], stdout=subprocess.DEVNULL)
back to top