resourcebundle

MissingResourceException due to class loader constallation (caller not in WEB-INF/classes)

倾然丶 夕夏残阳落幕 提交于 2019-12-25 02:39:10
问题 I get a MissingResourceException when accessing a resource bundle. The problem comes up due to my specific class loader constallation. I am trying to read a text.properties from within a class which resides under JBOSS_HOME/server/myServer/myDeployDir/myEAR/myJAR.jar (note: the calling class is not in WEB-INF/classes). The text.properties file is here JBOSS_HOME/server/myServer/myDeployDir/myEAR/myWAR/WEB-INF/classes. When running the following code: Locale locale = new Locale ("de", "DE");

JSF - message bundle always uses default properties file

≡放荡痞女 提交于 2019-12-25 02:24:53
问题 I cannot get locales to work. System EAR and WAR Glassfish: 3.12 Hibernate 4.2 - jar's on EAR and WAR Mojarra: 2.1.11 Primefaces: 3.3 Omnifaces: 1.1 Property files in source folder: messages_de.properties <- using german language messages.properties <- using english language faces-config.xml: <locale-config> <default-locale>en</default-locale> <supported-locale>de</supported-locale> </locale-config> <message-bundle>messages</message-bundle> <resource-bundle> <base-name>messages</base-name>

accessing resource property file in *.js file

折月煮酒 提交于 2019-12-25 01:18:21
问题 Hi my project is in struts 2. We have written common js files for client side validation. now the problem is that to implement internalization we have to change alert message as per the language. so my question is that is there any way to access resource property in js file. or any one suggest some alternative or example for the same. 回答1: Store the alert messages in js files with file names like alert_en.js alert_fr.js alert_jp.js In each file store the alerts like this var ALERT_EMAIL

how to store Usability related values (Font, Dimension, Color,…) in properties file using ResoucesBundles

旧街凉风 提交于 2019-12-24 07:47:09
问题 I'm able to fetch the Strings using a properties file and ResourceBundle class using ResourceBundle.getString() . And even able to fetch int and float objects also using: int a = (int) ResourceBundle.getObject("IntKey"); float b = (float) ResourceBundle.getObject("FloatKey"); But I want to know to how to fetch some complex objects like fonts? Font font = (Font) ResourceBundle.getObject("FontKey"); But how to store the Font values in properties file? can I store the object like: new Font(

Struts 2 Dynamic message with OGNL

我的梦境 提交于 2019-12-22 14:12:14
问题 In a Struts 2 project, consider below key in message resources: export.filename.accountsummary=customer ${export} The action has export filed with setter and getter. If you call the getText("export.filename.accountsummary") struts will automatically call the getExport() and fill it with correct value. (I think that struts use OGNL too lookup the resource messages that are endorse with ${} ) Is this correct ?! I try to use customer ${#sessionScope.CurrentUser.userName} an expected that struts

.NET equivalent of choices in Java resource bundles?

心不动则不痛 提交于 2019-12-22 10:14:03
问题 In Java resource bundles I may have the following Resource Bundle definitions: en_GB - British English jobs.search.resultstr = There {1,choice,0#are no jobs|1#is one job|1<are {1,number,integer} jobs} for your search ceb_PH - Cebuano jobs.search.resultstr = Adunay {1,choice,0#mga walay mga|1#mao ang 1 nga|1<{1,number,integer}} trabaho alang sa {1,choice,0#inyong mga|1#imong|1<inyong mga} search The code I would use to extract the resource would make choices based on the input data and format

How to escape curly braces in my properties file which is fetched using the ResourceBundle API

旧巷老猫 提交于 2019-12-22 05:37:16
问题 In properties file I am having a key=A: {{0}, {1}}, B: {{2}, {3}} . I am expecting a string "A: {0, 1}, B: {1, 2}" . The numbers inside the curly braces are parsing. How can I include the character '{' without binding to any value? I also tried by escaping the character like this "//{". Even I couldn't get the expected result. An error java.lang.IllegalArgumentException: can't parse argument number 0, 1 \ occurs. 回答1: key=A: '{'{0}, {1}'}', B: '{'{2}, {3}'}' 回答2: just run the properties file

Is there a tool for non-developers (translators!) to edit resource bundles?

二次信任 提交于 2019-12-22 05:35:11
问题 What we do in our company to let our software be translated by external translators is ... well .. how to put it... cvs co someModule ant translation.export (behind this target there is a self-made ant task, exporting all resource bundles together as one big tab-seperated text file, columns: the different languages, each row all languages for one key) Some VB tool does something with the file (you don't wanna know) Translators work in Excel on their column Someone collects and merges the

Loading resource bundles: Spring

寵の児 提交于 2019-12-21 21:33:07
问题 I am trying to use ResourceBundleMessageSource in Spring. Here is my project structure: And here is the xml configuration: <bean name="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basename"> <value>messages</value> </property> </bean> When I try to load the application context, I am getting the following exception: Jun 7, 2012 2:44:00 PM org.springframework.context.support.ResourceBundleMessageSource getResourceBundle WARNING:

CDI @Produces with multiple properties files

时间秒杀一切 提交于 2019-12-21 21:32:42
问题 Thanks to this post, https://stackoverflow.com/a/28047512/1227941 I am now using CDI to make msg available in my @Named beans like this: @RequestScoped public class BundleProducer { @Produces public PropertyResourceBundle getBundle() { FacesContext context = FacesContext.getCurrentInstance(); return context.getApplication().evaluateExpressionGet(context, "#{msg}", PropertyResourceBundle.class); } } With Injection like: @Inject private PropertyResourceBundle bundle; The question: What should I