Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-2282

Override default locale per application

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.2.4
    • 1.4.x
    • Core
    • None
    • Operating System: Linux
      Platform: PC
    • 32242

    Description

      As far as I understand it - the struts framework will set the locale in the
      users session to Locale.getDefault() when

      1) The session value for locale is not already set
      and
      2) The users browser has not sent an Accept-Language header

      So - to set a default locale for an application you need to set the default
      locale for the application's JVM.

      Under JBoss (maybe others) - one JVM is shared across applications. This means
      that it is not possible to handle the situation where one struts app needs lang1
      as default and one struts app needs lang2 as default.

      Concrete example

      App1 has the following property files (and should default to english)

      app1.properties (in english)
      app1_no.properties (norwegian)
      app1_da.properties (danish)

      App2 has the following property files (and should default to norwegian)

      app2.properties (in norwegian)
      app2_en.properties (english)

      System locale is english.

      This means that app2 actually defaults to english since system locale is in
      english and app2 has an english properties file.

      It would be nice to be able to set at struts-config.xml level (perhaps
      controller section) an

      <default-language>no</default-language>

      so that you can override the default locale on a per application basis.

      Note - all other locale based stuff is working well - this is just talking about
      the initialisation of the session locale based on default locale.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              chris@empolis.no Chris Searle
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: