Opened 10 years ago

Closed 9 years ago

#1941 closed enhancement (wontfix)

Select rail-i18n locale based on GeoIP in addition to Accept-Language

Reported by: avar Owned by: Tom Hughes
Priority: minor Milestone:
Component: website Version:
Keywords: Cc:

Description

rails-i18n can support setting locale based on the free of charge GeoLite database.

It might be a good idea to modify rails to serve languages per-country as well as based on Accept-Language headers by default. With some sort of white/black-list for countries where this makes sense at all.

Change History (11)

comment:1 Changed 10 years ago by Tom Hughes

Well we won't be suing GeoLite?, but we could use hostip as we already do to choose the default map location.

How would we decide which to prefer though? If we only do GeoIP when the browser doesn't specify a language then we would use it only very rarely so it doesn't seem worth the bother.

comment:2 Changed 10 years ago by Dan Karran

I would think that the browser language should take priority if the user doesn't already have a language set in their profile. If they have a language set, that should always take priority over any other indicators (unlike Google likes to do when travelling to other places). I don't know how many browsers have the local language set, but I imagine it'd be quite high, like Tom suggests.

On a related topic, it would be nice if the site told you when it first detected your language, and gave you a link to your profile to change your preferred language if you wish. This could be useful if you are, for example, in an internet cafe the first time you log into your account since the introduction of languages the other week.

comment:3 Changed 10 years ago by Tom Hughes

Yes we know the site needs a link to override the language - when somebody finds somewhere to put it please let me know and I'll add it.

comment:4 Changed 10 years ago by avar

Replying to tom@compton.nu:

How would we decide which to prefer though? If we only do GeoIP when the browser doesn't specify a language then we would use it only very rarely so it doesn't seem worth the bother.

I had Icelandic in mind where most computer users are using Vanilla en-US Windows systems simply because localized versions aren't wanted / commercially viable for such a small market.

So practically I was hoping to be able to override Accept-Language in select cases on openstreetmap.org, like if the IP was in Iceland and Accept-Language was English and if no language preference was set.

That may all be a bit to ad-hoc to be viable, and would not dwym if you set Accept-Language explicitly in your OS to say you really did want English ;(

comment:5 Changed 10 years ago by Tom Hughes

Resolution: wontfix
Status: newclosed

People can still set a preferred language in their browser even if they're using an English OS install - at least with decent browsers they can ;-)

I think adding a link that sets a long term cookie to indicate language preference is going to be better than trying GeoIP games to second guess the browser settings.

comment:6 in reply to:  5 Changed 10 years ago by avar

Replying to tom@compton.nu:

People can still set a preferred language in their browser even if they're using an English OS install - at least with decent browsers they can ;-)

They can, but pretty much nobody does. Which is why big players like Google do automagic detection of what language someone might want using other means, including GeoIP.

Not that I'm recommending such automagic, some sort of language selection is probably better, and Google automagic annoys me personally.

comment:7 in reply to:  3 Changed 10 years ago by StefanB

Replying to tom@compton.nu:

Yes we know the site needs a link to override the language - when somebody finds somewhere to put it please let me know and I'll add it.

There could be special locations /lang/de /lang/en /lang/it /lang/:locale

These locations would override user's locale (saving into long term cookie) and redirect back to

  • returnUrl parameter if given
  • the http referrer if exists
  • main page

Instead of having these in a /lang directory they could also be in root if it doesn't cause any conflict (as far as i checked our routes, there would be no conflict with anything else).

Sample: http://www.yotabanana.com/locale_rails_sample/ http://guides.rubyonrails.org/i18n.html

another idea would be to have that located at /:lang/path/in/existing/website which would (after setting the language overriding cookie) redirect to /path/in/existing/website

This would make it easy to switch between languages, while keeping the url the same for all users, regardless of language (we could skip the redirection for search engine spiders so all translations are indexed)

comment:8 in reply to:  3 ; Changed 10 years ago by StefanB

Resolution: wontfix
Status: closedreopened

Replying to tom@compton.nu:

Yes we know the site needs a link to override the language - when somebody finds somewhere to put it please let me know and I'll add it.

Another idea would be to use various country TLDs for their languages. Alternatively, language subdomains of the main site could be generated for those languages that are translated (eg more than 50% of phrases are translated).

Both options would require no or very little change in the website itself.

I'm sure domain owners would gladly point their DNS records towards main website, or even donate the domains to OSMF if it wants to own them and promises to renew them regularly. See also http://www.openstreetmap.org/user/balrog-kun/diary/6983

In case of country TLDs we could also have localizable lat, lon and zoom to provide initial view onto desired region.

comment:9 in reply to:  8 Changed 10 years ago by avar

Replying to StefanB:

I'm sure domain owners would gladly point their DNS records towards main website, or even donate the domains to OSMF if it wants to own them and promises to renew them regularly. See also http://www.openstreetmap.org/user/balrog-kun/diary/6983

Most likely no. That diary entry is the exception. Most of those language domains are hosting sites with a different purpose than the main OSM site, see the OSM International link list on openstreetmap.de.

In case of country TLDs we could also have localizable lat, lon and zoom to provide initial view onto desired region.

We already zoom to country based on GeoIP by default.

comment:10 Changed 10 years ago by StefanB

Since my server died i pointed the DNS records of openstreetmap.si towards openstreetmap.org in hopes it will be served in Slovenian :)

comment:11 Changed 9 years ago by Tom Hughes

Resolution: wontfix
Status: reopenedclosed

I'm going to close this - we're not going to do language selection on the basis of GeoIP and there is a new ticket #2838 which covers the need for a language selection link without all the confusing history on this ticket.

Note: See TracTickets for help on using tickets.