From b0c21942ab48fdcfc2f138ae0af2372314763b31 Mon Sep 17 00:00:00 2001 From: Paarhati Ozkasgarli Date: Thu, 1 Dec 2016 20:22:17 +0000 Subject: [PATCH] i18n Support This will add oslo.i18n language translation support. Change-Id: I3b9a2f5aed834903fa65aae3f11e7e86c6ccc237 Signed-off-by: Paarhati Ozkasgarli --- dash_stack_dashboard/_i18n.py | 32 ++++++++++++++++++++++++++++++++ requirement.txt | 5 +++++ 2 files changed, 37 insertions(+) create mode 100644 dash_stack_dashboard/_i18n.py create mode 100644 requirement.txt diff --git a/dash_stack_dashboard/_i18n.py b/dash_stack_dashboard/_i18n.py new file mode 100644 index 0000000..8a3fce9 --- /dev/null +++ b/dash_stack_dashboard/_i18n.py @@ -0,0 +1,32 @@ +import oslo_i18n + +oslo_i18n.enable_lazy() + +DOMAIN = "dash_stack_dashboard" + +_translators = oslo_i18n.TranslatorFactory(domain=DOMAIN) + +# The primary translation function using the well-known name "_" +_ = _translators.primary + +# The contextual translation function using the name "_C" +# requires oslo.i18n >=2.1.0 +_C = _translators.contextual_form + +# The plural translation function using the name "_P" +# requires oslo.i18n >=2.1.0 +_P = _translators.plural_form + +# Translators for log levels. +# +# The abbreviated names are meant to reflect the usual use of a short +# name like '_'. The "L" is for "log" and the other letter comes from +# the level. +_LI = _translators.log_info +_LW = _translators.log_warning +_LE = _translators.log_error +_LC = _translators.log_critical + + +def get_available_languages(): + return oslo_i18n.get_available_languages(DOMAIN) \ No newline at end of file diff --git a/requirement.txt b/requirement.txt new file mode 100644 index 0000000..24a8447 --- /dev/null +++ b/requirement.txt @@ -0,0 +1,5 @@ +Babel==2.3.4 +Django==1.10.3 +mysqlclient==1.3.9 +oslo.i18n==3.10.0 +requests==2.12.1