uncomment internationalizion step of setup.py build process

This commit is contained in:
Emily Soth 2022-12-05 17:06:34 -08:00
parent 36476e6750
commit aa1a2a476f
1 changed files with 11 additions and 11 deletions

View File

@ -1,4 +1,6 @@
import os
import platform
import subprocess
import Cython.Build
import numpy
@ -30,20 +32,18 @@ class build_py(_build_py):
"""Command to compile translation message catalogs before building."""
def run(self):
# NOTE: un-comment this when we get message catalogs.
#
# internationalization: compile human-readable PO message catalogs
# into machine-readable MO message catalogs used by gettext
# the MO files are included as package data
# locale_dir = os.path.abspath(os.path.join(
# os.path.dirname(__file__),
# 'src/natcap/invest/internationalization/locales'))
# for locale in os.listdir(locale_dir):
# subprocess.run([
# 'pybabel',
# 'compile',
# '--input-file', f'{locale_dir}/{locale}/LC_MESSAGES/messages.po',
# '--output-file', f'{locale_dir}/{locale}/LC_MESSAGES/messages.mo'])
locale_dir = os.path.abspath(os.path.join(
os.path.dirname(__file__),
'src/natcap/invest/internationalization/locales'))
for locale in ['es']:
subprocess.run([
'pybabel',
'compile',
'--input-file', f'{locale_dir}/{locale}/LC_MESSAGES/messages.po',
'--output-file', f'{locale_dir}/{locale}/LC_MESSAGES/messages.mo'])
# then execute the original run method
_build_py.run(self)