def translated_field_tag(type, object_name, name, value = {}, options = {})
      locales = available_locales

      field_label = label_tag(name, options[:label])

      if locales.count == 1
        field_name = "#{name}_#{locales.first.to_s.gsub("-", "__")}"
        field_input = send(
          type,
          "#{object_name}[#{field_name}]",
          value[locales.first.to_s]
        )

        return safe_join [field_label, field_input]
      end

      tabs_id = options[:tabs_id] || "#{object_name}-#{name}-tabs".underscore
      enabled_tabs = options[:enable_tabs].nil? ? true : options[:enable_tabs]
      tabs_panels_data = enabled_tabs ? { tabs: true } : {}

      label_tabs = content_tag(:div, class: "label--tabs") do
        tabs_panels = "".html_safe
        if options[:label] != false
          tabs_panels = content_tag(:ul, class: "tabs tabs--lang", id: tabs_id, data: tabs_panels_data) do
            locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
              string + content_tag(:li, class: tab_element_class_for("title", index)) do
                title = I18n.with_locale(locale) { I18n.t("name", scope: "locale") }
                element_class = nil
                element_class = "is-tab-error" if form_field_has_error?(options[:object], name_with_locale(name, locale))
                tab_content_id = "#{tabs_id}-#{name}-panel-#{index}"
                content_tag(:a, title, href: "##{tab_content_id}", class: element_class)
              end
            end
          end
        end

        safe_join [field_label, tabs_panels]
      end

      tabs_content = content_tag(:div, class: "tabs-content", data: { tabs_content: tabs_id }) do
        locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
          tab_content_id = "#{tabs_id}-#{name}-panel-#{index}"
          string + content_tag(:div, class: tab_element_class_for("panel", index), id: tab_content_id) do
            send(type, "#{object_name}[#{name_with_locale(name, locale)}]", value[locale.to_s], options.merge(id: "#{tabs_id}_#{name}_#{locale}", label: false))
          end
        end
      end

      safe_join [label_tabs, tabs_content]
    end
def translated_field_tag(type, object_name, name, value = {}, options = {})
      locales = available_locales

      field_label = label_tag(name, options[:label])

      if locales.count == 1
        field_name = "#{name}_#{locales.first.to_s.gsub("-", "__")}"
        field_input = send(
          type,
          "#{object_name}[#{field_name}]",
          value[locales.first.to_s]
        )

        return safe_join [field_label, field_input]
      end

      tabs_id = options[:tabs_id] || "#{object_name}-#{name}-tabs".underscore
      enabled_tabs = options[:enable_tabs].nil? ? true : options[:enable_tabs]
      tabs_panels_data = enabled_tabs ? { tabs: true } : {}

      label_tabs = content_tag(:div, class: "label--tabs") do
        tabs_panels = "".html_safe
        if options[:label] != false
          tabs_panels = content_tag(:ul, class: "tabs tabs--lang", id: tabs_id, data: tabs_panels_data) do
            locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
              string + content_tag(:li, class: tab_element_class_for("title", index)) do
                title = I18n.with_locale(locale) { I18n.t("name", scope: "locale") }
                element_class = nil
                element_class = "is-tab-error" if form_field_has_error?(options[:object], name_with_locale(name, locale))
                tab_content_id = "#{tabs_id}-#{name}-panel-#{index}"
                content_tag(:a, title, href: "##{tab_content_id}", class: element_class)
              end
            end
          end
        end

        safe_join [field_label, tabs_panels]
      end

      tabs_content = content_tag(:div, class: "tabs-content", data: { tabs_content: tabs_id }) do
        locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
          tab_content_id = "#{tabs_id}-#{name}-panel-#{index}"
          string + content_tag(:div, class: tab_element_class_for("panel", index), id: tab_content_id) do
            send(type, "#{object_name}[#{name_with_locale(name, locale)}]", value[locale.to_s], options.merge(id: "#{tabs_id}_#{name}_#{locale}", label: false))
          end
        end
      end

      safe_join [label_tabs, tabs_content]
    end
A custom helper to include a translated field without requiring a form object.

 type        - The type of the translated input field.
 object_name - The object name used to identify the Foundation tabs.
 name        - The name of the input which will be suffixed with the corresponding locales.
 value       - A hash containing the value for each locale.
 options     - An optional hash of options.
             * enable_tabs: Adds the data-tabs attribute so Foundation picks up automatically.
             * tabs_id: The id to identify the Foundation tabs element.
             * label: The label used for the field.

 Returns a Foundation tabs element with the translated input field.