diff --git a/babel.cfg b/babel.cfg new file mode 100644 index 0000000000..efceab818b --- /dev/null +++ b/babel.cfg @@ -0,0 +1 @@ +[python: **.py] diff --git a/savanna/cli/savanna_api.py b/savanna/cli/savanna_api.py index 7dc68b9fa0..88a435b583 100755 --- a/savanna/cli/savanna_api.py +++ b/savanna/cli/savanna_api.py @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import gettext import os import sys @@ -33,6 +34,8 @@ if os.path.exists(os.path.join(possible_topdir, '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('savanna', unicode=1) + from savanna import config from savanna.db import api as db_api import savanna.main as server diff --git a/savanna/db/migration/cli.py b/savanna/db/migration/cli.py index 629cf93d66..c0abb44acb 100644 --- a/savanna/db/migration/cli.py +++ b/savanna/db/migration/cli.py @@ -13,8 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +import gettext + from oslo.config import cfg +gettext.install('savanna', unicode=1) + from savanna.db import api as db_api diff --git a/savanna/locale/README b/savanna/locale/README new file mode 100644 index 0000000000..6742f35776 --- /dev/null +++ b/savanna/locale/README @@ -0,0 +1 @@ +Savanna translations diff --git a/setup.cfg b/setup.cfg index 2ef55f036d..8244d9b36d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,3 +13,8 @@ cover-inclusive=true verbosity=3 detailed-errors=1 where=savanna/tests + +[extract_messages] +keywords = _ gettext ngettext l_ lazy_gettext +mapping_file = babel.cfg +output_file = savanna/locale/savanna.pot