/* (non-Javadoc)
@see org.springframework.context.support.AbstractMessageSource#resolveCode(java.lang.String, java.util.Locale)
776311
@Override
    protected MessageFormat resolveCode(String code, Locale locale)
    {
        String ret = null;
        String country = locale.getCountry();
        String language = locale.getLanguage();
        String variant = locale.getVariant();
        logger.debug("Code {} Initial locale {}",code,locale.toString());
        Locale thisLocale = null;
        if (!StringUtils.isEmpty(variant))
        {
            thisLocale = new Locale(language,country,variant);
            Map<String,String> m = m_map.get(thisLocale);
            if (m != null)
            {
                ret = m.get(code);
            }
            logger.debug("tried locale {} result: {}",thisLocale.toString(),ret);

        }
        if (ret == null)
        {
            if (!StringUtils.isEmpty(country))
            {
                thisLocale = new Locale(language,country);
                Map<String,String> m = m_map.get(thisLocale);
                if (m != null)
                {
                    ret = m.get(code);
                }
                logger.debug("tried locale {} result: {}",thisLocale.toString(),ret);
            }
        }
        if (ret == null)
        {
            if (!StringUtils.isEmpty(language))
            {
                thisLocale = new Locale(language);
                Map<String,String> m = m_map.get(thisLocale);
                if (m != null)
                {
                    ret = m.get(code);
                }
                logger.debug("tried locale {} result: {}",thisLocale.toString(),ret);
            }
        }
        if (ret == null)
        {
           thisLocale = Locale.getDefault();
            Map<String,String> m = m_map.get(thisLocale);
            if (m != null)
            {
                ret = m.get(code);
            }
            logger.debug("tried locale {} result: {}",thisLocale.toString(),ret);
        }
        if (ret == null)
        {
            return null;
        }
        return new MessageFormat(ret, locale);
    }
144375
protected MessageFormat resolveCode(String code, Locale locale) {
        MessageFormat result = null;

        if (cachedMilliSecond == 0
                || ((result = cachedMessages.get(new CacheKey(
                        code, locale))) == null)
                || lastQuery + cachedMilliSecond < System.currentTimeMillis()) {
            result = resolveCodeInternal(code, locale);
            cachedMessages.put(new CacheKey(code, locale), result);
        }

        if (result != null)
            return result;

        return resolveCodeInternal(code, locale);
    }
936655
function resolveLanguage ( value ) {
	if ( typeof value === 'string' ) {
		const lang = _.find(langs, ( o ) => { return o.locale.indexOf(value) !== -1; });
		if ( typeof lang !== 'undefined' ) {
			return lang.id;
		}
	}
	return value;
}
619757
public void resolveContentType(FileRequestContext context) {
    String contentType = lookupMimeType(context.file.getName());
    if(contentType != null) {
      context.contentType = contentType;
      if(contentType.equals("text/html")) {
        context.contentType += ";charset=UTF-8";
      }
    }
  }
760921
public RequestContext renderCode(final int code) {
        if (renderer instanceof JsonRenderer) {
            final JsonRenderer r = (JsonRenderer) renderer;

            final JSONObject ret = r.getJSONObject();
            ret.put(Keys.CODE, code);
        }

        return this;
    }
833598
public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException {
        if (!locale.isPresent()) {
            return Optional.absent();
        }

        synchronized (msgBundles) {
            SoyMsgBundle soyMsgBundle = null;
            if (isHotReloadModeOff()) {
                soyMsgBundle = msgBundles.get(locale.get());
            }
            if (soyMsgBundle == null) {
                soyMsgBundle = createSoyMsgBundle(locale.get());
                if (soyMsgBundle == null) {
                    soyMsgBundle = createSoyMsgBundle(new Locale(locale.get().getLanguage()));
                }

                if (soyMsgBundle == null && fallbackToEnglish) {
                    soyMsgBundle = createSoyMsgBundle(Locale.ENGLISH);
                }

                if (soyMsgBundle == null) {
                    return Optional.absent();
                }

                if (isHotReloadModeOff()) {
                    msgBundles.put(locale.get(), soyMsgBundle);
                }
            }

            return Optional.fromNullable(soyMsgBundle);
        }
    }
41813
private void genImportCode(ClassCode code) {
        code.importClass("java.util.*");
        code.importClass("java.io.IOException");
        code.importClass("java.lang.reflect.*");
        code.importClass("com.baidu.bjf.remoting.protobuf.code.*");
        code.importClass("com.baidu.bjf.remoting.protobuf.utils.*");
        code.importClass("com.baidu.bjf.remoting.protobuf.*");
        code.importClass("com.google.protobuf.*");

        if (!StringUtils.isEmpty(getPackage())) {
            code.importClass(ClassHelper.getInternalName(cls.getCanonicalName()));
        }
    }
894371
@Override
    public Locale calculateLocale(FacesContext facesContext)
    {
        Application application = facesContext.getApplication();
        for (Iterator<Locale> requestLocales = facesContext.getExternalContext().getRequestLocales(); requestLocales
                .hasNext();)
        {
            Locale requestLocale = requestLocales.next();
            for (Iterator<Locale> supportedLocales = application.getSupportedLocales(); supportedLocales.hasNext();)
            {
                Locale supportedLocale = supportedLocales.next();
                // higher priority to a language match over an exact match
                // that occurs further down (see JSTL Reference 1.0 8.3.1)
                if (requestLocale.getLanguage().equals(supportedLocale.getLanguage())
                        && (supportedLocale.getCountry() == null || supportedLocale.getCountry().length() == 0))
                {
                    return supportedLocale;
                }
                else if (supportedLocale.equals(requestLocale))
                {
                    return supportedLocale;
                }
            }
        }

        Locale defaultLocale = application.getDefaultLocale();
        return defaultLocale != null ? defaultLocale : Locale.getDefault();
    }
259369
public CLDR.Locale resolve(java.util.Locale javaLocale) {
    MetaLocale meta = MetaLocale.fromJavaLocale(javaLocale);
    return resolve(meta);
  }
840462
@Override
	public void setValue(String value, java.util.Locale locale) {
		_cpDefinitionSpecificationOptionValue.setValue(value, locale);
	}
473604
private Locale getLocale(FacesContext context) {

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

    }
295747
@Override
    public String resolve(MessageResolver messageResolver) {
        MessageResolver.assertThatIsNotNull(messageResolver);

        return messageResolver.resolve(this.code, this.arguments);
    }
970378
public @Nonnull StaticMessageSource addMessage(@Nonnull String code, @Nonnull String message) {
        if (StringUtils.isNotEmpty(code) && StringUtils.isNotEmpty(message)) {
            messageMap.put(new MessageKey(Locale.getDefault(), code), message);
        }
        return this;
    }
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;
	}
263289
@Override
	public void error(final String code) {
		WMessages instance = getWMessageInstance();

		if (instance != null) {
			instance.error(code);
		}
	}
235188
@Override
    public @Nonnull JsonMediaTypeCodec resolveJsonViewCodec(@Nonnull Class<?> viewClass) {
        ArgumentUtils.requireNonNull("viewClass", viewClass);
        JsonMediaTypeCodec codec = jsonViewCodecs.get(viewClass);
        if (codec == null) {

            ObjectMapper viewMapper = objectMapper.copy();
            viewMapper.setConfig(viewMapper.getSerializationConfig().withView(viewClass));
            codec = new JsonMediaTypeCodec(viewMapper, applicationConfiguration, codecConfiguration);
            jsonViewCodecs.put(viewClass, codec);
        }
        return codec;
    }
372223
@Override
    public View resolveView(String viewId, RequestContext context) {
        View view = super.resolveView(viewId, context);
        if (view != null) {
            return view;
        }

        for (final FlowViewResolver flowViewResolver : this.flowViewResolvers) {
            try {
                final String viewIdByConvention = flowViewResolver.getViewIdByConvention(viewId);
                view = flowViewResolver.resolveView(viewIdByConvention, context);
                if (view != null) {
                    return view;
                }
            } catch (Exception e) {
                IllegalStateException ise =
                        new IllegalStateException(
                                "Exception resolving view with name '" + viewId + "'");
                ise.initCause(e);
                throw ise;
            }
        }

        return null;
    }