Example #1
0
 private void processLocaleArray(
     String[] ar, String key, String appName, LanguagePreferences p, StringBuffer sb) {
   for (int i = 0; i < ar.length; i++) {
     sb.setLength(0);
     sb.append(key);
     sb.append(new Integer(i).toString());
     String val = LanguageResourceFinder.getResource(appName, sb.toString(), p);
     if (val != null) ar[i] = val;
   }
 }
Example #2
0
  private void processLocaleInfo() {
    if (_updateLocale) {
      _updateLocale = false;
      LanguagePreferences p = getPage().getLanguagePreferences();
      String appName = getPage().getApplicationName();
      StringBuffer key = new StringBuffer("HtmlCalendar.month.short.0");
      boolean shortOK = (LanguageResourceFinder.getResource(appName, key.toString(), p) != null);
      key.setLength(0);
      key.append("HtmlCalendar.month.long.0");
      boolean longOK = (LanguageResourceFinder.getResource(appName, key.toString(), p) != null);

      if (shortOK) {
        processLocaleArray(_monthShortNames, "HtmlCalendar.month.short.", appName, p, key);
        processLocaleArray(_dayShortNames, "HtmlCalendar.day.short.", appName, p, key);
      }

      if (longOK) {
        processLocaleArray(_monthLongNames, "HtmlCalendar.month.long.", appName, p, key);
        processLocaleArray(_dayLongNames, "HtmlCalendar.day.long.", appName, p, key);
      }
    }
  }