Example usage for java.util ResourceBundle getBundle

List of usage examples for java.util ResourceBundle getBundle

Introduction

In this page you can find the example usage for java.util ResourceBundle getBundle.

Prototype

@CallerSensitive
public static ResourceBundle getBundle(String baseName, Module module) 

Source Link

Document

Gets a resource bundle using the specified base name and the default locale on behalf of the specified module.

Usage

From source file:es.pode.empaquetador.presentacion.basico.organizacion.RenombrarOrganizacionBasicoControllerImpl.java

/**
 * @see es.pode.empaquetador.presentacion.basico.organizacion.RenombrarOrganizacionBasicoController#submit(org.apache.struts.action.ActionMapping, es.pode.empaquetador.presentacion.basico.organizacion.SubmitForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *//* w  w  w .jav  a2s  .com*/
public final void submit(ActionMapping mapping,
        es.pode.empaquetador.presentacion.basico.organizacion.SubmitForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    String action = form.getAction();
    String title = form.getTitle();

    ResourceBundle i18n = ResourceBundle.getBundle("application-resources",
            (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE));
    if (i18n.getString("gestor_basico.renombrar.organizacion.aceptar").equals(action)) {
        if (logger.isDebugEnabled())
            logger.debug("Aceptar pulsado en renombrar organizacion");
        if (title == null || "".equals(title.trim())) {
            throw new ValidatorException("{presentacion.basico.organizacion.not.null}");
        }
        OrganizacionVO orgPrincipal = buscarOrganizacionPrincipal(
                this.getEmpaquetadorSession(request).getOde());
        orgPrincipal.setTitle(title);
        if (logger.isDebugEnabled())
            logger.debug("Llamando a modificar organizacion con parametros identificador = "
                    + this.getEmpaquetadorSession(request).getIdLocalizador() + " : organizacion = "
                    + orgPrincipal);
        try {
            this.getSrvGestorManifestService().modificarOrganizacion(
                    this.getEmpaquetadorSession(request).getIdLocalizador(), orgPrincipal);
        } catch (Exception e) {
            logger.error(e);
            throw new ValidatorException("{gestor_basico.renombrar.organizacion.error}");
        }
    }

}

From source file:es.pode.empaquetador.presentacion.avanzado.organizaciones.elementos.secuencia.SecuenciaControllerImpl.java

public final java.lang.String selectAction(ActionMapping mapping,
        es.pode.empaquetador.presentacion.avanzado.organizaciones.elementos.secuencia.SelectActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    String result = null;/*from   w  ww .j av  a  2  s .c om*/
    String actionSubmit = form.getAction();
    java.util.Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE);
    ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale);

    if (form.getAction() == (null)) {
        throw new ValidatorException("{portal_empaquetado.exception}");
    }

    else if (actionSubmit.equals(i18n.getString("portal_empaquetado_secuencia.cancelar"))) {
        result = "Cancelar";
    } else if (actionSubmit.equals(i18n.getString("portal_empaquetado_secuencia.aceptar"))) {
        result = "aceptar";
    } else if (actionSubmit.equals(i18n.getString("secuencia.valorPorDefecto"))) {
        result = "default";
    }

    Logger.getLogger(this.getClass())
            .error("El valor del submit no es correcto (actionSubmit = " + actionSubmit + ";");

    return result;
}

From source file:es.pode.empaquetador.presentacion.avanzado.submanifiestos.gestor.GestorSubmanifiestosControllerImpl.java

/**
 * @see es.pode.empaquetador.presentacion.avanzado.submanifiestos.gestor.GestorSubmanifiestosController#submit(org.apache.struts.action.ActionMapping,
 *      es.pode.empaquetador.presentacion.avanzado.submanifiestos.gestor.SubmitForm,
 *      javax.servlet.http.HttpServletRequest,
 *      javax.servlet.http.HttpServletResponse)
 */// ww  w  .  ja va 2  s.c  om
public final void submit(ActionMapping mapping,
        es.pode.empaquetador.presentacion.avanzado.submanifiestos.gestor.SubmitForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

    java.util.Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE);
    ResourceBundle i18n = ResourceBundle.getBundle(APPLICATION_RESOURCES, locale);

    String accion = form.getAction();
    if ((accion.equals(i18n.getString(ELIMINAR))) || (accion.equals(i18n.getString(DESAGREGAR)))) {
        if (form.getIdentifierRowSelection() != null && form.getIdentifierRowSelection().size() > 0) {
            form.setIdentificadores(form.getIdentifierRowSelection());
        } else {
            throw new ValidatorException("{exportar.subirArchivo}");
        }
    }
}

From source file:no.met.jtimeseries.MeteogramWrapper.java

public MeteogramWrapper(String language) {

    locale = new Locale(language);
    messages = ResourceBundle.getBundle("messages", locale);

}

From source file:com.sun.socialsite.util.TextUtil.java

private static ResourceBundle getCustomBundle(Locale locale) {
    return ResourceBundle.getBundle(CUSTOM_BUNDLE_NAME, locale);
}

From source file:org.adamkrajcik.gui.MainForm.java

public MainForm() {

    DataSource bds = new EmbeddedDatabaseBuilder().setType(DERBY).addScript("classpath:createTables.sql")
            .addScript("classpath:testData.sql").build();
    dataSource = bds;//  www .java2  s. com

    /*config = ResourceBundle.getBundle("org/adamkrajcik/gui/resources/config");
            
     BasicDataSource bds = new BasicDataSource();
     bds.setUrl(config.getString("url"));
     bds.setUsername(config.getString("user"));
     bds.setPassword(config.getString("password"));
     bds.setDriverClassName("org.apache.derby.jdbc.ClientDriver");
     dataSource = bds;
    */

    try {
        langResource = ResourceBundle.getBundle("org/adamkrajcik/gui/resources/lang", getLocale());
    } catch (Exception ex) {
        langResource = ResourceBundle.getBundle("org/adamkrajcik/gui/resources/lang");
        log.debug("Error local language bundle doesnt exist.", ex);
        JOptionPane.showMessageDialog(rootPane,
                "This application isn't yet translated to your language. Default language was set. ", "Warning",
                JOptionPane.WARNING_MESSAGE);
    }

    WineManagerImpl wmi = new WineManagerImpl();
    wmi.setDataSource(dataSource);
    wineManager = wmi;

    CellarManagerImpl cmi = new CellarManagerImpl();
    cmi.setDataSource(dataSource);
    cellarManager = cmi;

    WineCellarsManagerImpl wcmi = new WineCellarsManagerImpl();
    wcmi.setDataSource(dataSource);
    wineCellarManager = wcmi;

    wineTableModel = new WineTableModel(wineManager, wineCellarManager, langResource);
    cellarTableModel = new CellarTableModel(cellarManager, wineCellarManager, langResource);

    new LoadAllCellarsSwingWorker().execute();
    new LoadAllWinesSwingWorker().execute();

    initComponents();
    wineFilterPanel.setVisible(false);
    WineTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
}

From source file:io.github.swagger2markup.internal.document.builder.PathsDocumentBuilder.java

public PathsDocumentBuilder(Swagger2MarkupConverter.Context globalContext,
        Swagger2MarkupExtensionRegistry extensionRegistry, java.nio.file.Path outputPath) {
    super(globalContext, extensionRegistry, outputPath);

    ResourceBundle labels = ResourceBundle.getBundle("io/github/swagger2markup/lang/labels",
            config.getOutputLanguage().toLocale());
    RESPONSE = labels.getString("response");
    REQUEST = labels.getString("request");
    PATHS = labels.getString("paths");
    RESOURCES = labels.getString("resources");
    PARAMETERS = labels.getString("parameters");
    BODY_PARAMETER = labels.getString("body_parameter");
    RESPONSES = labels.getString("responses");
    HEADERS_COLUMN = labels.getString("headers_column");
    EXAMPLE_REQUEST = labels.getString("example_request");
    EXAMPLE_RESPONSE = labels.getString("example_response");
    SECURITY = labels.getString("security");
    TYPE_COLUMN = labels.getString("type_column");
    HTTP_CODE_COLUMN = labels.getString("http_code_column");
    DEPRECATED_OPERATION = labels.getString("operation.deprecated");
    UNKNOWN = labels.getString("unknown");

    if (config.isGeneratedExamplesEnabled()) {
        if (logger.isDebugEnabled()) {
            logger.debug("Include examples is enabled.");
        }/*  w  ww .  j a  v  a2 s.  co m*/
    } else {
        if (logger.isDebugEnabled()) {
            logger.debug("Include examples is disabled.");
        }
    }

    if (config.isSeparatedOperationsEnabled()) {
        if (logger.isDebugEnabled()) {
            logger.debug("Create separated operation files is enabled.");
        }
        Validate.notNull(outputPath, "Output directory is required for separated operation files!");
    } else {
        if (logger.isDebugEnabled()) {
            logger.debug("Create separated operation files is disabled.");
        }
    }
}

