/arabic_helper

A plugin to help you localize your Rails app to arabic, this include few usefull helpers and ActiveRecord localization

Primary LanguageRubyMIT LicenseMIT

ArabicHelper
============
A plugin to help you localize your Rails app to Arabic, this include few useful helpers and ActiveRecord localization.

This plugin is made before Rails 2.2, in Rails 2.2, I18n has been added as part of ActionPack, which is the answer to the need of this plugin. So use it only for versions before 2.2

Arabic Helper consists of two parts, model extension and views helper methods. Model extension is to help you have Arabic error messages and attributes names in your model. Helper methods are made to support, pluralizing, country names and time distance in Arabic.

I’ve been also following the updates in rails-I18n - http://github.com/svenfuchs/rails-i18n/tree/master and did some work on the Arabic locale file, you can find it on: http://github.com/rbarazi/rails-i18n/tree/master. You can simply use it if you are on Rails 2.2 or Rails Edge, or if you are not then use ArabicHelper.

Example
=======

Model extension:

  class Post
    has_arabic_attributes :body    => 'النص',
                          :user_id => 'الكاتب'
  end

View/Controller
  
  @post = Post.first
  @post.arabic_full_messages


Available helpers:

  arabic_country_options_for_select(selected = nil, priority_countries = nil)
  arabic_country_select(object, method, priority_countries = nil, options = {}, html_options = {})
  arabic_time_ago_in_words(from_time, include_seconds = false)
  arabic_distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)
  arabic_pluralize(number, singular, double, plural, gender_class='male')

TODO:
=====
- Write test for helper methods

Copyright (c) 2008 Rida Al Barazi, released under the MIT license