<commit_before>module ActiveAdmin
  module Globalize
    module FormBuilderExtension
      extend ActiveSupport::Concern

      def translated_inputs(name = "Translations", options = {}, &block)
        options.symbolize_keys!
        available_locales = options.fetch(:available_locales, I18n.available_locales.sort)
        switch_locale = options.fetch(:switch_locale, false)
        auto_sort = options.fetch(:auto_sort, true)
        template.content_tag(:div, class: "activeadmin-translations") do
          template.content_tag(:ul, class: "available-locales") do
            (auto_sort ? available_locales.sort : available_locales).map do |locale|
              default = 'default' if locale == I18n.default_locale
              template.content_tag(:li) do
                I18n.with_locale(switch_locale ? locale : I18n.locale) do
                  template.content_tag(:a, I18n.t(:"active_admin.globalize.language.#{locale}"), href:".locale-#{locale}", :class => default)
                end
              end
            end.join.html_safe
          end <<
          (auto_sort ? available_locales.sort : available_locales).map do |locale|
            translation = object.translations.find { |t| t.locale.to_s == locale.to_s }
            translation ||= object.translations.build(locale: locale)
            fields = proc do |form|
              form.input(:locale, as: :hidden)
              form.input(:id, as: :hidden)
              I18n.with_locale(switch_locale ? locale : I18n.locale) do
                block.call(form)
              end
            end
            inputs_for_nested_attributes(
              for: [:translations, translation ],
              class: "inputs locale locale-#{translation.locale}",
              &fields
            )
          end.join.html_safe
        end
      end

      module ClassMethods
      end
    end
  end
end
<commit_msg>default localte option in translated_inputs form builder method<commit_after>module ActiveAdmin
  module Globalize
    module FormBuilderExtension
      extend ActiveSupport::Concern

      def translated_inputs(name = "Translations", options = {}, &block)
        options.symbolize_keys!
        available_locales = options.fetch(:available_locales, I18n.available_locales.sort)
        switch_locale = options.fetch(:switch_locale, false)
        auto_sort = options.fetch(:auto_sort, true)
        default_locale = options.fetch(:default_locale, I18n.default_locale)
        template.content_tag(:div, class: "activeadmin-translations") do
          template.content_tag(:ul, class: "available-locales") do
            (auto_sort ? available_locales.sort : available_locales).map do |locale|
              default = 'default' if locale == default_locale
              template.content_tag(:li) do
                I18n.with_locale(switch_locale ? locale : I18n.locale) do
                  template.content_tag(:a, I18n.t(:"active_admin.globalize.language.#{locale}"), href:".locale-#{locale}", :class => default)
                end
              end
            end.join.html_safe
          end <<
          (auto_sort ? available_locales.sort : available_locales).map do |locale|
            translation = object.translations.find { |t| t.locale.to_s == locale.to_s }
            translation ||= object.translations.build(locale: locale)
            fields = proc do |form|
              form.input(:locale, as: :hidden)
              form.input(:id, as: :hidden)
              I18n.with_locale(switch_locale ? locale : I18n.locale) do
                block.call(form)
              end
            end
            inputs_for_nested_attributes(
              for: [:translations, translation ],
              class: "inputs locale locale-#{translation.locale}",
              &fields
            )
          end.join.html_safe
        end
      end

      module ClassMethods
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.09804928131416837, 'fraction_numerical': 0.007186858316221766, 'mean_word_length': 2.1554655870445343, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4224780', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1050, 'n_words': 218}