Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6031583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:12:18+00:00 2026-05-23T05:12:18+00:00

i just wanted to know as which language the default messages.properties is read. i

  • 0

i just wanted to know as which language the default messages.properties is read.

i thought that it is the in the faces-config.xml configured default locale is:

<locale-config>
  <default-locale>de</default-locale>
  <supported-locale>de</supported-locale>
  <supported-locale>en</supported-locale>
</locale-config>

it contains no <message-bundle> tag,i created a messages.properties, messages_en.properties and messages_de.properties. To access the values i use this code

ResourceBundle resourceBundle = SeamResourceBundle.getBundle();
String bundleMessage = resourceBundle.getString("key.something");

In the menu i used this to show (and switch) the language what works fine

<h:selectOneMenu value="#{localeSelector.localeString}">
  <f:selectItems value="#{localeSelector.supportedLocales}"/>
</h:selectOneMenu>

Now it doesn’t matter what language i select, je always uses the messages.properties and not _de or _en. Do i need a concrete class for <message-bundle> to find also the _de and _en resource bundles?

EDIT:

ResourceBundle resourceBundle = SeamResourceBundle.getBundle();
java.util.Locale locale = resourceBundle.getLocale();

Contains always the correct locale de or en but always uses messages.properties and if this file is deleted, returns just the key as if he found no other file. The messages*.properties are in the /WEB-INF/classes folder.

i tried now to take Map<String, String> messages = org.jboss.seam.international.Messages.instance(); It contains also the values from messages.properties and not _de or _en

Using #{messages[key.label]} in the *.xhtml file also returns just the messages.properties values but not from _de or _en.

But a messages_de properties or _en directly in the xyz.war file with a <a4j:loadBundle var="i18n" basename="messages"/> does work. (thats how i did the i18n in the “not Java” frontend)

two more tries always return just the default properties and not _de or _en

resourceBundle =  context.getApplication().getResourceBundle(context, "messages");

java.util.Locale locale = new java.util.Locale("de");
resourceBundle = ResourceBundle.getBundle("messages",locale);

if i create a new messages2_de.properties and *_en* and use the code above, everything works fine.

java.util.Locale locale = new java.util.Locale("de");
resourceBundle = ResourceBundle.getBundle("messages2",locale);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:12:19+00:00Added an answer on May 23, 2026 at 5:12 am

    EDIT (Apparently JBoss Seam is a bit different)
    As this document says, you probably should not instantiate bundles yourself.
    Instead, you would define bundles you want to use and let Seam read message for you:

    @In("#{messages['Hello']}") private String helloMessage;
    

    Generally getBundle() method of any of ResourceBundle derived implementations will give you invariant bundle if you omit Locale parameter. This is by design.

    If you need to access localized version, you need to get Locale from UIViewRoot:

    Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
    ResourceBundle resourceBundle = SeamResourceBundle.getBundle();
    String bundleMessage = resourceBundle.getString("key.something");
    

    I am not aware how your localeSelector bean is coded, but it too should set Locale in UIViewRoot.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just wanted to know if it is 100% possible, if my language is
Just wanted to know. What are the differences between java.util.Properties Vs java.util.HashMap<String, String> ?
This really isn't an important question. I just wanted to know which method is
Just wanted to know can i directly run the code which EJB code (adhering
Just wanted to know if it is possible to disallow the whole site for
Just wanted to know if anyone is really using Objects and Collections in Oracle
Just wanted to know if there is a big chance to inject SQL While
Just wanted to know if overriding UITabBarController would get my app rejected? Is it
Just wanted to know if is possible to use mod_rewrite on a single(or more
I just wanted to know your experience with using resharper. We have a very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.