Java Code Examples for java.util.ResourceBundle
The following code examples are extracted from open source projects. You can click to
vote up the examples that are useful to you.
Example 1
From project Arecibo, under directory /agent/src/main/java/com/ning/arecibo/agent/guice/.
Source file: AgentConfig.java

@Config("arecibo.tools.coremonitor.http_user_agent") public String getHTTPUserAgent(){ try { ResourceBundle bundle=ResourceBundle.getBundle("user-agent"); String userAgent=bundle.getString("user_agent"); return userAgent; } catch ( MissingResourceException mrEx) { throw new RuntimeException(mrEx); } }
Example 2
From project ccw, under directory /ccw.core/src/java/ccw/editors/clojure/.
Source file: BasicClojureEditorActionContributor.java

public BasicClojureEditorActionContributor(){ super(); ResourceBundle b=ClojureEditorMessages.getBundleForConstructedKeys(); gotoNextMember=new RetargetTextEditorAction(b,"GotoNextMember_"); gotoNextMember.setActionDefinitionId(IClojureEditorActionDefinitionIds.GOTO_NEXT_MEMBER); gotoPreviousMember=new RetargetTextEditorAction(b,"GotoPreviousMember_"); gotoPreviousMember.setActionDefinitionId(IClojureEditorActionDefinitionIds.GOTO_PREVIOUS_MEMBER); fStatusFields=new HashMap(3); for (int i=0; i < STATUS_FIELD_DEFS.length; i++) { StatusFieldDef fieldDef=STATUS_FIELD_DEFS[i]; fStatusFields.put(fieldDef,new StatusLineContributionItem(fieldDef.category,fieldDef.visible,fieldDef.widthInChars)); } }
Example 3
From project CommunityCase, under directory /src/org/community/intellij/plugins/communitycase/i18n/.
Source file: Bundle.java

private static ResourceBundle getBundle(){ ResourceBundle bundle=null; if (ourBundle != null) bundle=ourBundle.get(); if (bundle == null) { bundle=ResourceBundle.getBundle(BUNDLE); ourBundle=new SoftReference<ResourceBundle>(bundle); } return bundle; }
Example 4
From project core_4, under directory /api/src/main/java/org/richfaces/l10n/.
Source file: MessageInterpolator.java

protected String getPattern(Locale locale,Enum<?> key){ String messageKey=getMessageKey(key); try { ResourceBundle bundle=bundleLoader.getBundle(key,locale); return bundle.getString(messageKey); } catch ( MissingResourceException e) { } return null; }
Example 5
From project cotopaxi-core, under directory /src/main/java/br/octahedron/cotopaxi/i18n/.
Source file: LocaleManager.java

/** * Try to gets the {@link ResourceBundle} with given name and locale. It lookup forname_lang_country and name_lang files at the base folder. * @return The loaded {@link ResourceBundle} or <code>null</code> if unable to load */ private ResourceBundle getResource(String name,Locale lc) throws IOException { String lang=lc.getLanguage(); String country=lc.getCountry(); String filename=this.getBaseName(name) + "_" + lang; ResourceBundle result=null; if (!country.isEmpty()) { result=this.getResourceBundle(filename + "_" + country); } if (result == null) { result=this.getResourceBundle(filename); } return result; }
Example 6
From project data-access, under directory /src/org/pentaho/platform/dataaccess/datasource/wizard/service/messages/.
Source file: Messages.java

private static ResourceBundle getBundle(){ Locale locale=LocaleHelper.getLocale(); ResourceBundle bundle=(ResourceBundle)Messages.locales.get(locale); if (bundle == null) { bundle=ResourceBundle.getBundle(Messages.BUNDLE_NAME,locale); Messages.locales.put(locale,bundle); } return bundle; }
Example 7
From project dawn-isenciaui, under directory /com.teaminabox.eclipse.wiki/src/com/teaminabox/eclipse/wiki/.
Source file: WikiPlugin.java

public static String getResourceString(String key){ ResourceBundle bundle=wikiPlugin().getResourceBundle(); try { return bundle.getString(key); } catch ( MissingResourceException e) { return "!" + key + "!"; } }
Example 8
From project dolphin, under directory /com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/.
Source file: TomcatLauncherPlugin.java

/** * Returns the string from the plugin's resource bundle, or 'key' if not found. */ public static String getResourceString(String key){ ResourceBundle bundle=TomcatLauncherPlugin.getDefault().getResourceBundle(); try { return bundle.getString(key); } catch ( MissingResourceException e) { return key; } }
Example 9
From project dozer, under directory /eclipse-plugin/net.sf.dozer.eclipse.plugin/src/org/dozer/eclipse/plugin/.
Source file: DozerPlugin.java

/** * Returns the string from the plugin's resource bundle, or 'key' if not found. */ public static String getResourceString(String key){ ResourceBundle bundle=DozerPlugin.getDefault().getResourceBundle(); try { return (bundle != null ? bundle.getString(key) : key); } catch ( MissingResourceException e) { return key; } }
Example 10
From project dragon, under directory /hadoop-dragon-core/src/main/java/org/apache/hadoop/realtime/util/.
Source file: ResourceBundles.java

/** * Get a resource given bundle name and key * @param < T > type of the resource * @param bundleName name of the resource bundle * @param key to lookup the resource * @param suffix for the key to lookup * @param defaultValue of the resource * @return the resource or the defaultValue * @throws ClassCastException if the resource found doesn't match T */ @SuppressWarnings("unchecked") public static synchronized <T>T getValue(String bundleName,String key,String suffix,T defaultValue){ T value; try { ResourceBundle bundle=getBundle(bundleName); value=(T)bundle.getObject(getLookupKey(key,suffix)); } catch ( Exception e) { return defaultValue; } return value == null ? defaultValue : value; }
Example 11
From project droolsjbpm-tools, under directory /drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/.
Source file: DroolsEclipsePlugin.java

/** * Returns the string from the plugin's resource bundle, or 'key' if not found. */ public static String getResourceString(String key){ ResourceBundle bundle=DroolsEclipsePlugin.getDefault().getResourceBundle(); try { return (bundle != null) ? bundle.getString(key) : key; } catch ( MissingResourceException e) { return key; } }
Example 12
From project echo2, under directory /src/exampleapp/chatclient/src/java/echo2example/chatclient/.
Source file: Messages.java

/** * Returns localized text. * @param key the key of the text to be returned * @return the appropriate localized text (if the key is not defined, the string "!key!" is returned) */ public static String getString(String key){ try { Locale locale=ApplicationInstance.getActive().getLocale(); ResourceBundle resource=ResourceBundle.getBundle(BUNDLE_NAME,locale); return resource.getString(key); } catch ( MissingResourceException e) { return '!' + key + '!'; } }
Example 13
From project echo3, under directory /src/server-java-examples/chatclient/src/java/chatclient/.
Source file: Messages.java

