def localized_locales(collection = Decidim.available_locales)
      klass = Class.new do
        def initialize(locale)
          @locale = locale
        end

        def id
          @locale.to_s
        end

        def name
          I18n.with_locale(@locale) { I18n.t("name", scope: "locale") }
        end
      end

      collection.map { |locale| klass.new(locale) }
    end
def localized_locales(collection = Decidim.available_locales)
      klass = Class.new do
        def initialize(locale)
          @locale = locale
        end

        def id
          @locale.to_s
        end

        def name
          I18n.with_locale(@locale) { I18n.t("name", scope: "locale") }
        end
      end

      collection.map { |locale| klass.new(locale) }
    end
Converts a given array of strings to an array of Objects representing
 locales.

 collection - an Array of Strings. By default it uses all the available
   locales in Decidim, but you can passa nother collection of locales (for
   example, the available locales for an organization)