Forum Discussion

Farsheed_Solima's avatar
Farsheed_Solima
Icon for Nimbostratus rankNimbostratus
Aug 29, 2013

Changing interface language explicitly regardless of HTTP header

Hello Everyone,

 

I would like to change a page's language explicitly - regardless of what is sent in the HTTP header. A practical example is that I need to show English by default and have a link in the page to French language interface. I need this both in the login page, and in the webtop.

 

I also need to detect what language is being displayed and change URLs based on that.

 

Any help is appreciated.

 

Thanks,

 

Farsheed

 

2 Replies

  • While I have not tried this, I would think you could use "HTTP::header replace" to modify the "Accept-Language:" portion of the HTTP Header in all requests, specifying ONLY the language you want.

     

    HTTP::header replace []

     

    Good luck!

     

    David

     

  • David's right on the money with HTTP::header replace:

    HTTP::header replace "Accept-Language" "en"
    

    This can be used in a request or response, but in this case you'd be replacing a request header. As for performing URI-switching logic based on the requested language:

    when HTTP_REQUEST {
        switch [HTTP::header "Accept-Language" {
            "en" {
                HTTP::uri "/en/something/"
            }
            "fr" {
                HTTP::uri "/fr/something"
            }
            ...
        }
    }
    

    You mentioned a "webtop", so if this is being used with APM, replace HTTP_REQUEST with ACCESS_ACL_ALLOWED.