Welcome! Log In Create A New Profile

Advanced

Re: Multilanguage Websites

Francis Daly
December 31, 2012 12:56PM
On Mon, Dec 31, 2012 at 05:50:14PM +0100, Silvio Siefke wrote:

Hi there,

> Ok, but what ways have nginx? I'm looking for a way for days.

What, precisely, do you mean by "Multilanguage Websites"?

If you mean "separate content for each of language1, language2,
language3; all available at separate urls", then you need no
special web server cleverness after the user has chosen to go to
http://language1.example.org/ or to http://www.example.org/language1/
(depending on how you deploy it).

All you need is for the index page on the "main" web site to offer a
series of links to each of the known separate language index pages.

Have a look at (for example) http://www.wikipedia.org/ or (as you've
previously linked to) http://www.justasysadmin.net/

The former looks like it serves the same content to all; the latter tries
some guessing of preferred language which fails on some of my browsers.


If you want to implement some cleverness on the index page to avoid the
user having to manually choose language, you must decide what you want
the choice to be based on. Whatever you do choose, it may be worth your
while making clear to the user why you chose that one, and what the user
can do to get to the language version they actually prefer.

The HTTP Accept-Language header is probably a reasonable choice, if your
users know how to change it or to override it for your site.

You are unlikely to be able to write a correct interpreter for the
content of that header in the confines of the nginx.conf language.

So you are probably better off writing an application to do it --
maybe in one of the embedded languages, or maybe as external code
altogether. That application will need up-to-date information on which
languages are currently available, so I suggest that external code is
probably simpler to maintain.

> Accept Language looks good, but with Gentoo I can use the module only
> without package manager. The websites in different languages ​​are done,
> I needed a redirect and a default solution.

The only modules used in the nginx.conf versions that you have linked
to are core, map, and rewrite, as far as I can see. I suggest you use
one of the "other server" modules, such as fastcgi.

The only unusual part of nginx.conf would then be special handling for

location = / {}

where you would cause your external code to return either a redirect to
the appropriate language index page, or the content (or a redirect to the
content) of the "here are the various links, click the one you like" page.

If you want to know how to properly interpret the content of the
Accept-Language header, read the RFC or examine (for example) apache's
mod_negotiation.c. You should compare "languages available" with "ordered
list of languages acceptable", being aware of how (for example) "de-DE",
"de-AT", and "de" compare within and between those lists.

It's complicated. That's why I suggest you do it outside of nginx.conf.



If, instead of all of that, you want "same url gives different content
to different clients based on their preferred language", then there's
probably a lot more work involved.

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Multilanguage Websites

Silvio Siefke December 27, 2012 10:30AM

RE: Multilanguage Websites

robotman321 December 27, 2012 11:18AM

Re: Multilanguage Websites

B.R. December 27, 2012 11:38AM

Re: Multilanguage Websites

Silvio Siefke December 27, 2012 12:20PM

Re: Multilanguage Websites

Silvio Siefke December 27, 2012 12:22PM

Re: Multilanguage Websites

Jonathan Matthews December 27, 2012 02:48PM

Re: Multilanguage Websites

Kasper Grubbe December 27, 2012 12:40PM

Re: Multilanguage Websites

Silvio Siefke December 30, 2012 07:08PM

Re: Multilanguage Websites

Jonathan Matthews December 30, 2012 07:18PM

Re: Multilanguage Websites

Silvio Siefke December 31, 2012 11:54AM

Re: Multilanguage Websites

Francis Daly December 31, 2012 12:56PM

Re: Multilanguage Websites

Silvio Siefke January 01, 2013 01:36PM

Re: Multilanguage Websites

Silvio Siefke January 02, 2013 09:30AM

Re: Multilanguage Websites

Francis Daly January 02, 2013 10:06AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 143
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready