<rich:calendar> Locale.US(翻译为捷克语)</rich:calendar>

时间:2011-05-16 07:13:28

标签: java jsf richfaces

有没有办法将富日历翻译成Locale.XX

不支持的语言

感谢您的帮助

UPDATE:我的日历bean的一部分

@RequestScoped
@ManagedBean(name="calendarBean")
public class CalendarBean implements Serializable
{    
  /**/
  private static final long serialVersionUID = -219499296173801537L; 
  private Locale locale;    
  private String pattern;  
  private Date currentDate;  
  private Date selectedDate;  

  public Locale getLocale() {  
    return locale;  
  }  
  public void setLocale(Locale locale) {  
    this.locale = locale;  
  }  
  public String getPattern() {  
    return pattern;  
  }  
  public void setPattern(String pattern) {  
    this.pattern = pattern;  
  }  

  /* Constructor */
  public CalendarBean() {  
    locale = Locale.US;  
    pattern = "MMM d, yyyy";  
  }  

  public void selectLocale(ValueChangeEvent event) {  
    String tLocale = (String) event.getNewValue();  
    if (tLocale != null) 
    {  
      String lang = tLocale.substring(0, 2);  
      String country = tLocale.substring(3);  
      locale = new Locale(lang, country, "");  
    }  
  }  

  public Date getCurrentDate() {  
    return currentDate;  
  }  
  public void setCurrentDate(Date currentDate) {  
    this.currentDate = currentDate;  
  }  
  public Date getSelectedDate() {  
    return selectedDate;  
  }  
  public void setSelectedDate(Date selectedDate) {  
    this.selectedDate = selectedDate;  
  }  
}  

更新:(富:日历)EXAMPLE ON WEB

<rich:calendar mode="ajax" 
               boundaryDatesMode="scroll" 
               value="#{myBdeCheck.calendar.selectedDate}"  
               locale="#{calendarBean.locale}"  
               datePattern="#{calendarBean.pattern}"                        
               cellWidth="24px" cellHeight="22px" style="width:200px"/>

1 个答案:

答案 0 :(得分:1)

一般来说,语言环境不受限制。只需使用构造函数new Locale("your language")

对于日历 - 它具有每个i18nable项的属性,因此您可以在那里使用#{msg.foo}

documentation写道:

  

该组件允许使用“header”,“footer”,“optionalHeader”,“optionalFooter”方面。这些方面提供了以下元素:{currentMonthControl},{nextMonthControl},{nextYearControl},{previousYearControl},{previousMonthControl},{todayControl},{selectedDateControl}。这些元素可用于标签输出。