[Kimchi-devel] [Wok][PATCH v2 2/7] Multi-Culture support - Add methods to get and set locales in wok.lang.js

pkulkark at linux.vnet.ibm.com pkulkark at linux.vnet.ibm.com
Thu May 5 07:02:24 UTC 2016


From: Pooja Kulkarni <pkulkark at linux.vnet.ibm.com>

co-authored by: Archana Singh <archus at 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 at 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';
+    },
+
+    set_locale: function(locale) {
+        wok.cookie.set('wokLocale', locale, 365);
+    },
+
     set: function(lang) {
         wok.cookie.set('wokLang', lang, 365);
     }
-- 
2.1.0




More information about the Kimchi-devel mailing list