src/main/java/pityoulish/i18n/CatalogHelper.java
public static final String lookup(TextRef tref)
  {
    if (tref == null)
       throw new NullPointerException("TextRef");

    String result = null;
    try {
      ResourceBundle bundle = getBundle(tref);
      result = bundle.getString(tref.getKey());

    } catch (MissingResourceException mre) {
      // the lookup failed, provide a fallback
      result = tref.getBundleName()+"::"+tref.getKey();
    }
    // ClassCastException from bundle.getString intentionally not handled here,
    // because TextRef should always refer to a text

    return result;
  }
/**
   * Looks up a text in the default locale.
   *
   * @param tref        the text reference look up
   *
   * @return the text, or a fallback if the lookup failed
   */
Looks up a text in the default locale.
@param tref        the text reference look up

@return the text, or a fallback if the lookup failed
Looks up a text in the default locale . @param tref the text reference look up @return the text or a fallback if the lookup failed
public static final String lookup(TextRef tref)
  {
    if (tref == null)
       throw new NullPointerException("TextRef");
    String result = null;
    try {
      ResourceBundle bundle = getBundle(tref);
      result = bundle.getString(tref.getKey());
    } catch (MissingResourceException mre) {
      result = tref.getBundleName()+"::"+tref.getKey();
    }
    return result;
  }
public static final String lookup ( TextRef tref ) { if ( tref == null ) throw new NullPointerException ( "TextRef" ) ; String result = null ; try { ResourceBundle bundle = getBundle ( tref ) ; result = bundle . getString ( tref . getKey ( ) ) ; } catch ( MissingResourceException mre ) { result = tref . getBundleName ( ) + "::" + tref . getKey ( ) ; } return result ; }
Looks up a text in the default locale.
Looks up a text in the default locale .
// the lookup failed, provide a fallback // ClassCastException from bundle.getString intentionally not handled here, // because TextRef should always refer to a text