Sha256: 1ead8503f483b8f2bbf24b59cdea825af683ff62d32520491b0576ab57b3cb75

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

FB Localizer
======

Description
-----------

Facebook Localizer is a simple gem which converts from Ruby's locale to the
nearest Facebook's locale. Ruby's locales only include the language
information (not the region), but Facebook does. Also, Facebook supports only a subset of all languages in the world.

So, if we want to add a localized "I like it" button into our web page, we need a tool to convert from one to the other.

Note: a more complex algorithm on planning which is the nearest locale
is planned.

Usage
-----

Let's see an example. Say you have a little HAML snippet which loads
Facebook's "I like it" script and shows one. Instead of hardcoding the
locale, as in here:

    %script{:src => "http://connect.facebook.net/en_US/all.js#xfbml=1"}
    %fb:like{:href => request.url, :layout => "button_count", :show_faces => "true"}

You can use this gem to automatically get the adequate extended locale from the
current locale (example, from "en" to "en_US" or from "ca" to "ca_ES"):

    %script{:src => "http://connect.facebook.net/#{get_fb_locale(I18n.locale)}/all.js#xfbml=1"}
    %fb:like{:href => request.url, :layout => "button_count", :show_faces => "true"}

Installation
------------

Simply add this gem to your Gemfile...

    ...
    gem "fb-localizer"
    ...

...and execute "bundle".

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fb-localizer-0.1.3 README.md
fb-localizer-0.1.2 README.md
fb-localizer-0.1.1 README.md