Localise error pages?

Igor Sysoev igor at sysoev.ru
Thu Apr 7 16:25:29 MSD 2011


On Thu, Apr 07, 2011 at 01:56:42PM +0300, Pekka.Panula at sofor.fi wrote:
> Hi
> 
> Is there any way to localise nginx to give its error pages in different 
> language? 
> I think brower tells in headers what languages it supports, can it somehow 
> to use to give localised version of error messages?

In 0.9.6+ you can try

http {

    map  $http_accept_language  $lang {
         default                en;
         ~^(?<LNG>fr|fi|zh|ru)  $LNG;
    }

    server {
        error_page  404  /errors/404.html;

        location /errors/ {
            root   /path/to/pages/$lang/;
        }

        ...
    }


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list