Language code list? (ISO 639-1?)

Hi there,

I’m wondering there’s any built-in list or gem that has the list of
language
codes/country names/language names (native/foreign, either’s good) in
it?
Something like a list like this:

I could scrape it from the page and coerce it into a tneable format, but
I
don’t want to reinvent the wheel.

Cheers,
Arlen.

Well, I found this:

http://www.iana.org/assignments/language-subtag-registry

And I did mean a “tenable” format - one which I’d still like, should it
exist. Otherwise this’ll be a piece of cake anyway.

Arlen

Arlen C. wrote:

Hi there,

I’m wondering there’s any built-in list or gem that has the list of
language
codes/country names/language names (native/foreign, either’s good) in
it?
Something like a list like this:

http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

I could scrape it from the page and coerce it into a tneable format, but
I
don’t want to reinvent the wheel.

Cheers,
Arlen.

http://locale.rubyforge.org/svn/trunk/lib/

Regards,

Siep

On Apr 27, 2008, at 1:55 PM, Siep K. wrote:

Arlen C. wrote:

I’m wondering there’s any built-in list or gem that has the list of
language
codes/country names/language names (native/foreign, either’s good) in
it?

[…]

http://locale.rubyforge.org/svn/trunk/lib/

The locale module looks great! It seems like a pretty comprehensive
interface to what you need, but if you happen to need something in one
file, and don’t need predicates and such, the Linguistics gem also has
both the iso639-1 and iso639-2 codes in a module:

http://deveiate.org/projects/Linguistics/browser/trunk/lib/linguistics/iso639.rb

Example usage:

irb(main):001:0> require ‘linguistics/iso639’
=> true
irb(main):002:0> Linguistics::LanguageCodes[‘en’]
=> {:codes=>[“eng”, “en”], :desc=>“English”}
irb(main):003:0> Linguistics::LanguageCodes[‘sog’]
=> {:codes=>[“sog”], :desc=>“Sogdian”}

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs