List of usage examples for java.util ResourceBundle getBundle
@CallerSensitive public static ResourceBundle getBundle(String baseName, Module module)
From source file:es.pode.empaquetador.presentacion.avanzado.recursos.gestor.GestorRecursosControllerImpl.java
public final void submit(ActionMapping mapping, es.pode.empaquetador.presentacion.avanzado.recursos.gestor.SubmitForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { EmpaquetadorSession sesEmpaq = this.getEmpaquetadorSession(request); 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("presentacion.avanzado.recursos.gestor.submit.exportar"))) || (accion.equals(i18n.getString("presentacion.avanzado.recursos.gestor.submit.eliminar")))) { List elementos = form.getIdentifierRowSelection(); if (elementos != null && elementos.size() > 0) { List SubmanifestPath = sesEmpaq.getSubmanifestPath(); OdeVO ultimoElemSubmPath = (OdeVO) SubmanifestPath.get(SubmanifestPath.size() - 1); RecursoVO[] recur = ultimoElemSubmPath.getRecursos(); List recurRecuperados = new ArrayList(); for (int i = 0; i < recur.length; i++) { if (elementos.contains(recur[i].getIdentifier())) { recurRecuperados.add(recur[i]); }// www . j a v a 2 s .co m } form.setRecursosVO(recurRecuperados); } //fin_if (elementos!=null && elementos.size()!=0) else { throw new ValidatorException( "{presentacion.avanzado.recursos.gestor.submit.error.seleccionar.recursos}"); } } }
From source file:io.github.robwin.swagger2markup.builder.document.MarkupDocument.java
MarkupDocument(Swagger2MarkupConfig swagger2MarkupConfig, String outputDirectory) { this.swagger = swagger2MarkupConfig.getSwagger(); this.markupLanguage = swagger2MarkupConfig.getMarkupLanguage(); this.markupDocBuilder = MarkupDocBuilders.documentBuilder(markupLanguage) .withAnchorPrefix(swagger2MarkupConfig.getAnchorPrefix()); this.separatedDefinitionsEnabled = swagger2MarkupConfig.isSeparatedDefinitions(); this.separatedDefinitionsFolder = swagger2MarkupConfig.getSeparatedDefinitionsFolder(); this.definitionsDocument = swagger2MarkupConfig.getDefinitionsDocument(); this.outputDirectory = outputDirectory; this.useInterDocumentCrossReferences = swagger2MarkupConfig.isInterDocumentCrossReferences(); this.interDocumentCrossReferencesPrefix = swagger2MarkupConfig.getInterDocumentCrossReferencesPrefix(); this.propertyOrdering = swagger2MarkupConfig.getPropertyOrdering(); ResourceBundle labels = ResourceBundle.getBundle("lang/labels", swagger2MarkupConfig.getOutputLanguage().toLocale()); DEFAULT_COLUMN = labels.getString("default_column"); EXAMPLE_COLUMN = labels.getString("example_column"); REQUIRED_COLUMN = labels.getString("required_column"); SCHEMA_COLUMN = labels.getString("schema_column"); NAME_COLUMN = labels.getString("name_column"); DESCRIPTION_COLUMN = labels.getString("description_column"); SCOPES_COLUMN = labels.getString("scopes_column"); DESCRIPTION = DESCRIPTION_COLUMN;/*from www . j av a 2s . c o m*/ PRODUCES = labels.getString("produces"); CONSUMES = labels.getString("consumes"); TAGS = labels.getString("tags"); NO_CONTENT = labels.getString("no_content"); }
From source file:org.shredzone.cilla.admin.ListBean.java
/** * Returns a {@link ResourceBundle} to be used for i18n. The locale used depends on * the locale settings of the visiting user. *//*from w ww . j a v a 2 s . c o m*/ private ResourceBundle getResourceBundle() { FacesContext ctx = FacesContext.getCurrentInstance(); Locale loc = ctx.getViewRoot().getLocale(); return ResourceBundle.getBundle(ctx.getApplication().getMessageBundle(), loc); }
From source file:ar.com.fdvs.dj.core.DynamicJasperHelper.java
private final static void registerEntities(DynamicJasperDesign jd, DynamicReport dr, LayoutManager layoutManager) { ColumnRegistrationManager columnRegistrationManager = new ColumnRegistrationManager(jd, dr, layoutManager); columnRegistrationManager.registerEntities(dr.getColumns()); DJGroupRegistrationManager djGroupRegistrationManager = new DJGroupRegistrationManager(jd, dr, layoutManager);//from w ww. j av a 2s .c om djGroupRegistrationManager.registerEntities(dr.getColumnsGroups()); registerPercentageColumnsVariables(jd, dr, layoutManager); registerOtherFields(jd, dr.getFields()); Locale locale = dr.getReportLocale() == null ? Locale.getDefault() : dr.getReportLocale(); if (log.isDebugEnabled()) { log.debug("Requested Locale = " + dr.getReportLocale() + ", Locale to use: " + locale); } ResourceBundle messages = null; if (dr.getResourceBundle() != null) { try { messages = ResourceBundle.getBundle(dr.getResourceBundle(), locale); } catch (MissingResourceException e) { log.warn(e.getMessage() + ", usign default (dj-messages)"); } } if (messages == null) { try { messages = ResourceBundle.getBundle(DJ_RESOURCE_BUNDLE, locale); } catch (MissingResourceException e) { log.warn(e.getMessage() + ", usign default (dj-messages)"); try { messages = ResourceBundle.getBundle(DJ_RESOURCE_BUNDLE, Locale.ENGLISH); //this cannot fail because is included in the DJ jar } catch (MissingResourceException e2) { log.error("Default messajes not found: " + DJ_RESOURCE_BUNDLE + ", " + e2.getMessage(), e2); throw new DJException( "Default messajes file not found: " + DJ_RESOURCE_BUNDLE + "en.properties", e2); } } } jd.getParametersWithValues().put(JRDesignParameter.REPORT_RESOURCE_BUNDLE, messages); jd.getParametersWithValues().put(JRDesignParameter.REPORT_LOCALE, locale); // JRDesignParameter.REPORT_RESOURCE_BUNDLE // report. }
From source file:net.sourceforge.fenixedu.presentationTier.docs.academicAdministrativeOffice.DiplomaSupplement.java
@Override protected void fillReport() { addParameter("bundle", ResourceBundle.getBundle(getBundle(), getLocale())); addParameter("name", StringFormatter.prettyPrint(getDocumentRequest().getPerson().getName().trim())); // Group 1//from w w w . j a v a 2 s .co m fillGroup1(); // Group 2 fillGroup2(); // Group 3 fillGroup3(); // Group 4 fillGroup4(); // Group 5 fillGroup5(); // Group 6 fillGroup6(); // Group 7 fillGroup7(); // Group 8 fillGroup8(); }
From source file:eu.gloriaproject.tools.reservationlist.ReservationListController.java
@RequestMapping(value = "VIEW") public ModelAndView showInit(RenderRequest renderRequest, RenderResponse renderResponse) { log.info("Ejecutando showInit..."); ResourceBundle rb = ResourceBundle.getBundle("Language", renderRequest.getLocale()); ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); String emailUser = themeDisplay.getUser().getEmailAddress(); String passwordUser = themeDisplay.getUser().getPassword(); String experiment = renderRequest.getParameter("experiment"); List<String> experimentsList; try {//from w w w. j a v a 2 s. c o m experimentsList = reservationsService.getAllOnlineExperiments(emailUser, passwordUser); // Set the list of experiments as an attribute Map<String, Object> model = new HashMap<String, Object>(); model.put("experimentsList", experimentsList); model.put("experimentsListSize", experimentsList.size()); return new ModelAndView("reservationslist/view", model); } catch (OnlineExperimentException e) { e.printStackTrace(); return null; } catch (ConnectionException e) { e.printStackTrace(); return null; } catch (ExperimentOperationException e) { e.printStackTrace(); return null; } catch (NoSuchOperationException e) { e.printStackTrace(); return null; } catch (ExperimentParameterException e) { e.printStackTrace(); return null; } catch (ExperimentNotInstantiatedException e) { e.printStackTrace(); return null; } catch (NoSuchReservationException e) { e.printStackTrace(); return null; } catch (NoSuchExperimentException e) { e.printStackTrace(); return null; } }
From source file:net.jawr.web.resource.bundle.locale.message.GrailsMessageBundleScriptCreator.java
public Reader createScript(Charset charset) { // Determine wether this is run-app or run-war style of runtime. boolean warDeployed = ((Boolean) this.servletContext.getAttribute(JawrConstant.GRAILS_WAR_DEPLOYED)) .booleanValue();/* w ww.jav a 2 s. co m*/ // Spring message bundle object, the same used by grails. ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); messageSource.setFallbackToSystemLocale(false); Set<String> allPropertyNames = null; // Read the properties files to find out the available message keys. It is done differently // for run-app or run-war style of runtimes. if (warDeployed) { allPropertyNames = getPropertyNamesFromWar(); if (LOGGER.isDebugEnabled()) LOGGER.debug("found a total of " + allPropertyNames.size() + " distinct message keys."); messageSource.setResourceLoader(new ServletContextResourceLoader(this.servletContext)); messageSource.setBasename(PROPERTIES_DIR + configParam.substring(configParam.lastIndexOf('.') + 1)); } else { ResourceBundle bundle; if (null != locale) bundle = ResourceBundle.getBundle(configParam, locale); else bundle = ResourceBundle.getBundle(configParam); allPropertyNames = new HashSet<String>(); Enumeration<String> keys = bundle.getKeys(); while (keys.hasMoreElements()) allPropertyNames.add(keys.nextElement()); String basename = "file:./" + configParam.replaceAll("\\.", "/"); messageSource.setBasename(basename); } // Pass all messages to a properties file. Properties props = new Properties(); for (Iterator<String> it = allPropertyNames.iterator(); it.hasNext();) { String key = it.next(); if (matchesFilter(key)) { try { // Use the property encoding of the file String msg = new String( messageSource.getMessage(key, new Object[0], locale).getBytes(CHARSET_ISO_8859_1), charset.displayName()); props.put(key, msg); } catch (NoSuchMessageException e) { // This is expected, so it's OK to have an empty catch block. if (LOGGER.isDebugEnabled()) LOGGER.debug("Message key [" + key + "] not found."); } catch (UnsupportedEncodingException e) { LOGGER.warn("Unable to convert value of message bundle associated to key '" + key + "' because the charset is unknown"); } } } return doCreateScript(props); }
From source file:ca.osmcanada.osvuploadr.JPMain.java
/** * Creates new form JPMain//w w w.j a v a 2 s.c o m */ public JPMain(Locale locale) { l = locale; try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { } initComponents(); try { r = ResourceBundle.getBundle("Bundle", l); } catch (Exception ex) { System.out.println(ex.toString()); } SetUILang(); }
From source file:mekhq.gui.FinancesTab.java
@Override public void initTab() { resourceMap = ResourceBundle.getBundle("mekhq.resources.FinancesTab", new EncodeControl()); //$NON-NLS-1$ GridBagConstraints gridBagConstraints; setLayout(new GridBagLayout()); ChartPanel financeAmountPanel = (ChartPanel) createGraphPanel(GraphType.BALANCE_AMOUNT); ChartPanel financeMonthlyPanel = (ChartPanel) createGraphPanel(GraphType.MONTHLY_FINANCES); financeModel = new FinanceTableModel(); financeTable = new JTable(financeModel); financeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); financeTable.addMouseListener(new FinanceTableMouseAdapter(getCampaignGui(), financeTable, financeModel)); financeTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); TableColumn column = null;//from ww w .ja v a2 s . c o m for (int i = 0; i < FinanceTableModel.N_COL; i++) { column = financeTable.getColumnModel().getColumn(i); column.setPreferredWidth(financeModel.getColumnWidth(i)); column.setCellRenderer(financeModel.getRenderer()); } financeTable.setIntercellSpacing(new Dimension(0, 0)); financeTable.setShowGrid(false); loanModel = new LoanTableModel(); loanTable = new JTable(loanModel); loanTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); loanTable.addMouseListener(new LoanTableMouseAdapter(getCampaignGui(), loanTable, loanModel)); loanTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); column = null; for (int i = 0; i < LoanTableModel.N_COL; i++) { column = loanTable.getColumnModel().getColumn(i); column.setPreferredWidth(loanModel.getColumnWidth(i)); column.setCellRenderer(loanModel.getRenderer()); } loanTable.setIntercellSpacing(new Dimension(0, 0)); loanTable.setShowGrid(false); JScrollPane scrollLoanTable = new JScrollPane(loanTable); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; JPanel panBalance = new JPanel(new GridBagLayout()); panBalance.add(new JScrollPane(financeTable), gridBagConstraints); panBalance.setMinimumSize(new java.awt.Dimension(350, 100)); panBalance.setBorder(BorderFactory.createTitledBorder("Balance Sheet")); JPanel panLoan = new JPanel(new GridBagLayout()); panLoan.add(scrollLoanTable, gridBagConstraints); JTabbedPane financeTab = new JTabbedPane(); financeTab.setMinimumSize(new java.awt.Dimension(450, 300)); financeTab.setPreferredSize(new java.awt.Dimension(450, 300)); JSplitPane splitFinances = new JSplitPane(JSplitPane.VERTICAL_SPLIT, panBalance, financeTab); splitFinances.setOneTouchExpandable(true); splitFinances.setContinuousLayout(true); splitFinances.setResizeWeight(1.0); splitFinances.setName("splitFinances"); financeTab.addTab(resourceMap.getString("activeLoans.text"), panLoan); financeTab.addTab(resourceMap.getString("cbillsBalanceTime.text"), financeAmountPanel); financeTab.addTab(resourceMap.getString("monthlyRevenueExpenditures.text"), financeMonthlyPanel); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(splitFinances, gridBagConstraints); JPanel panelFinanceRight = new JPanel(new BorderLayout()); JPanel pnlFinanceBtns = new JPanel(new GridLayout(2, 2)); btnAddFunds = new JButton("Add Funds (GM)"); btnAddFunds.addActionListener(ev -> addFundsActionPerformed()); btnAddFunds.setEnabled(getCampaign().isGM()); pnlFinanceBtns.add(btnAddFunds); JButton btnGetLoan = new JButton("Get Loan"); btnGetLoan.addActionListener(e -> showNewLoanDialog()); pnlFinanceBtns.add(btnGetLoan); btnManageAssets = new JButton("Manage Assets (GM)"); btnManageAssets.addActionListener(e -> manageAssets()); btnManageAssets.setEnabled(getCampaign().isGM()); pnlFinanceBtns.add(btnManageAssets); panelFinanceRight.add(pnlFinanceBtns, BorderLayout.NORTH); areaNetWorth = new JTextArea(); areaNetWorth.setLineWrap(true); areaNetWorth.setWrapStyleWord(true); areaNetWorth.setFont(new Font("Courier New", Font.PLAIN, 12)); areaNetWorth.setText(getCampaign().getFinancialReport()); areaNetWorth.setEditable(false); JScrollPane descriptionScroll = new JScrollPane(areaNetWorth); panelFinanceRight.add(descriptionScroll, BorderLayout.CENTER); areaNetWorth.setCaretPosition(0); descriptionScroll.setMinimumSize(new Dimension(300, 200)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 0.0; gridBagConstraints.weighty = 1.0; add(panelFinanceRight, gridBagConstraints); }
From source file:com.sun.socialsite.util.TextUtil.java
private static ResourceBundle getDefaultBundle(Locale locale) { return ResourceBundle.getBundle(DEFAULT_BUNDLE_NAME, locale); }