[Sussex] A little help with I18n on the web
Nic Ferrier
nferrier at tapsellferrier.co.uk
Tue Jan 17 18:39:42 UTC 2006
Steve Dobson <steve at dobson.org> writes:
> I want the system to be I18n capable. I want to get the locale info
> from the client's system when they connect so that I can server
> dates, number, etc... (as well as the text when I get the translations
> done) in the format for their locale. i.e. The US gets it's broken
> date format, we get the proper one.
>
> So far I have done no I18n stuff in my code, I have tried some of the
> config on the applications server - nothing has done what I want.
>
> Q1: How do you configure Firefox to have a different locale?
> (Couldn't find the menu option - is it a plugin, and if so
> which one?)
You can use the modify-headers extension:
https://addons.mozilla.org/extensions/moreinfo.php?id=967&application=firefox
to set any HTTP header you want including Accept-Language header.
> I have configured Mozilla to have a fr-fr locale (the only one
> configured) but when I make requests to Apache the access logs just show
> a en-US request. Thus:
> /1.1" 404 1018 "http://../..." "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5"
That's the build of the UA. Not the locale.
i18n on the web is done with content arbitration, the Accept-***
HTTP headers.
> Q2: Why isn't Mozilla requesting a fr-fr page? Is there something I
> need to do in Apache2? (Config of Apache is how it came from Debian
> except for my virtual hosts).
You need to set your accept language to French so you send the header:
Accept-Language: fr
you can sniff the HTTP requests with ngrep to make sure moz is sending
what it should or just install the moz extension which allows you to
check headers (WebDeveloper).
> Q3: Is there something I need to do to get Apache to forward the
> locale on to the app server?
I don't think so... I think the Accept-Language header is passed
through and Java makes the call based on that.
> Q4: Anything else you think I should know?
Character encoding is also an issue. Solved with
Accept-encoding. Depends what locales you're dealing with.
Nic Ferrier
More information about the Sussex
mailing list