/* (non-Javadoc)
@see net.jawr.web.resource.bundle.locale.LocaleResolver#resolveLocaleCode(javax.servlet.http.HttpServletRequest)
558723
public String resolveLocaleCode(HttpServletRequest request) {
		org.springframework.web.servlet.LocaleResolver resolver = RequestContextUtils.getLocaleResolver(request);
		Locale resolved = resolver.resolveLocale(request);
		if(resolved != Locale.getDefault())
			return resolved.toString();
		else return null;
	}
599421
public void setLocale(Object loc) throws JspTagException {
        if (loc == null
                || (loc instanceof String && ((String) loc).length() == 0)) {
            this.locale = null;
        } else if (loc instanceof Locale) {
            this.locale = (Locale) loc;
        } else {
            locale = Util.parseLocale((String) loc);
        }
    }
250049
private function createLocale($localeCode)
    {
        /** @var LocaleInterface $locale */
        $locale = $this->localeFactory->createNew();
        $locale->setCode($localeCode);

        return $locale;
    }
597447
@Override
    public Enumeration<Locale> getLocales() {
        ServletRESTRequestImpl ret = castRequest();
        if (ret != null)
            return ret.getLocales();
        return null;
    }
259369
public CLDR.Locale resolve(java.util.Locale javaLocale) {
    MetaLocale meta = MetaLocale.fromJavaLocale(javaLocale);
    return resolve(meta);
  }
1308006
public InputSource resolveLocalEntity(String systemID) throws SAXException, IOException {
        String localFileName = systemID;
        int fileNameStart = localFileName.lastIndexOf('/') + 1;
        if (fileNameStart < localFileName.length()) {
            localFileName = systemID.substring(fileNameStart);
        }
        ClassLoader cl = LocalFileEntityResolver.class.getClassLoader();
        InputStream stream = cl.getResourceAsStream(RESORUCE_PATH_PREFIX + localFileName);
        if (stream != null) {
            return new InputSource(stream);
        }
        return null;
    }
46149
protected LocaleResolver resolveLocale() {
        LocaleResolver localeResolver = null;
        String localeResolverBeanId = getSetting(RequestRule.LOCALE_RESOLVER_SETTING_NAME);
        if (localeResolverBeanId != null) {
            localeResolver = getBean(localeResolverBeanId, LocaleResolver.class);
            localeResolver.resolveLocale(getTranslet());
            localeResolver.resolveTimeZone(getTranslet());
        }
        return localeResolver;
    }
147074
private void initLocaleSelect() {

        if (m_availableLocales.size() < 2) {
            return;
        }
        Map<String, String> selectOptions = new HashMap<String, String>();
        for (Entry<String, String> localeEntry : m_availableLocales.entrySet()) {
            if (m_contentLocales.contains(localeEntry.getKey())) {
                selectOptions.put(localeEntry.getKey(), localeEntry.getValue());
            } else {
                selectOptions.put(localeEntry.getKey(), localeEntry.getValue() + " [-]");
            }
        }
        if (m_localeSelect == null) {
            m_localeSelect = new CmsSelectBox(selectOptions);
            m_toolbar.insertRight(m_localeSelect, 1);
            m_localeSelect.addStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().inlineBlock());
            m_localeSelect.getElement().getStyle().setWidth(100, Unit.PX);
            m_localeSelect.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
            m_localeSelect.addValueChangeHandler(new ValueChangeHandler<String>() {

                public void onValueChange(ValueChangeEvent<String> event) {

                    switchLocale(event.getValue());
                }
            });
        } else {
            m_localeSelect.setItems(selectOptions);
        }
        m_localeSelect.setFormValueAsString(m_locale);
        if (m_deleteLocaleButton == null) {
            m_deleteLocaleButton = createButton(
                Messages.get().key(Messages.GUI_TOOLBAR_DELETE_LOCALE_0),
                "opencms-icon-remove-locale");
            m_deleteLocaleButton.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent event) {

                    confirmDeleteLocale();
                }
            });
            m_toolbar.insertRight(m_deleteLocaleButton, 2);
        }
        if (m_contentLocales.size() > 1) {
            m_deleteLocaleButton.enable();
        } else {
            m_deleteLocaleButton.disable(Messages.get().key(Messages.GUI_TOOLBAR_CANT_DELETE_LAST_LOCALE_0));
        }
        if (m_copyLocaleButton == null) {
            m_copyLocaleButton = createButton(
                I_CmsButton.ButtonData.COPY_LOCALE_BUTTON.getTitle(),
                I_CmsButton.ButtonData.COPY_LOCALE_BUTTON.getIconClass());
            m_copyLocaleButton.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent event) {

                    openCopyLocaleDialog();
                }
            });
            m_toolbar.insertRight(m_copyLocaleButton, 3);
        }
    }
