resourcebundle

java.util.MissingResourceException: Can't find bundle for base name 'property_file name', locale en_US

我怕爱的太早我们不能终老 提交于 2019-11-28 08:54:49
I am trying to create a utility class ReadPropertyUtil.java for reading data from property file. While my class is located under a util directory , my skyscrapper.properties file is placed in some other directory. But , when i try to access the properties using [ResourceBundle][1] , i get exceptions, that bundle can't be loaded. Below is the code on how I am reading the properties and also an image which shows my directory structure. ReadPropertiesUtil.java /** * Properties file name. */ private static final String FILENAME = "skyscrapper"; /** * Resource bundle. */ private static

Is it possible to include resource bundle files within a resource bundle

怎甘沉沦 提交于 2019-11-28 08:42:51
We are using java.util.ResourceBundle to load property information. Our property file has grown so huge and we are thinking of splitting the master property file into several sub modules. Is it possible to achieve this? master.properties ==> master.properties include moduleA.properties include moduleB.properties Let me know? BalusC First of all, I wonder why you've chosen java.util.ResourceBundle over java.util.Properties . Given how your question is formulated, you don't seem to care about localization/internationalization nor about bundle file inheritance. With Properties it's extraordinary

JSF converter resource bundle messages

懵懂的女人 提交于 2019-11-28 08:31:36
Does anyone know where I can get a list of the converters used by JSF so I can set a custom message for them in the resource bundle? You can find them all in chapter 2.5.2.4 of the JSF specification . Here's an extract of relevance: javax.faces.component.UIInput.CONVERSION -- {0}: Conversion error occurred javax.faces.converter.BigDecimalConverter.DECIMAL={2}: ''{0}'' must be a signed decimal number. javax.faces.converter.BigDecimalConverter.DECIMAL_detail={2}: ''{0}'' must be a signed decimal number consisting of zero or more digits, that may be followed by a decimal point and fraction.

Passing localized javascript messages from resource bundles using JSF

懵懂的女人 提交于 2019-11-28 08:20:26
问题 I have built an application with JSF and all messages issued by the server are localized with resource bundles. My question is: how to get messages issued in the client browser with javascipt localized with the messages stored in the resource bundles? Do I have to generate javascript dynamically and if so how can this be done? For example, how can I have the server localize the «alert» javascript message in the following form validation method: function valider() { typeActionRadio = document

MVC bundle client caching

雨燕双飞 提交于 2019-11-28 07:17:14
By default a MVC bundle is cached on client for 1 year. Is it possible to set it's client headers manually (for 1 specific bundle)? What I need is to set custom expire headers for one of my bundles. I can't rely on the "v=hash" querystring because this bundle is for an external website, and they won't change the url pointing to my bundle each time I change it. What I've tried is to create a custom Bundle class (inherit Bundle) and overridde the GenerateBundleResponse() method. This way I can control the server caching, but the only way of customizing client caching is to set BundleResponse

Getting localized message from resourceBundle via annotations in Spring Framework

萝らか妹 提交于 2019-11-28 04:35:08
Is it possible to do this ? Currently it is done like this : <bean id="resource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basenames"> <list> <value>content.Language</value> </list> </property> </bean> @Autowired protected MessageSource resource; protected String getMessage(String code, Object[] object, Locale locale) { return resource.getMessage(code, object, locale); } Is there a way for it to be like getting properties via @Value annotation ? <util:properties id="generals" location="classpath:portlet.properties" /> @Value("#{generals['supported

java.util.MissingResourceException: Can't find bundle for base name resources.application, locale en

放肆的年华 提交于 2019-11-28 04:30:11
问题 My faces-config.xml likes below. <?xml version="1.0" encoding="UTF-8"?> <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web- facesconfig_2_0.xsd" version="2.0"> <application> <message-bundle>resources.application</message-bundle> <locale-config> <default-locale>en</default-locale> </locale-config> </application> </faces-config> Xhtml file <f

Dynamically load files on classpath using ReloadableResourceBundleMessageSource

吃可爱长大的小学妹 提交于 2019-11-28 01:22:12
问题 I'm new to Spring and am attempting to use it's ReloadableResourceBundleMessageSource class. I'm attempting to use it so that we no longer have to restart our web app for properties files changes/updates. I have a web app (Primarily using JSF) and a separate tar component which contains all my properties files. The structure of the properties tar is as follows: - CompanyOneMessages.properties - CompanyOneMessages_fr_FR.properties - CompanyTwoMessages.properties - CompanyTwoMessages_fr_FR

List all available ResourceBundle Files

只谈情不闲聊 提交于 2019-11-28 00:30:57
问题 i am using ResourceBundle and I want to give the user an option to select a language for the GUI. i want to get a list of all resource files that are under a specific package. i don't know what resources I will have since this application is based on plug-ins. Is there an option to ask from java to search all available resources under a package? (if no i guess the plug-in should give all available local for it) thank you all 回答1: The files may reside on a web server. There is no standard way

How to remove the surrounding ??? when message is not found in bundle

冷暖自知 提交于 2019-11-27 23:07:53
In JSF 2.0, if a message is not found in the message bundle, then by default, the key is surrounded with ??? . This is a very usable hint during development. However, in my particular case, I really would like that those ??? were not present. I prefer that only the key would be rendered. E.g. when I do #{msg.hello} and the key 'hello' doesn't exist, then the page displays ???hello??? but I would like to show the bare key hello The message bundle is loaded in a JSF page as follows: <f:loadBundle basename="resources.text" var="msg" /> The <f:loadBundle> tag doesn't seem to have an attribute to