Example usage for org.apache.wicket.request Request getLocale

List of usage examples for org.apache.wicket.request Request getLocale

Introduction

In this page you can find the example usage for org.apache.wicket.request Request getLocale.

Prototype

public abstract Locale getLocale();

Source Link

Document

Returns locale for this request.

Usage

From source file:gr.interamerican.wicket.bo2.protocol.http.TestBo2WicketSession.java

License:Open Source License

/**
 * @return request./*from   w  ww.  j av a 2s .  co m*/
 */
Request mockRequest() {
    Request request = mock(Request.class);
    when(request.getLocale()).thenReturn(Locale.ENGLISH);
    return request;
}

From source file:org.jabylon.rest.ui.util.WicketUtil.java

License:Open Source License

public static Locale getUserLocale(Request request) {
    return request.getLocale();
}

From source file:org.projectforge.web.session.MySession.java

License:Open Source License

/**
 * Sets or updates the locale of the user's session. Takes the locale of the user account or if not given the locale
 * of the given request./*w ww . j av a 2 s  . c om*/
 * 
 * @param request
 */
public void setLocale(final Request request) {
    setLocale(ThreadLocalUserContext.getLocale(request.getLocale()));
}

From source file:org.projectforge.web.wicket.MySession.java

License:Open Source License

/**
 * Sets or updates the locale of the user's session. Takes the locale of the user account or if not given the locale of the given request.
 * @param request// w w w  . j  a va2s. c  o m
 */
public void setLocale(final Request request) {
    setLocale(PFUserContext.getLocale(request.getLocale()));
}

From source file:org.yes.cart.web.application.StorefrontRequestDecorator.java

License:Apache License

public StorefrontRequestDecorator(final Request request, final List<String> supportedLanguages) {
    this.request = request;
    this.supportedLanguages = supportedLanguages;
    if (supportedLanguages.contains(request.getLocale().getLanguage())) {
        locale = request.getLocale();// www  . ja  v  a2s.  c  o  m
    } else {
        // if unsupported language need to ensure that we select default
        locale = new Locale(supportedLanguages.get(0));
    }
}