Module Amazon::Locale
In: lib/amazon/locale.rb

Use of this module requires the use of the GeoIP library from MaxMind. It also requires the net-geoip Ruby module to interface with it.

Load this library as follows:

 require 'amazon/locale'

Methods

Constants

CA = %w[ ca ]   ISO 3166 codes of countries likely to want to shop in the CA locale.
DE = %w[ at ch de ]   ISO 3166 codes of countries likely to want to shop in the DE locale.
FR = %w[ fr ]   ISO 3166 codes of countries likely to want to shop in the FR locale.
JP = %w[ jp ]   ISO 3166 codes of countries likely to want to shop in the JP locale.
UK = %w[ ad al ba be cy cz dk ee es fi fo gi gr gl ie is it li lt lu lv mk mt nl no pl pt ro se si sk sm uk ]   ISO 3166 codes of countries likely to want to shop in the UK locale.
US = %w[ mx us ]   ISO 3166 codes of countries likely to want to shop in the US locale. Any countries not explicitly listed above default to the US locale.

Public Class methods

This will attempt to return a reasonable locale (ca, de, fr, jp, uk or us) to use for the IP address addr.

For example:

 get_locale_by_addr('217.110.207.55') => "de"

This will attempt to return a reasonable locale (ca, de, fr, jp, uk or us) to use for host.

For example:

 get_locale_by_name('xs1.xs4all.nl') => "uk"

[Validate]