org.springframework.context.support.MessageSourceAccessor.getDefaultLocale()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(62)

本文整理了Java中org.springframework.context.support.MessageSourceAccessor.getDefaultLocale()方法的一些代码示例,展示了MessageSourceAccessor.getDefaultLocale()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MessageSourceAccessor.getDefaultLocale()方法的具体详情如下:
包路径:org.springframework.context.support.MessageSourceAccessor
类名称:MessageSourceAccessor
方法名:getDefaultLocale

MessageSourceAccessor.getDefaultLocale介绍

[英]Return the default locale to use if no explicit locale has been given.

The default implementation returns the default locale passed into the corresponding constructor, or LocaleContextHolder's locale as fallback. Can be overridden in subclasses.
[中]如果没有给出明确的语言环境,则返回要使用的默认语言环境。
默认实现返回传递到相应构造函数的默认语言环境,或LocaleContextHolder的语言环境作为回退。可以在子类中重写。

代码示例

代码示例来源:origin: spring-projects/spring-framework

/**
 * Retrieve the message for the given code and the default Locale.
 * @param code code of the message
 * @return the message
 * @throws org.springframework.context.NoSuchMessageException if not found
 */
public String getMessage(String code) throws NoSuchMessageException {
  return this.messageSource.getMessage(code, null, getDefaultLocale());
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Retrieve the given MessageSourceResolvable (e.g. an ObjectError instance)
 * in the default Locale.
 * @param resolvable the MessageSourceResolvable
 * @return the message
 * @throws org.springframework.context.NoSuchMessageException if not found
 */
public String getMessage(MessageSourceResolvable resolvable) throws NoSuchMessageException {
  return this.messageSource.getMessage(resolvable, getDefaultLocale());
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Retrieve the message for the given code and the default Locale.
 * @param code code of the message
 * @param defaultMessage the String to return if the lookup fails
 * @return the message
 */
public String getMessage(String code, String defaultMessage) {
  String msg = this.messageSource.getMessage(code, null, defaultMessage, getDefaultLocale());
  return (msg != null ? msg : "");
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Retrieve the message for the given code and the default Locale.
 * @param code code of the message
 * @param args arguments for the message, or {@code null} if none
 * @return the message
 * @throws org.springframework.context.NoSuchMessageException if not found
 */
public String getMessage(String code, @Nullable Object[] args) throws NoSuchMessageException {
  return this.messageSource.getMessage(code, args, getDefaultLocale());
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Retrieve the message for the given code and the default Locale.
 * @param code code of the message
 * @param args arguments for the message, or {@code null} if none
 * @param defaultMessage the String to return if the lookup fails
 * @return the message
 */
public String getMessage(String code, @Nullable Object[] args, String defaultMessage) {
  String msg = this.messageSource.getMessage(code, args, defaultMessage, getDefaultLocale());
  return (msg != null ? msg : "");
}

代码示例来源:origin: org.springframework/spring-context

/**
 * Retrieve the message for the given code and the default Locale.
 * @param code code of the message
 * @param defaultMessage the String to return if the lookup fails
 * @return the message
 */
public String getMessage(String code, String defaultMessage) {
  String msg = this.messageSource.getMessage(code, null, defaultMessage, getDefaultLocale());
  return (msg != null ? msg : "");
}

代码示例来源:origin: org.springframework/spring-context

/**
 * Retrieve the message for the given code and the default Locale.
 * @param code code of the message
 * @return the message
 * @throws org.springframework.context.NoSuchMessageException if not found
 */
public String getMessage(String code) throws NoSuchMessageException {
  return this.messageSource.getMessage(code, null, getDefaultLocale());
}

代码示例来源:origin: org.springframework/spring-context

/**
 * Retrieve the given MessageSourceResolvable (e.g. an ObjectError instance)
 * in the default Locale.
 * @param resolvable the MessageSourceResolvable
 * @return the message
 * @throws org.springframework.context.NoSuchMessageException if not found
 */
public String getMessage(MessageSourceResolvable resolvable) throws NoSuchMessageException {
  return this.messageSource.getMessage(resolvable, getDefaultLocale());
}

代码示例来源:origin: org.springframework/spring-context

/**
 * Retrieve the message for the given code and the default Locale.
 * @param code code of the message
 * @param args arguments for the message, or {@code null} if none
 * @param defaultMessage the String to return if the lookup fails
 * @return the message
 */
public String getMessage(String code, @Nullable Object[] args, String defaultMessage) {
  String msg = this.messageSource.getMessage(code, args, defaultMessage, getDefaultLocale());
  return (msg != null ? msg : "");
}

代码示例来源:origin: org.springframework/spring-context

/**
 * Retrieve the message for the given code and the default Locale.
 * @param code code of the message
 * @param args arguments for the message, or {@code null} if none
 * @return the message
 * @throws org.springframework.context.NoSuchMessageException if not found
 */
public String getMessage(String code, @Nullable Object[] args) throws NoSuchMessageException {
  return this.messageSource.getMessage(code, args, getDefaultLocale());
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Retrieve the message for the given code and the default Locale.
 * @param code code of the message
 * @param defaultMessage the String to return if the lookup fails
 * @return the message
 */
public String getMessage(String code, String defaultMessage) {
  String msg = this.messageSource.getMessage(code, null, defaultMessage, getDefaultLocale());
  return (msg != null ? msg : "");
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Retrieve the message for the given code and the default Locale.
 * @param code code of the message
 * @return the message
 * @throws org.springframework.context.NoSuchMessageException if not found
 */
public String getMessage(String code) throws NoSuchMessageException {
  return this.messageSource.getMessage(code, null, getDefaultLocale());
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Retrieve the given MessageSourceResolvable (e.g. an ObjectError instance)
 * in the default Locale.
 * @param resolvable the MessageSourceResolvable
 * @return the message
 * @throws org.springframework.context.NoSuchMessageException if not found
 */
public String getMessage(MessageSourceResolvable resolvable) throws NoSuchMessageException {
  return this.messageSource.getMessage(resolvable, getDefaultLocale());
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Retrieve the message for the given code and the default Locale.
 * @param code code of the message
 * @param args arguments for the message, or {@code null} if none
 * @param defaultMessage the String to return if the lookup fails
 * @return the message
 */
public String getMessage(String code, @Nullable Object[] args, String defaultMessage) {
  String msg = this.messageSource.getMessage(code, args, defaultMessage, getDefaultLocale());
  return (msg != null ? msg : "");
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Retrieve the message for the given code and the default Locale.
 * @param code code of the message
 * @param args arguments for the message, or {@code null} if none
 * @return the message
 * @throws org.springframework.context.NoSuchMessageException if not found
 */
public String getMessage(String code, @Nullable Object[] args) throws NoSuchMessageException {
  return this.messageSource.getMessage(code, args, getDefaultLocale());
}

相关文章

微信公众号

最新文章

更多