Ejemplo n.º 1
0
  /**
   * Returns a language string by property key.
   *
   * @param property The property key
   * @return The language string
   */
  public static String get(String property) {
    if (last == null) {
      // We are keeping a reference to the current language
      // to reduce lookup time (searching the map).
      last = languages.get(language);
    }

    if (last != null) {
      String msg = last.getMessage(property);
      if (msg != null) return msg;
    }

    LanguageEntry fallback = languages.get(DEFAULT);
    if (fallback != null) {
      String str = fallback.getMessage(property);
      if (str != null) return str;
    }

    return "{" + property + "}";
  }