Sha256: 017c0db71701120660c3a6d593b6ce3461b12d4bc15fb038705abe92f1b04cf0
Contents?: true
Size: 462 Bytes
Versions: 56
Compression:
Stored size: 462 Bytes
Contents
require 'ostruct' module I18n def self.name_for_locale(locale) begin I18n.backend.translate(locale, :name, :scope => [:language]) rescue I18n::MissingTranslationData locale.to_s end end def self.all_available_locales records = [] available_locales.each do |locale| records << OpenStruct.new(:code => locale.to_s.downcase, :title => name_for_locale(locale)) end records.sort_by(&:title) end end
Version data entries
56 entries across 56 versions & 3 rubygems