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

Aline Manera alinefm at linux.vnet.ibm.com
Mon May 9 13:33:40 UTC 2016



On 05/05/2016 04:02 AM, pkulkark at linux.vnet.ibm.com wrote:
> 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';
> +    },
> +

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);
>       }




More information about the Kimchi-devel mailing list