title: Using the gem globalize, how to switch locales for input only and not the whole page?
body: <p><strong>Context:</strong> For a Ruby on Rails app for bike rentals, I am using the gem globalize to deal with input <code>:description</code> in different languages. </p>
  
  <p><strong>Curent state:</strong> The globalize implementation worked, depending on my locale I am able to store <code>description</code> in a specific language. The input for <code>:description</code> is dealt with on the basis of the locale of an entire webpage.</p>
  
  <p>This means that everything on this page has to change in language in order to store <code>:description</code> in the correct language.</p>
  
  <p>Alternatively, I am also able to show all available locales and show <code>description</code> for each of them. (See also the commented out code below).  </p>
  
  <p><strong>Question:</strong> I'm searching for a way to let the user select a language for <code>:description</code> only and then save <code>:description</code> in the correct language without changing the language of the entire webpage.</p>
  
  <p><strong>Code</strong></p>
  
  <p>form</p>
  
  <pre><code>&lt;div class="row"&gt;
          &lt;%# I18n.available_locales.each do |locale| %&gt;
            &lt;!-- &lt;h1&gt;&lt;%#= locale %&gt;&lt;/h1&gt; --&gt;
            &lt;%= f.globalize_fields_for locale do |ff| %&gt;
            &lt;div class="col-10"&gt;
              &lt;div class="form-group"&gt;
                &lt;label class="form-control-label text required" for="accommodation_category_description"&gt;Description&lt;/label&gt;
                &lt;div&gt;&lt;%= ff.text_area :description, :rows =&gt;"5", :cols =&gt;"30",  class:"form-control is-valid text required" %&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;% end %&gt;
          &lt;%# end %&gt;
          &lt;/div&gt;
        &lt;/div&gt;
  </code></pre>
  
  <p>initializers/globalization.rb</p>
  
  <pre><code>module ActionView
    module Helpers
      class FormBuilder
        #
        # Helper that renders translations fields
        # on a per-locale basis, so you can use them separately
        # in the same form and still saving them all at once
        # in the same request.
  
        def globalize_fields_for(locale, *args, &amp;proc)
          raise ArgumentError, "Missing block" unless block_given?
          @index = @index ? @index + 1 : 1
          object_name = "#{@object_name}[translations_attributes][#{@index}]"
          object = @object.translations.find_by_locale locale.to_s
          @template.concat @template.hidden_field_tag("#{object_name}[id]", object ? object.id : "")
          @template.concat @template.hidden_field_tag("#{object_name}[locale]", locale)
          @template.fields_for(object_name, object, *args, &amp;proc)
        end
      end
    end
  end
  
  </code></pre>