title: Add Resource Bundles Programmatically
body: <p>I have a <code>faces-config.xml</code> file with some resource bundles declared, like this:</p>
  
  <pre><code>&lt;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"&gt;
      &lt;application&gt;
          &lt;locale-config&gt;
              &lt;default-locale&gt;en&lt;/default-locale&gt;
              &lt;supported-locale&gt;de&lt;/supported-locale&gt;
              &lt;supported-locale&gt;es&lt;/supported-locale&gt;
              &lt;supported-locale&gt;pt&lt;/supported-locale&gt;
              &lt;supported-locale&gt;zh&lt;/supported-locale&gt;
          &lt;/locale-config&gt;
          &lt;resource-bundle&gt;
              &lt;base-name&gt;messages.Messages&lt;/base-name&gt;
              &lt;var&gt;bundle&lt;/var&gt;
          &lt;/resource-bundle&gt;
          &lt;resource-bundle&gt;
              &lt;base-name&gt;countries.Countries&lt;/base-name&gt;
              &lt;var&gt;countryBundle&lt;/var&gt;
          &lt;/resource-bundle&gt;
      &lt;/application&gt;
  &lt;/faces-config&gt;
  </code></pre>
  
  <p>These resource bundles are registered and can be used in any <code>.xhtml</code> file, but is there any way to register these resource bundles programmatically? I mean by the use of dynamic code instead of a <code>xml</code> declaration.</p>