All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.lightoze.gwt.i18n.server.ThreadLocalLocaleProvider Maven / Gradle / Ivy

There is a newer version: 0.26
Show newest version
package net.lightoze.gwt.i18n.server;

import java.util.Deque;
import java.util.LinkedList;
import java.util.Locale;

/**
 * @author David Parish
 */
public class ThreadLocalLocaleProvider implements LocaleProvider {
    private static final ThreadLocal> locale = new ThreadLocal>() {
        @Override
        protected Deque initialValue() {
            return new LinkedList();
        }
    };

    @Override
    public Locale getLocale() {
        return locale.get().peek();
    }

    public static void pushLocale(Locale l) {
        locale.get().push(l);
    }

    public static void popLocale() {
        locale.get().pop();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy