You would need to get the ACCEPT_LANGUAGE header from the browser and parse it. This is not trivial, because the content of that header is an array of possible languages, each with a different “weight” attribute to govern the fallback order.
If you are running on an Apache server, you should look to see if it has the mod_content_negotiation module installed and enabled. I have an Action that will do everything you need if you have that enabled on your server.
What you would have to do is create (number of languages + 1) home pages for your site, with their filenames precisely like this (for example, if you wanted english and spanish):
index_en.html
index_es.html
index_alternative.html
Then apply the action to the site folder and publish. A new file called index.var will be generated, and the server will work out all of the nuances of which language to serve, in which order, for you.
That index_alternative.html at the end there (and it must be the last [bottom-most] “index” page in your site as listed in the Site pane in Freeway) is there to catch anyone who has specified that they cannot accept any of the preceding languages, not even as a last resort. What would you put on that page? Maybe the Esperanto version? I don’t know…
As far as how you structure the rest of the site, one idea would be to have each language in a separate folder within Freeway, with only the language home pages in the outer-most site folder.
One gotcha to consider: the last page in the folder you’ve applied the Action to will be “dirty” on every publish. So if you have a heavy page at the bottom of the list in your Site pane, you might want to put a blank page after it, just to speed up publishing and uploading. This is something that I had to do in order to keep the index.var file in synch with the site at all times – it’s the result of an Actions API bug.
ContentNegotiation Action is in the usual place: http://freewaypro.com/actions/downloads and if you search the archives here, you will find a thread about it, and somebody who has used it in production (I haven’t).
Walter
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options