title: JSF FacesMessage localization
body: <p>My problem now is that I can't get localization working with FacesMessage</p>
  
  <p>I've tried:</p>
  
  <pre><code>try {
      ResourceBundle bundle = ResourceBundle.getBundle("translations", context.getViewRoot().getLocale());
      text = bundle.getString("loginFail");
  } catch (Exception e) {
      System.out.println("EXCEPTION: " + e);
  }
  
  FacesContext.getCurrentInstance().addMessage("", new FacesMessage(text));
  </code></pre>
  
  <p>but the following exception is thrown</p>
  
  <pre><code>java.util.MissingResourceException: Can't find bundle for base name translations, locale cs
  </code></pre>
  
  <p><strong>faces-config.xml</strong> contains:</p>
  
  <pre><code>&lt;application&gt;
      &lt;locale-config&gt;
          &lt;default-locale&gt;cs&lt;/default-locale&gt;
          &lt;supported-locale&gt;en&lt;/supported-locale&gt;
      &lt;/locale-config&gt;
      &lt;resource-bundle&gt;
          &lt;base-name&gt;tr.translations&lt;/base-name&gt;
          &lt;var&gt;txt&lt;/var&gt;
      &lt;/resource-bundle&gt;
      &lt;message-bundle&gt;
          tr.translations
      &lt;/message-bundle&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p>Files <strong>translations_cs.properties</strong> and <strong>translations_en.properties</strong> are in the tr package, the location is definitely ok.</p>
  
  <p>Do you have any idea how to get it working? 
  Thanks in advance</p>