README.md in world-flags-0.4.5 vs README.md in world-flags-0.4.7

- old
+ new

@@ -1,9 +1,14 @@ -# Country or language selection with Flag icons +# World Flags -This gem can be used with Rails 3. It includes css files for size 16 and 32 pixels and have all the worlds' flags. See http://spritegen.website-performance.org/ +This engine/gem can be used with Rails 3+. WorldFlags includes css files for flags of the following pixel sizes: +* 16 +* 32 +* 64 +The sprites contains all the main country flags in the world. + ## Configuration In you asset `application.css` manifest file: ```css @@ -14,11 +19,11 @@ *= require flags/flags32 *= require flags/flags32_semi */ ``` -The `flags/basic` stylesheet sets up a basic css for use with borders around the 32 and 64 pixel flag images (to mark selected language). Use this css as inspiration and customize by overriding styles as needed. +The `flags/basic` stylesheet sets up a basic css for use with borders around the flag images (to mark selected language). Use this css as inspiration and customize by overriding styles as needed. There is also support for semi-transparent flags. This can be used to fade certain flags while having the selected flag (or hovered over flag) in full brightness. Simply add or remove the "semi" class for the flag to adjust the brightness level (fx for selection/mouse over). @@ -26,13 +31,12 @@ Flags will be rendered in HTML as: ```html <pre> -<ul class="f32"> - <li class="flag ar" data-cc="ar" data-country="Argentina">Argentina</li> - <li class="flag gb" data-cc="gb" data-country="England">England</li> + <ul class="f32"> + <li class="flag ar selected" data-cc="ar" data-country_name="Argentina" data-language_name="Spanish" data-locale="ar">&nbsp;</li> ... </ul> </pre> ``` @@ -125,9 +129,40 @@ See the [wiki](https://github.com/kristianmandrup/world-flags/wiki/) * [Configuration](https://github.com/kristianmandrup/world-flags/wiki/Configuration) * [Handling flag selection](https://github.com/kristianmandrup/world-flags/wiki/Handling-flag-selection) +## Geo IP + +Include the 'geoip' gem if you want to detect locale based on browser IP location. + +[GeoIP country lite](http://www.maxmind.com/app/geolitecountry) +[GeoIP](http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz) + +Extract and put latest `GeoIP.dat` file in `db/GeoIP.dat` of your Rails app. Alternatively set location via `WorldFlags.geo_ip_db_path = path`. + +The _world-flags_ engine comes pre-packaged with a recent version of `GeoIP.dat` in the `db` folder of the engine itself. + +### Localhosts filtering + +Also set `WorldFlags.localhost_list` if you have localhosts other than the default `127.0.0.1`. + +You can override the default ip passed to the `Geo module by overriding the `browser_ip` method in your controller. Here the default implementation is shown: + +### Fine control of the IP used + +```ruby +def browser_ip + request.remote_ip +end +``` + +Code extract of the locale source logic for browser IP country code detection: + +```ruby +when :ip + ip_country_code(browser_ip) +``` ## TODO for version 1.0 Suggestions welcome ;)