116786
public static void setLocale(ProjectProperties properties, Locale locale)
   {
      properties.setMpxDelimiter(LocaleData.getChar(locale, LocaleData.FILE_DELIMITER));
      properties.setMpxProgramName(LocaleData.getString(locale, LocaleData.PROGRAM_NAME));
      properties.setMpxCodePage((CodePage) LocaleData.getObject(locale, LocaleData.CODE_PAGE));

      properties.setCurrencySymbol(LocaleData.getString(locale, LocaleData.CURRENCY_SYMBOL));
      properties.setSymbolPosition((CurrencySymbolPosition) LocaleData.getObject(locale, LocaleData.CURRENCY_SYMBOL_POSITION));
      properties.setCurrencyDigits(LocaleData.getInteger(locale, LocaleData.CURRENCY_DIGITS));
      properties.setThousandsSeparator(LocaleData.getChar(locale, LocaleData.CURRENCY_THOUSANDS_SEPARATOR));
      properties.setDecimalSeparator(LocaleData.getChar(locale, LocaleData.CURRENCY_DECIMAL_SEPARATOR));

      properties.setDateOrder((DateOrder) LocaleData.getObject(locale, LocaleData.DATE_ORDER));
      properties.setTimeFormat((ProjectTimeFormat) LocaleData.getObject(locale, LocaleData.TIME_FORMAT));
      properties.setDefaultStartTime(DateHelper.getTimeFromMinutesPastMidnight(LocaleData.getInteger(locale, LocaleData.DEFAULT_START_TIME)));
      properties.setDateSeparator(LocaleData.getChar(locale, LocaleData.DATE_SEPARATOR));
      properties.setTimeSeparator(LocaleData.getChar(locale, LocaleData.TIME_SEPARATOR));
      properties.setAMText(LocaleData.getString(locale, LocaleData.AM_TEXT));
      properties.setPMText(LocaleData.getString(locale, LocaleData.PM_TEXT));
      properties.setDateFormat((ProjectDateFormat) LocaleData.getObject(locale, LocaleData.DATE_FORMAT));
      properties.setBarTextDateFormat((ProjectDateFormat) LocaleData.getObject(locale, LocaleData.DATE_FORMAT));
   }
473604
private Locale getLocale(FacesContext context) {

        // PENDING(craigmcc) - JSTL localization context?
        Locale locale = this.locale;
        if (locale == null) {
            locale = context.getViewRoot().getLocale();
        }
        return (locale);

    }
450709
Locale getLocale(HandshakeRequest request) {
		if(null != request) {
			Map<String, List<String>> headers = request.getHeaders();
			if(null != headers) {
				List<String> accepts = headers.get(HttpHeaders.ACCEPT_LANGUAGE);
				logger.debug("Get accept-language from client headers : {}", accepts);
				if (null != accepts) {
					for (String accept : accepts) {
						try {
							return localeExtractor.extractFromAccept(accept);
						} catch (LocaleNotFoundException ex) {
						}
					}
				}
			}
		}
		return Locale.US;
	}
249352
public void addLocale(String locale) {

        m_searchObject.setLocale(locale);
        m_searchObjectChanged = true;
        ValueChangeEvent.fire(this, m_searchObject);
    }
1223612
protected void setLocale( Locale locale )
    {
        if ( locale == null ) locale = getDefaultLocale();
        getSession().setAttribute( Globals.LOCALE_KEY, locale );
    }
1217389
@GET
    @Path("/{localeCode}")
    @Produces(MediaType.APPLICATION_JSON)
    @RequiresPermissions(I18nPermissions.LOCALE_READ)
    public Response getSupportedLocale(@PathParam("localeCode") String localeCode) {
        WebAssertions.assertNotNull(localeCode, "The locale should not be null");
        LocaleRepresentation locale = supportedLocaleFinder.findSupportedLocale(localeCode);
        if (locale != null) {
			return Response.ok(locale).build();
		}
        return Response.status(Response.Status.NOT_FOUND).build();
    }
56782
protected Locale getLocale( HttpServletRequest request )
    {

        HttpSession session = request.getSession();
        Locale locale = ( Locale ) session.getAttribute( Globals.LOCALE_KEY );
        return locale != null ? locale : DEFAULT_LOCALE;
    }
966716
static function fetchByHttpLocaleCode( $httpLocaleCode )
    {
        $locales = self::localeList( true );
        foreach ( $locales as $locale )
        {
            if ( $locale->httpLocaleCode() == $httpLocaleCode )
                return $locale;
        }

        return false;
    }
740250
protected String getMessageInternal(Locale locale, String code, Object[] args) {
		if(code == null) {
			return null;
		}

		if(locale == null) {
			locale = I18nUtils.getLocale();
		}

		final MessageFormat messageFormat = resolveMessageFormat(locale, code);
		if(messageFormat != null) {
			synchronized(messageFormat) {
				return messageFormat.format(args);
			}
		}

		return null;
	}