You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

language_select

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

language_select

0.0.2
bundlerRubygems
Version published
Maintainers
1
Created
Source

Rails – Language Select

Build Status

Provides a simple helper to get an HTML select list of languages using the ISO 639-1 standard.

Uses the two letter alpha codes to identify the language.

Installation

Install as a gem using

gem install language_select

Or put the following in your Gemfile

gem 'language_select'

Example

Simple use supplying model and attribute as parameters:

language_select("user", "language")

Supplying priority languages to be placed at the top of the list:

language_select("user", "language", [ "English", "French", "German" ])

The language is stored using the ISO-639-1 two letter codes.

Getting the Language from ISO codes

class User < ActiveRecord::Base

  def language_name
    ::LanguageSelect::LANGUAGES[language]
  end

end

Tests

bundle
bundle exec rspec

Running with multiple versions of actionpack

bundle exec appraisal

Copyright (c) 2013 Apide ApS, released under the MIT license

FAQs

Package last updated on 02 Jan 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts