RTL
This gem helps you in checking whether a language is written from right-to-left (RTL) or vise versa.
Installation
Add this line to your application's Gemfile:
gem 'rtl'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rtl
Usage
require 'rtl'
# Query a language by string or symbol.
Rtl.rtl? 'ar' #=> true
Rtl.rtl? :ara #=> true
# By ISO 639 code, (The default) ..
Rtl.rtl? :syc, :iso_code #=> true
Rtl.rtl? :eng #=> false
# By ISO 15924 code ..
Rtl.rtl? 'Hung', :iso_long_code #=> true
# By ISO number ..
Rtl.rtl? 130, :iso_number #=> true
# By unicode alias ..
Rtl.rtl? 'Hebrew', :unicode_alias #=> true
# By full name ..
Rtl.rtl? :Persian, :full_name #=> true
# Get List of all languages by any of the above criteria
Rtl.rtl_languages
#=> ["ar", "ara", "arc", "ae", "ave", "egy", "he", "heb", "nqo", "pal", "phn", "sam", "syc", "syr", "fa", "per", "fas", "ku", "kur"]
Rtl.rtl_languages :iso_long_code
#=> ...
Useful Links
- ISO 639-2 Language Code List - Codes for the representation of names of languages (Library of Congress).
- List of ISO 639-1 codes on Wikipedia.
- Right-to-left on Wikipedia.
- ISO 15924 on Wikipedia.
- Questions & Answers: Which languages are written right-to-left (RTL)?
Contributing
Bug reports and pull requests are very much appreciated at Github.
License
The gem is available as open source under the terms of the MIT License.