
package de.ivu.elect.jee.faces;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;

@RequestScoped
@Named(Interpolator.COMPONENT_NAME)
public class Interpolator {

  public static final String COMPONENT_NAME = "interpolator";

  @Inject
  Messages messages;

  public String interpolate(String msgKey, Object param) {
    return messages.getMessageForMessageKey(msgKey, param);
  }

  /* Die folgenden Methoden sind notwendig, da EL mit ... Notation in Parametern nicht klar kommt... */
  public String interpolate(String msgKey, Object param1, Object param2) {
    return messages.getMessageForMessageKey(msgKey, param1, param2);
  }

  public String interpolate(String msgKey, Object param1, Object param2, Object param3) {
    return messages.getMessageForMessageKey(msgKey, param1, param2, param3);
  }

  public String interpolate(String msgKey, Object param1, Object param2, Object param3, Object param4) {
    return messages.getMessageForMessageKey(msgKey, param1, param2, param3, param4);
  }

  public String interpolate(String msgKey, Object param1, Object param2, Object param3, Object param4, Object param5) {
    return messages.getMessageForMessageKey(msgKey, param1, param2, param3, param4, param5);
  }

  public String lokalisiereEnumValue(Enum enumValue) {
    return messages.lokalisiere(enumValue);
  }
}