/** * Returns localized text. * @param key the key of the text to be returned * @return the appropriate localized text (if the key is not defined, the string "!key!" is returned) */ public static String getString(String key){ try { Locale locale=ApplicationInstance.getActive().getLocale(); ResourceBundle resource=ResourceBundle.getBundle(BUNDLE_NAME,locale); return resource.getString(key); } catch ( MissingResourceException e) { return '!' + key + '!'; } }
Example 14
From project eclipse.platform.runtime, under directory /bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/.
Source file: BundleTranslationProvider.java

@Override public String translate(String key,String contributorURI){ Bundle bundle=getBundle(contributorURI); if (bundle == null) return key; BundleLocalization localizationService=ServicesActivator.getDefault().getLocalizationService(); if (localizationService == null) return key; ResourceBundle resourceBundle=localizationService.getLocalization(bundle,locale); return getResourceString(key,resourceBundle); }
Example 15
From project eclipsefp, under directory /net.sf.eclipsefp.haskell.ghccompiler/src/net/sf/eclipsefp/haskell/ghccompiler/ui/preferences/.
Source file: ParamsUITexts.java

private static ResourceBundle initBundle(){ ResourceBundle result=null; try { String name=ParamsUITexts.class.getPackage().getName() + "." + SHORT_DESC; result=ResourceBundle.getBundle(name); } catch ( Exception ex) { log("Could not init resource bundle.",ex); } return result; }
Example 16
From project formic, under directory /src/java/org/formic/util/.
Source file: ResourceBundleAggregate.java

/** * {@inheritDoc} * @see java.util.ResourceBundle#handleGetObject(String) */ protected Object handleGetObject(String _key){ for (int ii=0; ii < bundles.size(); ii++) { ResourceBundle bundle=(ResourceBundle)bundles.get(ii); try { Object obj=bundle.getObject(_key); return obj; } catch ( MissingResourceException mre) { } } return null; }
Example 17
From project gatein-common, under directory /common/src/test/java/org/gatein/common/i18n/.
Source file: ComplexResourceBundleFactoryTestCase.java

