×
Table of Contents
Note:
- Resource Bundles must be created under the resource directory
Create a new Resource Bundel with IntelliJ
Click on resources -> Right Click -> NEW -> Resource Bundle -> Provide a Bundle Name -> Add All Resources |
---|
“;[/insert_php] |
Verifiy Resource Bundle Creation
Directory Layout after resource Bundle Creation |
---|
“;[/insert_php] |
Configuring faces-config.xml under WEB-INF folder
de backend backend
Java Code testing Resource
@ManagedBean(name = "editor") @SessionScoped public class EditorBean { .. static { System.out.println("Testing Resource Setup: "); try { Locale locale = Locale.getDefault(); System.out.println("Testing Resource Setup - Current Locale: " + locale); ResourceBundle backend = ResourceBundle.getBundle("backend",locale); Enumerationkeys = backend.getKeys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); String value = backend.getString(key); System.out.println("Testing Resource Setup:" + key + ": " + value); } } catch (Exception e ){ e.printStackTrace();} } .. Logs: Testing Resource Setup: Testing Resource Setup - Current Locale: en_US Testing Resource Setup:MALE: Herr Testing Resource Setup:FEMALE: Frau