package com.fp.frontend.utility;

import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class MsgControlArmas {

    private static final String BUNDLE_NAME = "controlarmas_es";

    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);

    private MsgControlArmas() {
    }

    public static String getProperty(String key) {
        try {
            return RESOURCE_BUNDLE.getString(key);
        } catch (MissingResourceException e) {
            return "Archivo:" + BUNDLE_NAME + " no encontrado";
        } catch (Throwable e) {
            return null;
        }
    }

    public static String getProperty(String pKey, Object... pParameters) {
        try {
            String msg = null;
            try {
                msg = RESOURCE_BUNDLE.getString(pKey);
            } catch (Exception e) {

            }
            if (msg == null) {
                msg = pKey;
            }
            return MessageFormat.format(msg, pParameters);
        } catch (Throwable e) {
            return null;
        }
    }
}
