misc: add make_translation command (#72667)
This commit is contained in:
parent
9bc4981677
commit
4141f48cd7
|
@ -1,3 +1,4 @@
|
|||
**/django.mo
|
||||
*.pyc
|
||||
*.egg-info
|
||||
.pytest_cache/
|
||||
|
|
26
setup.py
26
setup.py
|
@ -47,6 +47,31 @@ def get_version():
|
|||
return '0.0'
|
||||
|
||||
|
||||
class make_translations(Command):
|
||||
description = 'make message catalogs via django makemessages'
|
||||
user_options = []
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
from django.core.management import call_command
|
||||
|
||||
for path, dirs, files in os.walk('publik_django_templatetags'):
|
||||
if 'locale' not in dirs:
|
||||
continue
|
||||
curdir = os.getcwd()
|
||||
os.chdir(os.path.realpath(path))
|
||||
call_command('makemessages', '-l', 'fr', '--add-location', 'file', '--no-obsolete')
|
||||
os.chdir(curdir)
|
||||
except ImportError:
|
||||
sys.stderr.write('!!! Please install Django >= 2.2 to make translations\n')
|
||||
|
||||
|
||||
class compile_translations(Command):
|
||||
description = 'compile message catalogs to MO files via django compilemessages'
|
||||
user_options = []
|
||||
|
@ -107,6 +132,7 @@ setup(
|
|||
zip_safe=False,
|
||||
cmdclass={
|
||||
'build': build,
|
||||
'make_translations': make_translations,
|
||||
'compile_translations': compile_translations,
|
||||
'install_lib': install_lib,
|
||||
'sdist': eo_sdist,
|
||||
|
|
Loading…
Reference in New Issue