Announcement Announcement Module
No announcement yet.
Resolved Locale/Language Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Resolved Locale/Language

    Is there a way to determine which language/locale is being displayed to the user? For example I have 3 language files: (default english) (french) (german)

    The browser locale is set to "es" (spanish) so it defaults to file. How can I determine which language/properties file is being used by Spring? LocaleResolver picks up the Accept-Header or uses cookies to determine which locale the browser is requesting but not the locale/language the server will use.

    Is there a way to determine which language is actually being used?

  • #2
    A LocaleResolver determines, which locale will be used. Read more here:

    The property file providing the localized message text can only be determined on a per-message-basis. If you need to know the property file for test purposes, it might be a good idea to create copies of your property files and append the loacle name behind each message text. That shouldn't be too hard to do with a proper editor. Then point the context to your copies. This will look very ugly, but will give you the information needed.



    • #3
      You could try using Springs ThreadLocal strategy for setting the current locale for the request thread.