Language code list? (ISO 639-1?)

A

Arlen Cuss

[Note: parts of this message were removed to make it a legal post.]

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.
 
S

Siep Korteling

M

Michael Granger

Arlen said:
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"}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top