Gets the locale of the current Vaadin UI. If the locale can not be
determined, the default locale is returned instead.

@return the current locale, never {@code null}.
@see com.vaadin.ui.UI#getLocale()
@see java.util.Locale#getDefault()
431264
public static Locale getCurrentLocale() {
        final UI currentUI = UI.getCurrent();
        return currentUI == null ? Locale.getDefault() : currentUI.getLocale();
    }
1251589
@Override
    public Locale getLocale() {
        ServletRESTRequestImpl ret = castRequest();
        if (ret != null)
            return ret.getLocale();
        return null;
    }
1052700
@Override
    public Enumeration<Locale> getLocales() {
        if (super.getSession(false) == null) {
            return super.getLocales();
        }

        final IUserInstance userInstance =
                this.userInstanceManager.getUserInstance(this.getWrappedRequest());
        final LocaleManager localeManager = userInstance.getLocaleManager();
        final List<Locale> locales = localeManager.getLocales();
        return Collections.enumeration(locales);
    }
924960
public static Locale getLocale() {
        final Locale ret = LOCALE.get();
        if (null == ret) {
            return Latkes.getLocale();
        }

        return ret;
    }
1327824
@JSFProperty
    public Locale getLocale()
    {
        Object locale = getStateHelper().get(PropertyKeys.locale);
        if (locale != null)
        {
            return (Locale)locale;
        }
        ValueExpression expression = getValueExpression(PropertyKeys.locale.toString());
        if (expression != null)
        {
            Object veLocale = expression.getValue(getFacesContext().getELContext());
            if (veLocale instanceof Locale)
            {
                return (Locale) veLocale;
            }
            else
            {
                return (Locale) _LocaleUtils.toLocale(veLocale.toString());
            }
        }
        else
        {
            locale = getFacesContext().getApplication().getViewHandler().calculateLocale(getFacesContext());

            if (locale instanceof Locale)
            {
                return (Locale)locale;
            }
            else if (locale instanceof String)
            {
                return _LocaleUtils.toLocale((String)locale);
            }
        }

        return getFacesContext().getApplication().getViewHandler().calculateLocale(getFacesContext());
    }
831669
public function getLocale()
    {
        if (empty($this->locale)) {
            $this->locale = $this->getSettings()->locale->default;
        }

        return $this->locale;
    }
606583
protected Locale getLocale(RequestContext context) {
    return this.locale != null ? this.locale : context.getExternalContext().getLocale();
  }
370817
public function getLocale()
    {
        $auth = $this->getView()
                     ->authentication();

        if ( $auth->hasIdentity() )
        {
            $locale = $auth->getIdentity()->locale;
        }
        else
        {
            $locale = Locale::getDefault();
        }

        return $locale;
    }
56782
protected Locale getLocale( HttpServletRequest request )
    {

        HttpSession session = request.getSession();
        Locale locale = ( Locale ) session.getAttribute( Globals.LOCALE_KEY );
        return locale != null ? locale : DEFAULT_LOCALE;
    }
223407
public Locale getLocale()
    {
        Enumeration enm = _httpRequest.getFieldValues(HttpFields.__AcceptLanguage,
                                                       HttpFields.__separators);

        // handle no locale
        if (enm == null || !enm.hasMoreElements())
            return Locale.getDefault();
        
        // sort the list in quality order
        List acceptLanguage = HttpFields.qualityList(enm);
        if (acceptLanguage.size()==0)
            return  Locale.getDefault();

        int size=acceptLanguage.size();
        
        // convert to locals
        for (int i=0; i<size; i++)
        {
            String language = (String)acceptLanguage.get(i);
            language=HttpFields.valueParameters(language,null);
            String country = "";
            int dash = language.indexOf('-');
            if (dash > -1)
            {
                country = language.substring(dash + 1).trim();
                language = language.substring(0,dash).trim();
            }
            return new Locale(language,country);
        }

        return  Locale.getDefault();
    }
1136036
@Override
    public ULocale getLocale(ULocale.Type type) {
        if (type == ULocale.ACTUAL_LOCALE) {
            return actualLocaleIsSameAsValid ? validLocale : tailoring.actualLocale;
        } else if(type == ULocale.VALID_LOCALE) {
            return validLocale;
        } else {
            throw new IllegalArgumentException("unknown ULocale.Type " + type);
        }
    }
253818
public String getLanguage(boolean bCheckLocaleAlso)
    {
        String strLanguage = this.getProperty(Params.LANGUAGE);
        if ((strLanguage == null) || (strLanguage.length() == 0))
            if (bCheckLocaleAlso)
                return Locale.getDefault().getLanguage();
        return strLanguage;
    }
311939
public static function getLocale()
    {
        static::getDefaultLocale();
        $current = Locale::getDefault();
        if ($current === '') {
            $current = static::DEFAULT_LOCALE;
            Locale::setDefault($current);
        }

        return $current;
    }
905657
private Locale getWorkplaceLocale() {

        Locale result = OpenCms.getWorkplaceManager().getWorkplaceLocale(getCmsObject());
        if (result == null) {
            result = CmsLocaleManager.getDefaultLocale();
        }
        if (result == null) {
            result = Locale.getDefault();
        }
        return result;
    }
718615
public Locale getLocale() {
		Locale l = wbRequest.getLocale();
		if (l == null) {
			l = Locale.getAvailableLocales()[0];
		}
		return l;
	}
727588
public Locale getLocaleOrDefault(String language) {
        String lang = getLanguageOrDefault(language);
        return Locale.forLanguageTag(lang);
    }
3262
public function getLocale() {
		if($this->locale === null)
			$this->locale = $this->getDefinition()->getEntityManager()->getDefaultLocale();
		return $this->locale;
	}