Reputation: 2110
I've configured Locale
before in JSF applications, but for some reason I keep getting the following:
java.util.MissingResourceException: Can't find bundle for base name com.cleanup.bundle.messages, locale es
<application>
<resource-bundle>
<base-name>com.cleanup.bundle.messages</base-name>
<var>msg</var>
</resource-bundle>
<locale-config>
<default-locale>es</default-locale>
<supported-locale>en</supported-locale>
</locale-config>
</application>
The .properties
files:
For some reason I just can't make it work, please don't mark as duplicate since I've already verified with these:
My configuration is exactly the same as I've used in the past but.. nothing works, I even tried to set the local to the default locale:
<f:view locale="#{languageBean.locale}">
With a bean like so:
@Named(value = "languageBean")
@SessionScoped
public class LanguageBean implements Serializable {
private Locale locale;
@PostConstruct
public void init() {
locale = FacesContext.getCurrentInstance().getApplication().getDefaultLocale();
}
And for some reason getting the same MissingResourceException
.
Any help is greatly appreciated, thanks.
Upvotes: 1
Views: 876
Reputation: 4345
Select "Files" tab instead, and put the files in the folder
src -> main -> resources (create it if it's not there).
Back on the projects tab, they should turn up under
"Other sources" -> src/main/resources -> default package.
Files tab:
Projects tab:
I'd also remove the package name (or to say, I haven't tried with that).
Upvotes: 2
Reputation: 11
Have you checked your war file. It can be that the maven build is not putting your properties file at the desired location as it picks up the properties from resources folder, so try putting the package structure in resources folder and build again .The maven folder structure is src ---main |-java |-resources |- webapp
Upvotes: 1