Move translation files in the module
This commit is contained in:
parent
ffc8b90441
commit
8aad15f07b
Binary file not shown.
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: squirrelbattle 3.14.1\n"
|
"Project-Id-Version: squirrelbattle 3.14.1\n"
|
||||||
"Report-Msgid-Bugs-To: squirrel-battle@crans.org\n"
|
"Report-Msgid-Bugs-To: squirrel-battle@crans.org\n"
|
||||||
"POT-Creation-Date: 2020-11-28 02:50+0100\n"
|
"POT-Creation-Date: 2020-11-28 03:01+0100\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
Binary file not shown.
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import gettext as gt
|
import gettext as gt
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from pathlib import Path
|
||||||
from typing import Any, List
|
from typing import Any, List
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@ class Translator:
|
||||||
for language in SUPPORTED_LOCALES:
|
for language in SUPPORTED_LOCALES:
|
||||||
translators[language] = gt.translation(
|
translators[language] = gt.translation(
|
||||||
"squirrelbattle",
|
"squirrelbattle",
|
||||||
localedir="locale",
|
localedir=Path(__file__).parent / "locale",
|
||||||
languages=[language],
|
languages=[language],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -38,10 +39,11 @@ class Translator:
|
||||||
return cls.translators.get(cls.locale)
|
return cls.translators.get(cls.locale)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def makemessages(cls) -> None:
|
def makemessages(cls) -> None: # pragma: no cover
|
||||||
for language in cls.SUPPORTED_LOCALES:
|
for language in cls.SUPPORTED_LOCALES:
|
||||||
args = ["find", "squirrelbattle/", "-iname", "*.py"]
|
args = ["find", "squirrelbattle", "-iname", "*.py"]
|
||||||
find = subprocess.Popen(args, stdout=subprocess.PIPE)
|
find = subprocess.Popen(args, cwd=Path(__file__).parent.parent,
|
||||||
|
stdout=subprocess.PIPE)
|
||||||
args = ["xargs", "xgettext", "--from-code", "utf-8",
|
args = ["xargs", "xgettext", "--from-code", "utf-8",
|
||||||
"--join-existing",
|
"--join-existing",
|
||||||
"--add-comments",
|
"--add-comments",
|
||||||
|
@ -50,16 +52,19 @@ class Translator:
|
||||||
"--copyright-holder=ÿnérant, eichhornchen, "
|
"--copyright-holder=ÿnérant, eichhornchen, "
|
||||||
"nicomarg, charlse",
|
"nicomarg, charlse",
|
||||||
"--msgid-bugs-address=squirrel-battle@crans.org",
|
"--msgid-bugs-address=squirrel-battle@crans.org",
|
||||||
"-o", f"locale/{language}/LC_MESSAGES/squirrelbattle.po"]
|
"-o", Path(__file__).parent / "locale" / language
|
||||||
|
/ "LC_MESSAGES" / "squirrelbattle.po"]
|
||||||
print(f"Make {language} messages...")
|
print(f"Make {language} messages...")
|
||||||
subprocess.Popen(args, stdin=find.stdout)
|
subprocess.Popen(args, stdin=find.stdout)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def compilemessages(cls) -> None:
|
def compilemessages(cls) -> None: # pragma: no cover
|
||||||
for language in cls.SUPPORTED_LOCALES:
|
for language in cls.SUPPORTED_LOCALES:
|
||||||
args = ["msgfmt", "--check-format",
|
args = ["msgfmt", "--check-format",
|
||||||
"-o", f"locale/{language}/LC_MESSAGES/squirrelbattle.mo",
|
"-o", Path(__file__).parent / "locale" / language
|
||||||
f"locale/{language}/LC_MESSAGES/squirrelbattle.po"]
|
/ "LC_MESSAGES" / "squirrelbattle.mo",
|
||||||
|
Path(__file__).parent / "locale" / language
|
||||||
|
/ "LC_MESSAGES" / "squirrelbattle.po"]
|
||||||
print(f"Compiling {language} messages...")
|
print(f"Compiling {language} messages...")
|
||||||
subprocess.Popen(args)
|
subprocess.Popen(args)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue