Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Helpers to allow saving multiple Globalize3 translations in the same request

branch: master

This branch is 0 commits ahead and 0 commits behind master

Merge pull request #4 from webervin/bd7c727956e065164eb3b18150e014468…


Enables simple_form goodness to make translation forms even simplier
latest commit bd756ebb9b
Szymon Fiedler authored
Octocat-spinner-32 lib Support for SimpleForm if available October 05, 2011
Octocat-spinner-32 README.rdoc added readme file September 16, 2010
Octocat-spinner-32 init.rb Initial commit November 11, 2009

Batch translation

Helper that renders globalize_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.


Batch translation supports Globalize 3 and is not backward compatible.

rails plugin install git://

Model configuration

In model, which uses Globalize after definition

translates :title, :teaser, :body # or any other fields, which you translate


accepts_nested_attributes_for :translations

so it'll look like

class Post < ActiveRecord::Base
  translates :title, :teaser, :body
  accepts_nested_attributes_for :translations

It's necessary for proper working.


Now, use it in your view file, like in these below:

<h1>Editing post</h1>

<% form_for(@post) do |f| %>
  <%= f.error_messages %>

  <h2>English (default locale)</h2>
  <p><%= f.text_field :title %></p>
  <p><%= f.text_field :teaser %></p>
  <p><%= f.text_field :body %></p>


  <h2>Spanish translation</h2>
  <% f.globalize_fields_for :es do |g| %>
    <p><%= g.text_field :title %></p>
    <p><%= g.text_field :teaser %></p>
    <p><%= g.text_field :body %></p>
  <% end %>


  <h2>French translation</h2>
  <% f.globalize_fields_for :fr do |g| %>
    <p><%= g.text_field :title %></p>
    <p><%= g.text_field :teaser %></p>
    <p><%= g.text_field :body %></p>
  <% end %>

  <%= f.submit "Save" %>
<% end %>


Copyright © 2010 Szymon Fiedler, released under MIT License.

Something went wrong with that request. Please try again.