From source file:py.una.pol.karaku.util.I18nHelper.java

protected synchronized void initializeBundles(List<String> bundlesLocation) {

    notNull(bundlesLocation, "Can't initialize bundles without bundles paths");

    bundles = new ArrayList<ResourceBundle>(bundlesLocation.size());
    for (String bundle : bundlesLocation) {
        if ("".equals(bundle)) {
            continue;
        }//from   ww  w. j a  va  2 s  . c  o  m
        ResourceBundle toAdd = ResourceBundle.getBundle(bundle, getLocale());
        bundles.add(toAdd);
    }
}

From source file:es.pode.empaquetador.presentacion.avanzado.organizaciones.crear.CrearOrganizacionControllerImpl.java

public final void submit(ActionMapping mapping,
        es.pode.empaquetador.presentacion.avanzado.organizaciones.crear.SubmitForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    CrearOrganizacionSession sesOrga = this.getCrearOrganizacionSession(request);

    String titulo = form.getTitle();
    titulo = titulo.trim();/*w  w  w  . j  a va2  s.c om*/
    java.util.Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE);
    ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale);
    String action = form.getAction();
    if (action.equals(i18n.getString("portal_empaquetado_crearOrganizaciones.aceptar"))) {
        if ((titulo == null) || (titulo.equals(""))) {
            throw new ValidatorException("{portal_empaquetado.exception}");
        }

    }
    sesOrga.setTitle(titulo);
}

From source file:es.pode.empaquetador.presentacion.basico.gestor.GestorBasicoControllerImpl.java

/**
 * @see es.pode.empaquetador.presentacion.basico.gestor.GestorBasicoController#submit(org.apache.struts.action.ActionMapping,
 *      es.pode.empaquetador.presentacion.basico.gestor.SubmitForm,
 *      javax.servlet.http.HttpServletRequest,
 *      javax.servlet.http.HttpServletResponse)
 *//*from  w ww  .  j av a  2s  . c om*/
public final void submit(ActionMapping mapping, es.pode.empaquetador.presentacion.basico.gestor.SubmitForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    EmpaquetadorSession sesEmpaq = this.getEmpaquetadorSession(request);
    List identificadores = form.getIdentifierRowSelection();
    java.util.Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE);
    ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale);
    String accion = form.getActionSubmit();
    String combo = form.getActionCombo();
    if ((accion.equals(i18n.getString("gestor_basico.eliminar")))
            || (accion.equals(i18n.getString("gestor_basico.copiar")))
            || (accion.equals(i18n.getString("gestor_basico.cortar")))
            || (accion.equals(i18n.getString("gestor_basico.masAcciones.submit"))
                    && "Desagregar".equals(combo))) {
        if ((identificadores == null) || (identificadores.size() == 0)) {
            if (accion.equals(i18n.getString("gestor_basico.copiar")))
                throw new ValidatorException(
                        "{portalempaquetado.gestorbasico.carpetas.copiar.error.noseleccionado}");
            else if ((accion.equals(i18n.getString("gestor_basico.cortar"))))
                throw new ValidatorException(
                        "{portalempaquetado.gestorbasico.carpetas.cortar.error.noseleccionado}");
            else if ((accion.equals(i18n.getString("gestor_basico.eliminar"))))
                throw new ValidatorException(
                        "{portalempaquetado.gestorbasico.carpetas.eliminar.error.noseleccionado}");
            else if ((accion.equals(i18n.getString("gestor_basico.masAcciones.submit"))
                    && "Desagregar".equals(combo)))
                throw new ValidatorException(
                        "{portalempaquetado.gestorbasico.carpetas.desagregar.error.noseleccionado}");
        } else {
            form.setIdentificadores(identificadores);
        }
    } else if ((accion.equals(i18n.getString("gestor_basico.pegar")))) {
        if ((sesEmpaq.getPortapapeles() == null) || (sesEmpaq.getPortapapeles().size() == 0)) {
            throw new ValidatorException("{portal_empaquetado.exception}");
        }
    }

}