package com.face.global.language;

import java.util.Locale;
import java.util.Optional;

public class LanguageStore {

    private static final Locale CN = new Locale( "zh" , "CN" );

    private final static ThreadLocal<Locale> THREAD_LOCAL = new ThreadLocal<>();

    public static Locale getLocale() {
        return Optional.ofNullable(THREAD_LOCAL.get()).orElse(CN);
    }

    public static void setLocale(Locale locale) {
        THREAD_LOCAL.set(locale);
    }


    public static void clearLocale() {
        THREAD_LOCAL.remove();
    }
}