public void testNoMatch() throws Exception { Locale.setDefault(new Locale("ja")); ComplexResourceBundleFactory factory=new ComplexResourceBundleFactory(BundleClassLoader.assertExists(),"a"); ResourceBundle a_de=factory.getBundle(new Locale("de")); assertNull(a_de); ResourceBundle a_en=factory.getBundle(new Locale("en")); assertNull(a_en); ResourceBundle a_en_EN=factory.getBundle(new Locale("en","EN")); assertNull(a_en_EN); }
Example 18
private static ResourceBundle getBundle(){ ResourceBundle bundle=null; if (ourBundle != null) bundle=ourBundle.get(); if (bundle == null) { bundle=ResourceBundle.getBundle(BUNDLE); ourBundle=new SoftReference<ResourceBundle>(bundle); } return bundle; }
Example 19
protected TimeUtils getTimeUtils(){ if (timeUtils == null) { ResourceBundle bundle; try { bundle=ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp",GitBlitWebSession.get().getLocale()); } catch ( Throwable t) { bundle=ResourceBundle.getBundle("com.gitblit.wicket.GitBlitWebApp"); } timeUtils=new TimeUtils(bundle); } return timeUtils; }
Example 20
From project grails-gdoc-engine, under directory /src/main/java/org/radeox/filter/regex/.
Source file: LocaleRegexReplaceFilter.java

public void setInitialContext(InitialRenderContext context){ super.setInitialContext(context); clearRegex(); ResourceBundle outputMessages=getOutputBundle(); ResourceBundle inputMessages=getInputBundle(); String match=inputMessages.getString(getLocaleKey() + (modifier != null ? "." + modifier : "") + ".match"); String print=outputMessages.getString(getLocaleKey() + (modifier != null ? "." + modifier : "") + ".print"); addRegex(match,print,isSingleLine() ? RegexReplaceFilter.SINGLELINE : RegexReplaceFilter.MULTILINE); }
Example 21
From project Grammar-Kit, under directory /support/org/intellij/grammar/.
Source file: GrammarMessages.java

private static ResourceBundle getBundle(){ ResourceBundle bundle=null; if (ourBundle != null) bundle=ourBundle.get(); if (bundle == null) { bundle=ResourceBundle.getBundle(BUNDLE); ourBundle=new SoftReference<ResourceBundle>(bundle); } return bundle; }
Example 22
From project griffon, under directory /subprojects/griffon-rt/src/main/groovy/org/codehaus/griffon/runtime/core/i18n/.
Source file: DefaultMessageSource.java

protected ResourceBundle getBundle(Locale locale){ if (null == locale) locale=Locale.getDefault(); ResourceBundle rb=bundles.get(locale); if (null == rb) { rb=CompositeResourceBundle.create(basename,locale); bundles.put(locale,rb); } return rb; }
Example 23
From project ha-jdbc, under directory /src/test/java/net/sf/hajdbc/.
Source file: MessagesTest.java

@Test public void verifyResourceBundle(){ ResourceBundle resource=ResourceBundle.getBundle(Messages.class.getName()); for ( String key : Collections.list(resource.getKeys())) { boolean found=false; for ( Messages value : Messages.values()) { if (value.toString().equals(key)) { found=true; break; } } Assert.assertTrue(key,found); } }
Example 24
From project happening, under directory /src-ui/org/vaadin/training/fundamentals/happening/ui/viewimpl/.
Source file: ShowHappeningViewImpl.java

@SuppressWarnings("serial") private void rebuildLayout(){ removeAllComponents(); ResourceBundle tr=AppData.getTr(AppData.getLocale()); Button editButton=new Button(tr.getString("Button.Edit")); editButton.addListener(new Button.ClickListener(){ @Override public void buttonClick( ClickEvent event){ eventRouter.fireEvent(new EditSelectedEvent(event.getButton())); } } ); addComponent(editButton,0,0,1,0); setComponentAlignment(editButton,Alignment.TOP_RIGHT); }
Example 25
From project harmony, under directory /harmony.common.utils/src/main/java/org/opennaas/core/utils/.
Source file: Config.java

/** * @param propertyFile * @param key * @return */ private static String getStringFromBundle(final String propertyFile,final String key){ final ResourceBundle bundle=ResourceBundle.getBundle(Config.PROPERTIES_DIR + propertyFile); try { return bundle.getString(key).trim(); } catch ( MissingResourceException exception) { throw new MissingResourceException("Could not find '" + key + "' in '"+ propertyFile+ "'. Details: "+ exception.getMessage(),exception.getClassName(),exception.getKey()); } }
Example 26
From project hibernate-validator, under directory /engine/src/main/java/org/hibernate/validator/resourceloading/.
Source file: CachingResourceBundleLocator.java

public ResourceBundle getResourceBundle(Locale locale){ ResourceBundle cachedResourceBundle=bundleCache.get(locale); if (cachedResourceBundle == null) { final ResourceBundle bundle=super.getResourceBundle(locale); if (bundle != null) { cachedResourceBundle=bundleCache.putIfAbsent(locale,bundle); if (cachedResourceBundle == null) { return bundle; } } } return cachedResourceBundle; }
Example 27
public static String getText(String id,String key,Locale locale,Object[] args){ String message=""; try { ResourceBundle resourceBundle=ResourceBundle.getBundle(id,locale); String text=resourceBundle.getString(key); message=MessageFormat.format(text,args); } catch ( MissingResourceException e) { } return message; }
Example 28
/** * Gets the {@link ResourceBundle} from a given JSF context. * @param bundleId Unique identifier of the bundle to fetch * @return {@link ResourceBundle} of the current application * @since 1.4 */ public static ResourceBundle getResourceBundle(String bundleId){ FacesContext ctx=FacesContext.getCurrentInstance(); Application application=ctx.getApplication(); ResourceBundle bundle; try { bundle=application.getResourceBundle(ctx,bundleId); } catch ( Exception ex) { bundle=ResourceBundle.getBundle(application.getMessageBundle()); } return bundle; }
Example 29
From project idea-sbt-plugin, under directory /sbt-plugin/src/main/java/net/orfjackal/sbt/plugin/.
Source file: MessageBundle.java

private static ResourceBundle getBundle(){ ResourceBundle bundle=null; if (ourBundle != null) { bundle=ourBundle.get(); } if (bundle == null) { bundle=ResourceBundle.getBundle(BUNDLE); ourBundle=new SoftReference<ResourceBundle>(bundle); } return bundle; }
Example 30
From project ideavim, under directory /src/com/maddyhome/idea/vim/helper/.
Source file: MessageHelper.java

protected static ResourceBundle getBundle(){ ResourceBundle bundle=null; if (ourBundle != null) bundle=ourBundle.get(); if (bundle == null) { bundle=ResourceBundle.getBundle(BUNDLE); ourBundle=new SoftReference<ResourceBundle>(bundle); } return bundle; }
Example 31
From project immutant, under directory /modules/cache/src/main/java/org/immutant/cache/as/.
Source file: CacheSubsystemProviders.java

@Override public ModelNode getModelDescription(Locale locale){ final ResourceBundle bundle=getResourceBundle(locale); final ModelNode subsystem=new ModelNode(); subsystem.get(DESCRIPTION).set(bundle.getString("immutant-cache")); subsystem.get(HEAD_COMMENT_ALLOWED).set(true); subsystem.get(TAIL_COMMENT_ALLOWED).set(true); subsystem.get(NAMESPACE).set(Namespace.CURRENT.getUriString()); return subsystem; }
Example 32
From project incubator, under directory /net.karlmartens.ui/src/net/karlmartens/ui/action/.
Source file: ResizeAllColumnsAction.java

public ResizeAllColumnsAction(Table table){ _table=table; _delegateAction=new ResizeColumnAction(_table,-1); final ResourceBundle bundle=ResourceBundle.getBundle("net.karlmartens.ui.locale.messages"); setText(bundle.getString("ResizeAllColumnsAction.TEXT")); }
Example 33
From project international, under directory /api/src/main/java/org/jboss/seam/international/status/.
Source file: ApplicationBundles.java

public ResourceBundle get(final Locale locale,final Object key){ containsLocaleMap(locale); if (!bundles.get(locale).containsKey(key)) { ResourceBundle bundle=ResourceBundle.getBundle(key.toString(),locale); put(locale,key.toString(),bundle); } return bundles.get(locale).get(key); }
Example 34
From project ivyde, under directory /org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/.
Source file: IvyPlugin.java

/** * Returns the string from the plugin's resource bundle, or 'key' if not found. */ public static String getResourceString(String key){ ResourceBundle bundle=IvyPlugin.getDefault().getResourceBundle(); try { return (bundle != null) ? bundle.getString(key) : key; } catch ( MissingResourceException e) { return key; } }
Example 35
From project agorava-core, under directory /agorava-core-impl/src/main/java/org/agorava/core/oauth/.
Source file: PropertyOAuthAppSettingsBuilder.java

/** * {@inheritDoc} <p/>This implementation will build the {@link OAuthAppSettings} from a {@link ResourceBundle}<p/> It'll first try to load all binding (mandatory) fields from the bundle by looking for the key prefix.fieldName (or fieldName if prefix is empty) <p/> In a second time it'll check if optional fields are present in the bundle (with the same key construction) and load them if they are. If they are not present it'll try to load them without prefix * @return the built OAuthAppSettings * @throws java.util.MissingResourceException if the bundle can't be open * @throws AgoravaException if a binding field is missing in the bundle */ @Override public OAuthAppSettings build(){ String key; String value; Joiner kj=Joiner.on('.').skipNulls(); ResourceBundle rb=ResourceBundle.getBundle(bundleName); for ( String k : bindingKeys) { key=kj.join(prefix,k); if (!rb.containsKey(key)) { throw new AgoravaException("Unable to find binding key: " + key + " in bundle "+ bundleName+ " to build settings"); } value=rb.getString(key); invokeSetter(k,value); } for ( String k : optionalKeys) { key=kj.join(prefix,k); if (rb.containsKey(key)) { value=rb.getString(key); invokeSetter(k,value); } else if (rb.containsKey(k)) { value=rb.getString(k); invokeSetter(k,value); } } return super.build(); }
Example 36
From project Archimedes, under directory /br.org.archimedes.offset/src/br/org/archimedes/offset/.
Source file: OffsetFactory.java

/** * Makes an undo command. */ private String makeUndo(){ ResourceBundle undoMessages=ResourceBundle.getBundle("br.org.archimedes.i18n.factory.UndoMessages"); String returnMessage=undoMessages.getString(Messages.getString("OffsetFactory.UndoPerformed")) + Constant.NEW_LINE; command=null; if (offsetCount > 0) { command=new UndoCommand(); offsetCount--; returnMessage+=Messages.getString("OffsetFactory.WaitSelection"); } else if (selection != null) { selection=null; br.org.archimedes.Utils.getController().deselectAll(); numPositive=new HashMap<Offsetable,Integer>(); numNegative=new HashMap<Offsetable,Integer>(); returnMessage+=Messages.getString("OffsetFactory.WaitSelection"); } else if (distance != null) { distance=null; returnMessage+=Messages.getString("OffsetFactory.WaitDistance") + "(" + formatter.format(previousDistance)+ ")"; } else { returnMessage=undoMessages.getString(Messages.getString("OffsetFactory.UndoNotPerformed")); } return returnMessage; }
Example 37
From project asterisk-java, under directory /src/main/java/org/asteriskjava/fastagi/.
Source file: DefaultAgiServer.java

private void loadConfig(){ final ResourceBundle resourceBundle; try { resourceBundle=ResourceBundle.getBundle(configResourceBundleName); } catch ( MissingResourceException e) { return; } try { String portString; try { portString=resourceBundle.getString("port"); } catch ( MissingResourceException e) { portString=resourceBundle.getString("bindPort"); } port=Integer.parseInt(portString); } catch ( Exception e) { } try { setPoolSize(Integer.parseInt(resourceBundle.getString("poolSize"))); } catch ( Exception e) { } try { setMaximumPoolSize(Integer.parseInt(resourceBundle.getString("maximumPoolSize"))); } catch ( Exception e) { } }
Example 38
From project b3log-latke, under directory /latke/src/main/java/org/b3log/latke/service/.
Source file: LangPropsService.java

/** * Gets all language properties as a map by the specified locale. * @param locale the specified locale * @return a map of language configurations */ public Map<String,String> getAll(final Locale locale){ Map<String,String> ret=LANGS.get(locale); if (null == ret) { ret=new HashMap<String,String>(); ResourceBundle langBundle=null; try { langBundle=ResourceBundle.getBundle(Keys.LANGUAGE,locale); } catch ( final MissingResourceException e) { LOGGER.log(Level.WARNING,"{0}, using default locale[{1}] instead",new Object[]{e.getMessage(),Latkes.getLocale()}); try { langBundle=ResourceBundle.getBundle(Keys.LANGUAGE,Latkes.getLocale()); } catch ( final MissingResourceException ex) { LOGGER.log(Level.WARNING,"{0}, using default lang.properties instead",new Object[]{e.getMessage()}); langBundle=ResourceBundle.getBundle(Keys.LANGUAGE); } } final Enumeration<String> keys=langBundle.getKeys(); while (keys.hasMoreElements()) { final String key=keys.nextElement(); final String value=langBundle.getString(key); ret.put(key,value); } LANGS.put(locale,ret); } return ret; }
Example 39
From project Cilia_1, under directory /framework/runtime/src/main/java/fr/liglab/adele/cilia/admin/util/.
Source file: JSONObject.java

/** * Construct a JSONObject from a ResourceBundle. * @param baseName The ResourceBundle base name. * @param locale The Locale to load the ResourceBundle for. * @throws JSONException If any JSONExceptions are detected. */ public JSONObject(String baseName,Locale locale) throws JSONException { this(); ResourceBundle bundle=ResourceBundle.getBundle(baseName,locale,Thread.currentThread().getContextClassLoader()); Enumeration keys=bundle.getKeys(); while (keys.hasMoreElements()) { Object key=keys.nextElement(); if (key instanceof String) { String[] path=((String)key).split("\\."); int last=path.length - 1; JSONObject target=this; for (int i=0; i < last; i+=1) { String segment=path[i]; JSONObject nextTarget=target.optJSONObject(segment); if (nextTarget == null) { nextTarget=new JSONObject(); target.put(segment,nextTarget); } target=nextTarget; } target.put(path[last],bundle.getString((String)key)); } } }
Example 40
From project coala, under directory /assemblies/coala/src/main/java/org/openehealth/coala/beans/.
Source file: ConsentBean.java

/** * Selections-Listener for data table displaying {@link PatientConsent}instances. * @param event Provided by UI context. */ public void selectionListenerConsent(AjaxBehaviorEvent event){ FacesContext fc=FacesContext.getCurrentInstance(); String messages=fc.getApplication().getMessageBundle(); Locale locale=new Locale(localeHandler.getLocale()); ResourceBundle bundle=ResourceBundle.getBundle(messages,locale); UIExtendedDataTable dataTable=(UIExtendedDataTable)event.getComponent(); Object originalKey=dataTable.getRowKey(); for ( Object selectionKey : selectionConsent) { dataTable.setRowKey(selectionKey); if (dataTable.isRowAvailable()) { selectedConsent=(PatientConsent)dataTable.getRowData(); LOG.info("[CONSENT SELECTED] by " + selectedConsent.getAuthor()); LOG.info("[CONSENT SELECTED] Patient" + selectedPatient.getLastName()); UIRegion consentResultPanel=(UIRegion)dataTable.getParent(); UIOutput renderedConsentText=(UIOutput)consentResultPanel.findComponent("renderedConsentText"); String consentAsHTML=""; try { consentAsHTML=cdaService.transformToHTML(selectedPatient,selectedConsent.getValidFrom(),selectedConsent.getValidUntil(),selectedConsent.getPolicyType(),selectedConsent.getAuthor()); } catch ( IllegalArgumentException e) { consentAsHTML=bundle.getString("errors.htmlTransformationFailed"); LOG.warn(e.getMessage()); } catch ( CdaXmlTransformerException e) { consentAsHTML=bundle.getString("errors.htmlTransformationFailed"); LOG.warn(e.getMessage()); } renderedConsentText.setValue(consentAsHTML); UIPopupPanel consentDisplayPanel=(UIPopupPanel)consentResultPanel.findComponent("consentDisplayPanel"); LOG.info("[CONSENT SELECTED] setShow"); consentDisplayPanel.setShow(true); } else { LOG.warn("ROW NOT AVAILABLE"); } } dataTable.setRowKey(originalKey); }
Example 41
From project cogroo4, under directory /cogroo-nlp/src/main/java/org/cogroo/exceptions/.
Source file: InternationalizedException.java

public String getLocalizedMessage(Locale aLocale){ if (getMessageKey() == null) return null; try { ResourceBundle bundle=ResourceBundle.getBundle(getResourceBundleName(),aLocale,this.getClass().getClassLoader()); String message=bundle.getString(getMessageKey()); if (getArguments().length > 0) { MessageFormat fmt=new MessageFormat(message); fmt.setLocale(aLocale); return fmt.format(getArguments()); } else return message; } catch ( Exception e) { return "EXCEPTION MESSAGE LOCALIZATION FAILED: " + e.toString(); } }
Example 42
From project des, under directory /daemon/lib/apache-log4j-1.2.16/src/main/java/org/apache/log4j/.
Source file: Category.java

/** * Returns the string resource coresponding to <code>key</code> in this category's inherited resource bundle. See also {@link #getResourceBundle}. <p>If the resource cannot be found, then an {@link #error error}message will be logged complaining about the missing resource. */ protected String getResourceBundleString(String key){ ResourceBundle rb=getResourceBundle(); if (rb == null) { return null; } else { try { return rb.getString(key); } catch ( MissingResourceException mre) { error("No resource is associated with key \"" + key + "\"."); return null; } } }
Example 43
public static boolean correspond(PublicKey pubKey,PrivateKey prvKey) throws NoSuchAlgorithmException { ResourceBundle labels=ResourceBundle.getBundle("cl.nic.dte.resources.Exceptions"); if (!pubKey.getAlgorithm().equals(prvKey.getAlgorithm())) return false; if (pubKey.getAlgorithm().equals("RSA")) { if (!((RSAPrivateKey)prvKey).getModulus().equals(((RSAPublicKey)pubKey).getModulus())) return false; return true; } else if (pubKey.getAlgorithm().equals("DSA")) { if (!(((DSAPrivateKey)prvKey).getParams().getG().equals(((DSAPublicKey)pubKey).getParams().getG()))) return false; if (!(((DSAPrivateKey)prvKey).getParams().getP().equals(((DSAPublicKey)pubKey).getParams().getP()))) return false; if (!(((DSAPrivateKey)prvKey).getParams().getQ().equals(((DSAPublicKey)pubKey).getParams().getQ()))) return false; return true; } else throw new NoSuchAlgorithmException(labels.getString("ALG_NOT_SUPPORTED")); }
Example 44
From project eoit, under directory /EOITUtils/src/main/java/fr/eoit/util/dumper/property/.
Source file: RequestDefinitionParser.java

public static List<RequestDefinitionBean> getRequests(){ ResourceBundle bundle=ResourceBundle.getBundle(PROP_FILE); List<RequestDefinitionBean> result=new ArrayList<RequestDefinitionBean>(); for (int id=1; id < MAX_REQS; id++) { RequestDefinitionBean request=new RequestDefinitionBean(); request.id=id; try { if (bundle.getString("req" + id + ".name") != null) { request.name=bundle.getString("req" + id + ".name"); request.sql=bundle.getString("req" + id + ".sql"); request.fields=new ArrayList<String>(); for (int i=0; i < MAX_FIELDS; i++) { try { String fieldName=bundle.getString("req" + id + ".field"+ i); if (fieldName != null) { request.fields.add(fieldName); } } catch ( MissingResourceException e) { } } request.table=bundle.getString("req" + id + ".table"); request.fieldStrPos=getIntegerList(bundle.getString("req" + id + ".fieldStrPos")); request.copressedStrPos=getIntegerList(bundle.getString("req" + id + ".copressedStrPos")); result.add(request); } } catch ( MissingResourceException e) { } } return result; }
Example 45
From project etherpad, under directory /infrastructure/rhino1_7R1/src/org/mozilla/javascript/.
Source file: ScriptRuntime.java

public static String getMessage(String messageId,Object[] arguments){ final String defaultResource="org.mozilla.javascript.resources.Messages"; Context cx=Context.getCurrentContext(); Locale locale=cx != null ? cx.getLocale() : Locale.getDefault(); ResourceBundle rb=ResourceBundle.getBundle(defaultResource,locale); String formatString; try { formatString=rb.getString(messageId); } catch ( java.util.MissingResourceException mre) { throw new RuntimeException("no message resource found for message property " + messageId); } MessageFormat formatter=new MessageFormat(formatString); return formatter.format(arguments); }
Example 46
From project faces, under directory /Proyectos/upcdew-deportivoapp/src/java/com/upc/deportivo/util/.
Source file: FacesUtils.java

public static String getMessageResourceString(String key,Object params[]){ Locale locale=Locale.getDefault(); String text=null; String bundleName=FacesContext.getCurrentInstance().getApplication().getMessageBundle(); ResourceBundle bundle=null; if (params == null) { bundle=ResourceBundle.getBundle(bundleName,locale); } else { bundle=ResourceBundle.getBundle(bundleName,locale,getCurrentClassLoader(params)); } try { text=bundle.getString(key); } catch ( MissingResourceException e) { text="?? key " + key + " not found ??"; } if (params != null) { MessageFormat mf=new MessageFormat(text,locale); text=mf.format(params,new StringBuffer(),null).toString(); } return text; }
Example 47
From project gatein-toolbox, under directory /sqlman/src/test/java/org/sqlman/.
Source file: SQLTestCase.java

@Test @BMScript(dir="src/main/resources",value="sqlman") public void testSimple() throws Exception { System.setProperty("sqlman.pkgs","org.sqlman"); SQLMan sqlman=SQLMan.getInstance(); assertEquals(-1,sqlman.getCountValue("jdbc",0)); assertEquals(-1,sqlman.getCountValue("jdbcquery",0)); assertEquals(-1,sqlman.getCountValue("jdbcupdate",0)); Connection conn=DriverManager.getConnection("jdbc:hsqldb:mem:test","sa",""); PreparedStatement ps=conn.prepareStatement("CREATE TABLE FOO ( POUET INTEGER )"); ps.executeUpdate(); assertEquals(-1,sqlman.getCountValue("jdbc",0)); assertEquals(-1,sqlman.getCountValue("jdbcquery",0)); assertEquals(1,sqlman.getCountValue("jdbcupdate",0)); PreparedStatement ps2=conn.prepareStatement("INSERT INTO FOO (POUET) VALUES (?)"); ps2.setInt(1,50); ps2.execute(); assertEquals(1,sqlman.getCountValue("jdbc",0)); assertEquals(-1,sqlman.getCountValue("jdbcquery",0)); assertEquals(1,sqlman.getCountValue("jdbcupdate",0)); PreparedStatement ps3=conn.prepareStatement("SELECT POUET FROM FOO"); ResultSet rs=ps3.executeQuery(); assertTrue(rs.next()); assertEquals(50,rs.getInt(1)); assertEquals(1,sqlman.getCountValue("jdbc",0)); assertEquals(1,sqlman.getCountValue("jdbcquery",0)); assertEquals(1,sqlman.getCountValue("jdbcupdate",0)); ps.close(); long v1=sqlman.getCountValue("loadbundle",0); ResourceBundle bundle=ResourceBundle.getBundle("bundle",Locale.ENGLISH); assertNotNull(bundle); long v2=sqlman.getCountValue("loadbundle",0); assertEquals(2,v2 - v1); }
Example 48
@Override public void init() throws ServletException { super.init(); ResourceBundle rb=ResourceBundle.getBundle("properties.thematic"); ResourceBundle rdb=ResourceBundle.getBundle("properties.database"); this.colorNames=rb.getString("THEMATIC.COLOR.NAMES"); this.labelScale=rb.getString("THEMATIC.LABEL.MAXSCALE"); this.themeRanges=rb.getString("THEMATIC.RANGES"); this.db_name=rdb.getString("DB.NAME"); this.db_host=rdb.getString("DB.HOST"); this.db_user=rdb.getString("DB.USER"); this.db_password=rdb.getString("DB.PASSWORD"); this.db_metadata=rdb.getString("DB.METADATA.TABLE"); try { byte[] byteData=this.colorNames.getBytes("ISO_8859_1"); this.colorNames=new String(byteData,"UTF-8"); } catch ( Exception e) { System.out.println(e); } }
Example 49
public ResourceBundle newBundle(String baseName,Locale locale,String format,ClassLoader loader,boolean reload) throws IllegalAccessException, InstantiationException, IOException { if (baseName == null || locale == null || format == null || loader == null) throw new NullPointerException(); ResourceBundle bundle=null; if (format.equals("xml")) { String bundleName=toBundleName(baseName,locale); String resourceName=toResourceName(bundleName,format); InputStream stream=null; if (reload) { URL url=loader.getResource(resourceName); if (url != null) { URLConnection connection=url.openConnection(); if (connection != null) { connection.setUseCaches(false); stream=connection.getInputStream(); } } } else { stream=loader.getResourceAsStream(resourceName); } if (stream != null) { BufferedInputStream bis=new BufferedInputStream(stream); bundle=new XMLResourceBundle(bis); bis.close(); } } return bundle; }
Example 50
From project Hackathon_Chutaum, under directory /src/br/com/chutaum/json/.
Source file: JSONObject.java

/** * Construct a JSONObject from a ResourceBundle. * @param baseName The ResourceBundle base name. * @param locale The Locale to load the ResourceBundle for. * @throws JSONException If any JSONExceptions are detected. */ public JSONObject(String baseName,Locale locale) throws JSONException { this(); ResourceBundle bundle=ResourceBundle.getBundle(baseName,locale,Thread.currentThread().getContextClassLoader()); Enumeration keys=bundle.getKeys(); while (keys.hasMoreElements()) { Object key=keys.nextElement(); if (key instanceof String) { String[] path=((String)key).split("\\."); int last=path.length - 1; JSONObject target=this; for (int i=0; i < last; i+=1) { String segment=path[i]; JSONObject nextTarget=target.optJSONObject(segment); if (nextTarget == null) { nextTarget=new JSONObject(); target.put(segment,nextTarget); } target=nextTarget; } target.put(path[last],bundle.getString((String)key)); } } }
Example 51
From project Haven-and-Hearth-client-modified-by-Ender, under directory /src/org/json/.
Source file: JSONObject.java

/** * Construct a JSONObject from a ResourceBundle. * @param baseName The ResourceBundle base name. * @param locale The Locale to load the ResourceBundle for. * @throws JSONException If any JSONExceptions are detected. */ public JSONObject(String baseName,Locale locale) throws JSONException { this(); ResourceBundle r=ResourceBundle.getBundle(baseName,locale,Thread.currentThread().getContextClassLoader()); Enumeration<?> keys=r.getKeys(); while (keys.hasMoreElements()) { Object key=keys.nextElement(); if (key instanceof String) { String[] path=((String)key).split("\\."); int last=path.length - 1; JSONObject target=this; for (int i=0; i < last; i+=1) { String segment=path[i]; JSONObject nextTarget=target.optJSONObject(segment); if (nextTarget == null) { nextTarget=new JSONObject(); target.put(segment,nextTarget); } target=nextTarget; } target.put(path[last],r.getString((String)key)); } } }
Example 52
From project incubator-deltaspike, under directory /deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/.
Source file: DefaultMessageResolver.java

@Override public String getMessage(MessageContext messageContext,String messageTemplate,String category){ if (messageTemplate.startsWith("{{")) { return messageTemplate.substring(1); } if (messageTemplate.startsWith("{") && messageTemplate.endsWith("}")) { String resourceKey=messageTemplate.substring(1,messageTemplate.length() - 1); List<String> messageSources=messageContext.getMessageSources(); if (messageSources == null || messageSources.isEmpty()) { return null; } Iterator<String> messageSourceIterator=messageSources.iterator(); String currentMessageSource; while (messageSourceIterator.hasNext()) { currentMessageSource=messageSourceIterator.next(); try { Locale locale=messageContext.getLocale(); ResourceBundle messageBundle=PropertyFileUtils.getResourceBundle(currentMessageSource,locale); if (category != null && category.length() > 0) { try { return messageBundle.getString(resourceKey + "." + category); } catch ( MissingResourceException e) { messageBundle.getString(resourceKey); } } return messageBundle.getString(resourceKey); } catch ( MissingResourceException e) { if (!messageSourceIterator.hasNext()) { return null; } } } } return messageTemplate; }
Example 53
From project java-gae-verifier, under directory /src/org/mozilla/javascript/.
Source file: ScriptRuntime.java

public String getMessage(String messageId,Object[] arguments){ final String defaultResource="org.mozilla.javascript.resources.Messages"; Context cx=Context.getCurrentContext(); Locale locale=cx != null ? cx.getLocale() : Locale.getDefault(); ResourceBundle rb=ResourceBundle.getBundle(defaultResource,locale); String formatString; try { formatString=rb.getString(messageId); } catch ( java.util.MissingResourceException mre) { throw new RuntimeException("no message resource found for message property " + messageId); } MessageFormat formatter=new MessageFormat(formatString); return formatter.format(arguments); }
Example 54
From project jBilling, under directory /src/java/com/sapienter/jbilling/server/invoice/.
Source file: InvoiceBL.java

public InvoiceDTO getDTOEx(Integer languageId,boolean forDisplay){ if (!forDisplay) { return invoice; } InvoiceDTO invoiceDTO=new InvoiceDTO(invoice); List<InvoiceLineDTO> orderdLines=new ArrayList<InvoiceLineDTO>(invoiceDTO.getInvoiceLines()); Collections.sort(orderdLines,new InvoiceLineComparator()); invoiceDTO.setInvoiceLines(orderdLines); UserBL userBl=new UserBL(invoice.getBaseUser()); Locale locale=userBl.getLocale(); ResourceBundle bundle=ResourceBundle.getBundle("entityNotifications",locale); if (invoiceDTO.hasSubAccounts()) { addHeadersFooters(orderdLines,bundle); } InvoiceLineDTO total=new InvoiceLineDTO(); total.setDescription(bundle.getString("invoice.line.total")); total.setAmount(invoice.getTotal()); total.setIsPercentage(0); invoiceDTO.getInvoiceLines().add(total); CurrencyBL currency=new CurrencyBL(invoice.getCurrency().getId()); if (languageId != null) { invoiceDTO.setCurrencyName(currency.getEntity().getDescription(languageId)); } invoiceDTO.setCurrencySymbol(currency.getEntity().getSymbol()); return invoiceDTO; }
Example 55
From project activejdbc, under directory /activejdbc/src/main/java/org/javalite/activejdbc/.
Source file: Messages.java

private static String getMessage(String key,Locale locale,Object... params){ MessageFormat mf=new MessageFormat(""); try { if (locale == null) { mf.applyPattern(ResourceBundle.getBundle(BUNDLE).getString(key)); } else { mf.applyPattern(ResourceBundle.getBundle(BUNDLE,locale).getString(key)); } } catch ( Exception e) { mf.applyPattern(key); } return mf.format(params); }
Example 56
From project anadix, under directory /conditions/anadix-section508/src/main/java/org/anadix/section508/report/.
Source file: Section508ReportItem.java

private static String formatFromBundle(ResourceBundle bundle,String key,Object... args){ if (!bundle.containsKey(key)) { throw new IllegalArgumentException("Key " + key + " doesn't exist!"); } String text=bundle.getString(key); if (args.length > 0) { text=String.format(text,args); } return text; }
Example 57
From project basiclti-portlet, under directory /src/main/java/au/edu/anu/portal/portlets/basiclti/utils/.
Source file: Messages.java

private static String getMessage(String key){ try { return ResourceBundle.getBundle(BUNDLE_NAME,Locale.getDefault()).getString(key); } catch ( MissingResourceException e) { return '!' + key + '!'; } }
Example 58
From project BukkitUtilities, under directory /src/main/java/name/richardson/james/bukkit/utilities/localisation/.
Source file: ResourceBundleLoader.java

public static ResourceBundle getBundle(ClassLoader loader,final String name,final File dataFolder){ try { final String path=dataFolder.getAbsolutePath() + File.separator + "localisation.properties"; final File customBundle=new File(path); if (customBundle.exists()) { final FileInputStream stream=new FileInputStream(customBundle); final PropertyResourceBundle bundle=new PropertyResourceBundle(stream); stream.close(); return bundle; } else { return ResourceBundle.getBundle(name + "-localisation",Locale.getDefault(),loader); } } catch ( final IOException exception) { exception.printStackTrace(); return ResourceBundle.getBundle(name + "-localisation",Locale.getDefault(),loader); } }
Example 59
/** * Creates a new controller tied to the specified display and gui frame. * @param parent the frame for the world window * @param disp the panel that displays the grid * @param displayMap the map for occupant displays * @param res the resource bundle for message display */ public GUIController(WorldFrame<T> parent,GridPanel disp,DisplayMap displayMap,ResourceBundle res){ resources=res; display=disp; parentFrame=parent; this.displayMap=displayMap; makeControls(); occupantClasses=new TreeSet<Class>(new Comparator<Class>(){ public int compare( Class a, Class b){ return a.getName().compareTo(b.getName()); } } ); World<T> world=parentFrame.getWorld(); Grid<T> gr=world.getGrid(); for ( Location loc : gr.getOccupiedLocations()) addOccupant(gr.get(loc)); for ( String name : world.getOccupantClasses()) try { occupantClasses.add(Class.forName(name)); } catch ( Exception ex) { ex.printStackTrace(); } timer=new Timer(INITIAL_DELAY,new ActionListener(){ public void actionPerformed( ActionEvent evt){ step(); } } ); display.addMouseListener(new MouseAdapter(){ public void mousePressed( MouseEvent evt){ Grid<T> gr=parentFrame.getWorld().getGrid(); Location loc=display.locationForPoint(evt.getPoint()); if (loc != null && gr.isValid(loc) && !isRunning()) { display.setCurrentLocation(loc); locationClicked(); } } } ); stop(); }
Example 60
From project cipango, under directory /cipango-console/src/main/java/org/cipango/console/util/.
Source file: ConsoleUtil.java

public static Map<String,String> getFilters(ResourceBundle bundle){ Map<String,String> filters=new HashMap<String,String>(); Enumeration<String> keys=bundle.getKeys(); while (keys.hasMoreElements()) { String key=keys.nextElement(); if (key.endsWith(".title")) { String title=bundle.getString(key); String prefix=key.substring(0,key.length() - ".title".length()); String filter=bundle.getString(prefix + ".filter").trim(); filters.put(filter,title); } } return filters; }
Example 61
From project CIShell, under directory /templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/.
Source file: Activator.java

/** * The constructor */ public Activator(){ plugin=this; try { resourceBundle=ResourceBundle.getBundle(Activator.class.getName()); } catch ( MissingResourceException x) { resourceBundle=null; } }
Example 62
From project clirr-maven-plugin, under directory /src/main/java/org/codehaus/mojo/clirr/.
Source file: ClirrReportGenerator.java

public ClirrReportGenerator(Sink sink,ResourceBundle bundle,Locale locale){ this.bundle=bundle; this.sink=sink; this.enableSeveritySummary=true; this.locale=locale; }
Example 63
From project codjo-standalone-common, under directory /src/main/java/net/codjo/operation/imports/.
Source file: ImportBehaviorHome.java

/** * Constructor for the ImportBehaviorHome object * @param con Une connnection * @param conMan Manager de connection (pour l'import) * @param tableHome Home table * @exception SQLException En cas d'erreur lors de l'acces a la base */ public ImportBehaviorHome(Connection con,ConnectionManager conMan,TableHome tableHome) throws SQLException { super(con,ResourceBundle.getBundle("ImportBehaviorHome")); this.tableHome=tableHome; fieldImportHome=new FieldImportHome(con); connectionManager=conMan; }
Example 64
From project Core_2, under directory /shell/src/main/java/org/jboss/forge/shell/console/jline/console/.
Source file: ConsoleReader.java

private void loadMappingsFromBundle(final short[] keyBindings,final ResourceBundle bundle){ Enumeration<String> keys=bundle.getKeys(); String val; while (keys.hasMoreElements()) { val=keys.nextElement(); try { short code=Short.parseShort(val); String name=bundle.getString(val); org.jboss.forge.shell.console.jline.console.Operation op=org.jboss.forge.shell.console.jline.console.Operation.valueOf(name); keyBindings[code]=op.code; } catch ( NumberFormatException e) { org.jboss.forge.shell.console.jline.internal.Log.error("Failed to convert binding code: ",val,e); } } }
Example 65
From project dcm4che, under directory /dcm4che-tool/dcm4che-tool-common/src/main/java/org/dcm4che/tool/common/.
Source file: CLIUtils.java

public static CommandLine parseComandLine(String[] args,Options opts,ResourceBundle rb2,Class<?> clazz) throws ParseException { CommandLineParser parser=new PosixParser(); CommandLine cl=parser.parse(opts,args); if (cl.hasOption("h")) { HelpFormatter formatter=new HelpFormatter(); formatter.printHelp(rb2.getString("usage"),rb2.getString("description"),opts,rb2.getString("example")); System.exit(0); } if (cl.hasOption("V")) { Package p=clazz.getPackage(); String s=p.getName(); System.out.println(s.substring(s.lastIndexOf('.') + 1) + ": " + p.getImplementationVersion()); System.exit(0); } return cl; }
Example 66
From project eclim, under directory /org.eclim/java/org/eclim/plugin/.
Source file: AbstractPluginResources.java

/** * {@inheritDoc} */ public ResourceBundle getResourceBundle(){ if (bundle == null) { bundle=ResourceBundle.getBundle(getBundleBaseName(),Locale.getDefault(),getClass().getClassLoader()); } return bundle; }
Example 67
From project empire-db, under directory /empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/.
Source file: FacesApplication.java

protected void initTextResolvers(){ int count=0; Iterator<Locale> locales=getSupportedLocales(); for (count=0; locales.hasNext(); count++) { locales.next(); } String messageBundle=this.getMessageBundle(); textResolvers=new TextResolver[count]; locales=getSupportedLocales(); for (int i=0; locales.hasNext(); i++) { Locale locale=locales.next(); textResolvers[i]=new TextResolver(ResourceBundle.getBundle(messageBundle,locale)); } }
Example 68
From project examples_1, under directory /helloworld/helloworld.blueprint/src/com/example/hello/impl/.
Source file: GreetingImpl.java

public void setLanguage(String language){ System.out.println("-------> Setting language to " + language); try { resources=ResourceBundle.getBundle(RESOURCE_BASE,new Locale(language),GreetingImpl.class.getClassLoader()); } catch ( MissingResourceException e) { System.err.println("-------> No greeting available for language: " + language); } }
Example 69
From project extension_libero_manufacturing, under directory /extension/eevolution/libero/src/main/java/org/eevolution/form/action/.
Source file: PopupAction.java

public PopupAction(String property){ super(); language=ResourceBundle.getBundle(getClass().getPackage().getName() + ".language"); setText(language.getString(property)); setActionCommand(getCommand()); init(); addActionListener(this); }
Example 70
From project freemind, under directory /freemind/freemind/main/.
Source file: FreeMindCommon.java

/** * Returns the ResourceBundle with the current language */ public ResourceBundle getResources(){ if (resources == null) { resources=new FreemindResourceBundle(); } return resources; }
Example 71
From project hadoop_framework, under directory /webapp/src/main/java/org/sleuthkit/web/sampleapp/server/.
Source file: SampleServiceImpl.java

/** * read properties from property file */ static void readProps(){ try { rb=ResourceBundle.getBundle("sampleapp"); filesDirPath=rb.getString("files.dir.path"); commandScript=rb.getString("command.script"); commandJar=rb.getString("command.jar"); reportPattern=rb.getString("report.hdfs.pattern"); reportWS=rb.getString("report.ws.pattern"); path=rb.getString("command.path"); fsripLib=rb.getString("command.fsrip.lib"); hadoopHome=rb.getString("command.hadoop.home"); workDir=rb.getString("command.work_dir"); String cols=rb.getString("columns"); StringTokenizer st=new StringTokenizer(cols,","); columns=new String[st.countTokens()]; int i=0; while (st.hasMoreTokens()) { columns[i++]=st.nextToken(); } } catch ( Exception ex) { System.err.println("Error initializing application, cannot read configuration."); ex.printStackTrace(System.err); } }
Example 72
From project I18N4Vaadin, under directory /Sources/I18N4Vaadin/src/com/github/peholmst/i18n4vaadin/.
Source file: ResourceBundleI18N.java

/** * Gets the resource bundle for the current locale. * @return the resource bundle (never <code>null</code>). * @throws MissingResourceException if the resource bundle could not be located. * @throws IllegalStateException if no current locale has been set. */ protected ResourceBundle getCurrentBundle() throws MissingResourceException, IllegalStateException { if (getCurrentLocale() == null) { throw new IllegalStateException("null currentLocale"); } if (currentBundle == null) { if (classLoader == null) { currentBundle=ResourceBundle.getBundle(baseName,getCurrentLocale()); } else { currentBundle=ResourceBundle.getBundle(baseName,getCurrentLocale(),classLoader); } } return currentBundle; }
Example 73
/** * Sets the locale. * @param locale Locale. */ public void setLocale(Locale locale){ super.setLocale(locale); resBundle=ResourceBundle.getBundle(Solitaire.class.getName() + "Ress",locale); menuOptions.setLabel(resBundle.getString("Options")); menuItemNewGame.setLabel(resBundle.getString("NewGame")); menuHelp.setLabel(resBundle.getString("Help")); menuItemRules.setLabel(resBundle.getString("Rules")); menuItemAbout.setLabel(resBundle.getString("About")); menuItemLicense.setLabel(resBundle.getString("License")); menuItemEnglish.setLabel(resBundle.getString("English")); menuItemFrench.setLabel(resBundle.getString("French")); menuItemHint.setLabel(resBundle.getString("Hint")); menuItemRestart.setLabel(resBundle.getString("Restart")); menuItemUndo.setLabel(resBundle.getString("Undo")); menuItemLevelRandom.setLabel(resBundle.getString("LevelRandom")); menuItemLevelEasy.setLabel(resBundle.getString("LevelEasy")); menuItemLevelNormal.setLabel(resBundle.getString("LevelNormal")); menuItemLevelHard.setLabel(resBundle.getString("LevelHard")); menuItemLevelTricky.setLabel(resBundle.getString("LevelTricky")); menuItemEnglish.setState(Locale.ENGLISH.equals(locale)); menuItemFrench.setState(Locale.FRENCH.equals(locale)); setTitle(resBundle.getString("Solitaire")); if (frameAbout != null) frameAbout.setLocale(locale); if (frameRules != null) frameRules.setLocale(locale); if (table != null) table.repaint(); }