class String
# Retrieves all the languages detected for the current string
# sorted by confidence.
#
# Requires Linguo::Config.api_key or ENV['LINGUO_API_KEY']
# to be set up.
#
# @example
# "simple text".lang # => ["en", "fr"]
# @return [Array]
def lang
l ||= Linguo.detect(self, Linguo::Config.api_key)
l.detections.map {|x| x['language']}
rescue => e
raise Linguo::Errors::LinguoError, e.message
end
end