Package hirondelle.web4j.ui.translate

Examples of hirondelle.web4j.ui.translate.Translator


   The <tt>aLocale</tt> parameter is always required, even though there are cases when it
   is not actually used to render the result.
  */
  public String getMessage(Locale aLocale, TimeZone aTimeZone){
    String result = null;
    Translator translator = BuildImpl.forTranslator();
    Formats formats = new Formats(aLocale, aTimeZone);
    if( fParams.isEmpty() ){
      result = translator.get(fText, aLocale);
    }
    else {
      String localizedPattern = translator.get(fText, aLocale);
      List<String> formattedParams = new ArrayList<String>();
      for (Object param : fParams){
        if ( param instanceof RequestParameter ){
          RequestParameter reqParam = (RequestParameter)param;
          String translatedParamName = translator.get(reqParam.getName(), aLocale);
          formattedParams.add( translatedParamName );
        }
        else {
          //this will escape any special HTML chars in params :
          formattedParams.add( formats.objectToTextForReport(param).toString() );
View Full Code Here


    else if(fDateFormat != null && fDateFormatKey == null){
      adjustForTimeZone(fDateFormat, timeZone);
      result = fDateFormat.format(fDate);
    }
    else if(fDateFormat == null && fDateFormatKey != null){
      Translator translator = BuildImpl.forTranslator();
      String localPattern = translator.get(fDateFormatKey, locale);
      DateFormat localDateFormat = new SimpleDateFormat(localPattern, locale);
      adjustForTimeZone(localDateFormat, timeZone);
      result = localDateFormat.format(fDate);
    }
    else {
View Full Code Here

    }
    else if(fFormat != null && fFormatKey == null){
      result = fDateTime.format(fFormat, getLocale());
    }
    else if(fFormat == null && fFormatKey != null){
      Translator translator = BuildImpl.forTranslator();
      String localPattern = translator.get(fFormatKey, locale);
      result = fDateTime.format(localPattern, locale);
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of hirondelle.web4j.ui.translate.Translator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.