Coder Social home page Coder Social logo

i18n_country_select's Introduction

<img src=“https://travis-ci.org/onomojo/i18n_country_select.svg?branch=master” alt=“Build Status” />

Country Code Select

A simple country code select helper with I18n translations for the countries. Works exactly the same as country_select but uses country codes instead and has i18n translations for the country names.

NOTE: The old country_code_select repository that this one was forked from is outdated and no longer maintained. This i18_country_select repository is the most current.

Installation

Put the following in your Gemfile

gem 'i18n_country_select'

Example

Simple use supplying model and attribute as parameters:

country_code_select(:user, :country)

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

country_code_select(:user, :country, [[ 'US', 'United States' ], [ 'CA', 'Canada' ]])

Specifying different selected value:

country_code_select(:user, :country, [], selected: 'CA')

Based on the deprecated country_code_select by: Russ Smith ([email protected]) and Frank Wambutt ([email protected])

License

MIT or GPL

i18n_country_select's People

Contributors

bjoernkw avatar charly avatar dmilisic avatar durandom avatar heldersilva avatar ian avatar ivayloap avatar karl-petter avatar leods92 avatar maratgaliev avatar mason-stewart avatar mortik avatar mstark avatar onomojo avatar opinel avatar pronix avatar rachel-carvalho avatar russ avatar timvoet avatar wizardone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

i18n_country_select's Issues

i18n version dependency

This gem depends on the i18n gem as written in the Gemfile:

s.add_dependency('i18n', '~> 0.9.3')

While trying to update other components, we have the issue that as of now, i18n is at 1.8.2 which does not seem to be compatible here.

Any chance this could be resolved? Is there any breaking changes in i18n that would prevent loosing this dependency to something like s.add_dependency('i18n', '>= 0.9.3')

Thanks

Duplicate Locale Country List

With locale -> zh-CN

This code -> country_code_select(:user, :country)

Generates list of countries in English and Chinese inside one dropbox

ZZ: Unknown Region

There is a select option for the "Unknown Region" with key "ZZ" available.
What is the purpose of this entry?

I'd propose to remove it as this breaks the intent to select a known country on earth. If the country is not known to the user, a blank option is enough to indicate this or the application should deal with it otherwise.

What do you think?

Feature: custom selected value

I believe there's currently no way to force a selected value besides the field value. It would be nice if options accepted selected: 'country_code', just like the regular select. I could work on a pull request for this, let me know.

Åland Islands is missing

Is there a reason why the countries that are included in the select is not in sync with the countries available in the i18n_country_select gem? The one I need included is AX, Åland Islands.

I18n.backend.send(:translations)[:en][:countries].keys.map(&:to_s) - I18nCountrySelect::Countries::COUNTRY_CODES

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.