[PATCH] [Wok] Seperate method to get accept-language.

From: Archana Singh <archus@linux.vnet.ibm.com> Seperated method to get the accept-langauage, which can be used if format of number/timestamp has to be done based on it. Signed-off-by: Archana Singh <archus@linux.vnet.ibm.com> --- src/wok/template.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wok/template.py b/src/wok/template.py index 09f4dbe..b47041a 100644 --- a/src/wok/template.py +++ b/src/wok/template.py @@ -34,6 +34,12 @@ def get_lang(): if "wokLang" in cookie.keys(): return [cookie["wokLang"].value] + langs = get_accept_language() + + return langs + + +def get_accept_language(): lang = cherrypy.request.headers.get("Accept-Language", "en_US") if lang and lang.find(';') != -1: @@ -46,7 +52,6 @@ def get_lang(): langCountry = val.split('-') langCountry[1] = langCountry[1].upper() langs[idx] = "_".join(langCountry) - return langs -- 2.5.0

Reviewed by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com> On 18-04-2016 07:05, archus@linux.vnet.ibm.com wrote:
From: Archana Singh <archus@linux.vnet.ibm.com>
Seperated method to get the accept-langauage, which can be used if format of number/timestamp has to be done based on it.
Signed-off-by: Archana Singh <archus@linux.vnet.ibm.com> --- src/wok/template.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/wok/template.py b/src/wok/template.py index 09f4dbe..b47041a 100644 --- a/src/wok/template.py +++ b/src/wok/template.py @@ -34,6 +34,12 @@ def get_lang(): if "wokLang" in cookie.keys(): return [cookie["wokLang"].value]
+ langs = get_accept_language() + + return langs + + +def get_accept_language(): lang = cherrypy.request.headers.get("Accept-Language", "en_US")
if lang and lang.find(';') != -1: @@ -46,7 +52,6 @@ def get_lang(): langCountry = val.split('-') langCountry[1] = langCountry[1].upper() langs[idx] = "_".join(langCountry) - return langs
-- Jose Ricardo Ziviani ----------------------------- Software Engineer Linux Technology Center - IBM
participants (3)
-
Aline Manera
-
archus@linux.vnet.ibm.com
-
Jose Ricardo Ziviani