resourcebundle

Formatting Issue in HTML messages from ResourceBundle using <s:actionerror/> or <s:actionmessage/> in Struts2

99封情书 提交于 2019-12-04 06:13:16
问题 I have a properties file (resource bundle). I am trying to show errors in one of the jsp by loading them from properties file. I have an entry as below in my properties file. errors.password.rules=<font color="red">The password you have entered does not meet password strength requirements. Please select a new password that conforms to the following standards:<UL><LI>Minimum length of 8 characters</LI> <LI>Maximum length of 18 characters</LI><LI>At least one upper-case character</LI> <LI>At

Difference between by Application#getResourceBundle() and ResourceBundle#getBundle() in JSF 2.0

天涯浪子 提交于 2019-12-04 04:46:20
问题 In order to retreive Strings from the resourse bundle, i am trying to compare the result from this two methods, below an example for the code: First Example: baseName: The fully qualified name of the resource bundle ( <base-name> in <resource-bundle> ). FacesContext context = FacesContext.getCurrentInstance(); Application app = context.getApplication(); ResourceBundle bundle = app.getResourceBundle(context, baseName); Second Example: varName: is the String representing the <var></var> in

java.util.MissingResourceException: Can't find bundle for base name

巧了我就是萌 提交于 2019-12-04 03:26:44
I'm testing Java's i18n features and have a problem, I can't load the language file when it's not in the class root. Right now my files are in the /lang directory. Looked several answers here in SO, putting it in a classes subdir and loading it like lang.Messages , used complete location routing /Test/lang/Message (test is the project name), using just /lang/Message and still I'm getting the: java.util.MissingResourceException: Can't find bundle for base name error. Anything else to try? My file structure is: Test/lang/Messages_es.properties Test/src/test/Main.java import java.util.Locale;

In Java, how to reload dynamically resources bundles in a web application?

旧巷老猫 提交于 2019-12-04 03:17:20
We are using fmt:setBundle to load a resource bundle from a database (we extended the ResourceBundle class to do that). When we modify a value in database, we have to reload the web server to display the new value on the web app. Is there any simple way to use the new value without restarting the web server ? (We do not want to always look up the value from database but we would like to invalidate the cache, for example by calling a special 'admin' URL) EDIT : We are using JDK 1.4, so I would prefer a solution on that version. :) As others have pointed out in the comments, you might want to

Java Multiple ResourceBundles

别说谁变了你拦得住时间么 提交于 2019-12-03 13:48:51
问题 I want to load multiple property files from various packages as ResourceBundle. Can I achieve that in Java 回答1: Extend java.util.PropertyResourceBundle and call setParent . 回答2: ResourceBundle.Control() controls the list of files for the ResourceBundle. You can overwrite getCandidateLocales and toBundleName. toBundleName converts locale to the "file name" and the list of locales you can control in getCandidateLocales. For example like final String[] variants = new String[]{"your names"};

Why does maven not copy the properties files during the build process?

北战南征 提交于 2019-12-03 10:22:33
Nothing I've found has been able to help me solve this one specific case. I recently switched from a plain old java web app project (which was working) to a maven web project. I get the following runtime exception: java.util.MissingResourceException: Can't find bundle for base name com.myapp.config, locale en I am using Netbeans to create a JSF 2.0, Spring, and Hibernate web app. I have the following directory structure: src\main\java\com\myapp Contains config.properties src\main\resources Empty target\myapp\WEB-INF\classes\com\myapp Contains compiled class files without config.properties src

Tool for checking Java resource bundles (i18n) [closed]

半世苍凉 提交于 2019-12-03 06:14:37
I'm searching for a tool, ant-task, IDE plugin, ... which helps with I18N of a Java application using the standard message-properties resource bundles. Both open source and commercial solutions are welcome. Specifically I'm searching for support in the following tasks: 1) Extract the used keys from Java-code, JSPs and other artifacts. Since custom frameworks are involved the extraction should allow customization. Mapping of the source artifact to a certain message bundle. Also with custom rules. Report used keys which are not in the bundle. Report keys which are in the bundle but in none of

Is there a single rule to cope with single quotes in writing Spring Resource Boundle?

江枫思渺然 提交于 2019-12-03 06:01:54
Spring's ResourceBundleMessageSource uses MessageFormat for replacing placeholders ( {0} ) inside messages. MessageFormat requires that single quotes ( ' ) are escaped using two single quotes ( '' ) (see: MessageFormat Javadoc ). However, by default messages that does not contain any arguments will not be parsed by MessageFormat , so single quotes in messages without arguments don't need to be escaped. So your translator have to be aware of two rules in writing and maintaining resource bundle: write ( '' ) if the message with the single quotes contains at least one placeholders ( {0} ) too;

Java Multiple ResourceBundles

谁都会走 提交于 2019-12-03 03:40:23
I want to load multiple property files from various packages as ResourceBundle. Can I achieve that in Java Extend java.util.PropertyResourceBundle and call setParent . ResourceBundle.Control() controls the list of files for the ResourceBundle. You can overwrite getCandidateLocales and toBundleName. toBundleName converts locale to the "file name" and the list of locales you can control in getCandidateLocales. For example like final String[] variants = new String[]{"your names"}; ResourceBundle.getBundle(baseName, locale, new ResourceBundle.Control() { public List<Locale> getCandidateLocales

How do I avoid repetition in Java ResourceBundle strings?

对着背影说爱祢 提交于 2019-12-03 02:04:31
We had a lot of strings which contained the same sub-string, from sentences about checking the log or how to contact support, to branding-like strings containing the company or product name. The repetition was causing a few issues for ourselves (primarily typos or copy/paste errors) but it also causes issues in that it increases the amount of text our translator has to translate. The solution I came up with went something like this: public class ExpandingResourceBundleControl extends ResourceBundle.Control { public static final ResourceBundle.Control EXPANDING = new