Get the current locale.
(Based on the current language).
@return The current locale.
489026
public Locale getLocale()
    {
        String strLanguage = this.getProperty(Params.LANGUAGE);
        if ((strLanguage != null) && (strLanguage.length() > 0))
        {
            Locale locale = Locale.getDefault();
            if (!strLanguage.equalsIgnoreCase(locale.getLanguage()))
                locale = new Locale(strLanguage, "");
            if (locale != null)
            {
                try {
                    Locale.setDefault(locale);
                } catch (java.security.AccessControlException ex) {
                    Util.getLogger().warning("Can't change locale");   // Ignore and continue
                }
            }
        }
        return Locale.getDefault();
    }
376895
public Locale getAcceptLanguage() {
		// See section 14.4 of RFC 2616 (HTTP/1.1) for more information about how the Accept-Language header
		// must interpreted to determine the preferred language of the client.
		Locale preferredLocale = null;
		float q = 0;
		Iterator<Header> it = (Iterator<Header>) this.message
			.getHeaders(AcceptLanguageHeader.NAME);
		while (it.hasNext()) {
			AcceptLanguageHeader alh = (AcceptLanguageHeader) it.next();
			if(preferredLocale == null) {
				preferredLocale = alh.getAcceptLanguage();
				q = alh.getQValue();
			} else {
				if(alh.getQValue() > q) {
					preferredLocale = alh.getAcceptLanguage();
					q = alh.getQValue();
				}
			}
		}
		return preferredLocale;
	}
563166
private Locale extractLocale() {

        Locale loc = null;
        int underscore = m_name.lastIndexOf("_");
        if (underscore > -1) {
            String localeName = m_name.substring(underscore + 1);
            if (localeName.lastIndexOf(".") > -1) {
                localeName = localeName.substring(0, localeName.lastIndexOf("."));
            }
            loc = CmsLocaleManager.getLocale(localeName);
        }

        return loc;
    }
33360
public function getFallbackLocale()
    {
        if (!$this->getLocalizedMeta()) {
            return;
        }

        $fallbackLocale = $this->getLocalizedMeta()->getLocale();

        return $fallbackLocale !== $this->locale ? $fallbackLocale : null;
    }
905657
private Locale getWorkplaceLocale() {

        Locale result = OpenCms.getWorkplaceManager().getWorkplaceLocale(getCmsObject());
        if (result == null) {
            result = CmsLocaleManager.getDefaultLocale();
        }
        if (result == null) {
            result = Locale.getDefault();
        }
        return result;
    }
457528
public function getLocale()
    {
        $language = $this->getLanguage();
        $country = $this->getCountry();

        if (empty($language) || empty($country)) {
            return null;
        }

        return
            strtolower($language->getIso6391())
            . '_' .
            strtoupper($country->getIso2());
    }
546662
@Column(header = Messages.GUI_HISTORY_DIALOG_COL_LOCALE_0, order = 20)
    public String getLocale() {

        return m_elemComp.getLocale().toString();
    }
765895
protected function getCurrentLanguage()
    {
        $request = $this->requestStack->getCurrentRequest();

        return $this->localeConverter->convertToEz($request->get('_locale'));
    }
589893
public Locale getLocale()
            throws JspException
    {
        Locale loc = null;
        if (_language != null || _country != null) {
            // language is required
            if (_language == null) {
                String s = Bundle.getString("Tags_LocaleRequiresLanguage", new Object[]{_country});
                registerTagError(s, null);
                return super.getUserLocale();
            }

            if (_country == null)
                loc = new Locale(_language);
            else
                loc = new Locale(_language, _country);
        }
        else
            loc = super.getUserLocale();

        return loc;
    }
1153442
public Locale getMainLocale() {

        if (m_mainLocale != null) {
            return m_mainLocale;
        }
        try {
            CmsLocaleGroup localeGroup = m_cms.getLocaleGroupService().readLocaleGroup(this);
            m_mainLocale = localeGroup.getMainLocale();
            return m_mainLocale;
        } catch (CmsException e) {
            return null;
        }
    }
612138
public function defaultLocale()
    {
        $locale = $this->getCore()->config('locale.translation-default');

        if ($locale) {
            return $locale;
        }

        // Fall back to default based on CMS configuration and app locale.
        $locale    = app()->getLocale();
        $available = $this->availableLocales();

        // If no translation locales are set, use app's locale as default.
        // If current app locale is available, use it as default.
        if ( ! count($available) || in_array($locale, $available)) {
            return $locale;
        }

        return head($available);
    }
1274735
public function getLocale()
	{
        $locales = explode(',', $this->_meta->locale);

		for($i = 0; $i < count($locales); $i++ ) {
			$locale = $locales[$i];
			$locale = trim($locale);
			$locales[$i] = $locale;
		}

		return $locales;
	}
988883
public List<LocaleBean> getLocales(Locale currentLocale) {
        List<LocaleBean> locales = new ArrayList<>();

        // get the array of locales available from the portal
        List<Locale> portalLocales = localeManagerFactory.getPortalLocales();
        for (Locale locale : portalLocales) {
            if (currentLocale != null) {
                // if a current locale is available, display language names
                // using the current locale
                locales.add(new LocaleBean(locale, currentLocale));
            } else {
                locales.add(new LocaleBean(locale));
            }
        }
        return locales;
    }
1169605
@Deprecated
    public static Locale getLocale() {
        Locale locale = null;
        FacesContext facesContext = FacesContext.getCurrentInstance();

        if (facesContext != null && facesContext.getViewRoot() != null) {
            locale = facesContext.getViewRoot().getLocale();

            if (locale == null) {
                locale = Locale.getDefault();
            }
        }
        else {
            locale = Locale.getDefault();
        }
        return locale;
    }
307994
public function getLocale(): string
    {
        if (is_null($this->locale)) {
            $this->locale = \Locale::getDefault();
        }

        return $this->locale;
    }
370817
public function getLocale()
    {
        $auth = $this->getView()
                     ->authentication();

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

        return $locale;
    }
527931
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
	public Locale getTextLocale (){
		if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
			return mInputView.getTextLocale();

		return Locale.getDefault();
	}