On 05/05/2016 04:02 AM, pkulkark(a)linux.vnet.ibm.com wrote:
From: Pooja Kulkarni <pkulkark(a)linux.vnet.ibm.com>
co-authored by: Archana Singh <archus(a)linux.vnet.ibm.com>
v2:
Changed method names from get_loc
to get_locale and set_loc to
set_locale.
v1:
This patch adds separate methods to
get the locale from cookies (if set)
and to set the locale.
Signed-off-by: Pooja Kulkarni <pkulkark(a)linux.vnet.ibm.com>
---
ui/js/src/wok.lang.js | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/ui/js/src/wok.lang.js b/ui/js/src/wok.lang.js
index b3791e7..e9d4eb8 100644
--- a/ui/js/src/wok.lang.js
+++ b/ui/js/src/wok.lang.js
@@ -46,6 +46,14 @@ wok.lang = {
'en_US';
},
+ get_locale: function() {
+ return wok.cookie.get('wokLocale') || 'en-US';
+ },
+
Shouldn't we try get the locale from browser before falling back to en-US ?
+ set_locale: function(locale) {
+ wok.cookie.set('wokLocale', locale, 365);
+ },
+
set: function(lang) {
wok.cookie.set('wokLang', lang, 365);
}