Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

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

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 11 comments
Closed

Comments

@openstreetmap-trac
Copy link

Reporter: avarab[at]gmail.com
[Submitted to the original trac issue database at 11.17am, Tuesday, 9th June 2009]

rails-i18n can support [http://guides.rubyonrails.org/i18n.html#using-geoip-or-similar-database setting locale] based on the free of charge [http://www.maxmind.com/app/geolitecountry 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.

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 1.39pm, Tuesday, 9th June 2009]

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.

@openstreetmap-trac
Copy link
Author

Author: dan[at]karran.net
[Added to the original trac issue at 3.15pm, Tuesday, 9th June 2009]

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.

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 3.17pm, Tuesday, 9th June 2009]

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.

@openstreetmap-trac
Copy link
Author

Author: avarab[at]gmail.com
[Added to the original trac issue at 3.18pm, Tuesday, 9th June 2009]

Replying to [comment:1 tom[at]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 ;(

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 3.20pm, Tuesday, 9th June 2009]

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.

@openstreetmap-trac
Copy link
Author

Author: avarab[at]gmail.com
[Added to the original trac issue at 3.31pm, Tuesday, 9th June 2009]

Replying to [comment:5 tom[at]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.

@openstreetmap-trac
Copy link
Author

Author: StefanB
[Added to the original trac issue at 7.29am, Wednesday, 10th June 2009]

Replying to [comment:3 tom[at]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)

@openstreetmap-trac
Copy link
Author

Author: StefanB
[Added to the original trac issue at 11.32pm, Thursday, 9th July 2009]

Replying to [comment:3 tom[at]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.

@openstreetmap-trac
Copy link
Author

Author: avarab[at]gmail.com
[Added to the original trac issue at 12.23am, Friday, 10th July 2009]

Replying to [comment:8 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 [http://www.openstreetmap.de/ "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.

@openstreetmap-trac
Copy link
Author

Author: StefanB
[Added to the original trac issue at 3.47pm, Friday, 24th July 2009]

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

@openstreetmap-trac
Copy link
Author

Author: TomH
[Added to the original trac issue at 3.20pm, Sunday, 28th March 2010]

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant