Today I wanted to implement a multi-language greeter for an application, and I ended up on http://www.omniglot.com/language/phrases/welcome.htm
I extracted all the welcomes from the page using jQuery
, serialized
them as JSON
and processed them using Ruby
:
welcomes = x.inject({}) {|h, (lang, val)| val.gsub!(/(.?)/, ''); vals = val.split(%r{\s+/\s+|\n}); vals.map! {|val| val.strip!; val.gsub!(/^\w+ -\s+|- \w+$|^lit.|>.+$/, ''); val.strip!; val}; vals.flatten!; vals.reject!(&:blank?);; h.update(lang => vals) }