def areas_select(name, collection, options = {})
      selectables = if collection.first.is_a?(Decidim::Area)
                      assemblies = collection
                                   .map { |a| [a.name[I18n.locale.to_s], a.id] }
                                   .sort_by { |arr| arr[0] }

                      @template.options_for_select(
                        assemblies,
                        selected: options[:selected]
                      )
                    else
                      @template.option_groups_from_collection_for_select(
                        collection,
                        :areas,
                        :translated_name,
                        :id,
                        :translated_name,
                        selected: options[:selected]
                      )
                    end

      select(name, selectables, options)
    end
def areas_select(name, collection, options = {})
      selectables = if collection.first.is_a?(Decidim::Area)
                      assemblies = collection
                                   .map { |a| [a.name[I18n.locale.to_s], a.id] }
                                   .sort_by { |arr| arr[0] }

                      @template.options_for_select(
                        assemblies,
                        selected: options[:selected]
                      )
                    else
                      @template.option_groups_from_collection_for_select(
                        collection,
                        :areas,
                        :translated_name,
                        :id,
                        :translated_name,
                        selected: options[:selected]
                      )
                    end

      select(name, selectables, options)
    end
Public: Generates a select field for areas.

 name       - The name of the field (usually area_id)
 collection - A collection of areas or area_types.
              If it's areas, we sort the selectable options alphabetically.

 Returns a String.