Announcement Announcement Module
Collapse
No announcement yet.
get current language (internationalisation) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • get current language (internationalisation)

    how can i determine the current language of the running application in spring controller?
    I need it to know which language to pass for the messageresource.getmessage..

    thx very much

  • #2
    I suggest a read of the I18N chapter in the reference guide... Also in general you want spring to handle the getting of the message instead of you doing that...

    Comment


    • #3
      Come on guys... its not like i didnt do that. ive read http://static.springsource.org/sprin...-messagesource and http://static.springsource.org/sprin...-messagesource. I dont see an example of how to determine the current language. only MessageSource handling, which i already knew.

      Can you please just tell me ?
      thx

      Comment


      • #4
        As I stated read the reference guide (http://static.springsource.org/sprin...localeresolver) use a locale resolver...

        Comment


        • #5
          thx your right. i was at the wrong place

          Comment


          • #6
            If your controller is an annotated @Controller, simply declare method parameter of type java.util.Locale and it will be resolved to "the current request locale (determined by the most specific locale resolver available, i.e. the configured LocaleResolver in a Servlet environment)."

            Comment


            • #7
              how about doing :

              Code:
              if (LocaleContextHolder.getLocale().getDisplayLanguage() =="English")
              regards,
              Emil

              Comment

              Working...
              X