Localization Policy

After some deliberation, we have decided to simplify ActiveScaffold’s position on localization. When we first started to embrace localization, we thought it was as simple as providing some language files and having a setting to determine the locale. After feedback from devs using ActiveScaffold, and after more personal experience of our own, we have decided to simplify.

From now on, what we will try and do is make ActiveScaffold cooperate as best it can with your needs by providing a hook into all the strings for which ActiveScaffold is responsible. What we will not do is actually attempt any localization. Here’s a break-down of what this means:

What we will try and do:
  • Use a unique overridable method pervasively. This method will be Object#as_(). There are still some places we’ve missed, and we’ll try and fill these in soon.
  • Provide the Object#as_() method with everything it needs to inform your translation. At minimum you should have a simple and easily-translated string. Due to the configurable nature of ActiveScaffold, we won’t be able to tell you its plurality (we generally don’t even know).
  • Make sure that any call to Object#as_() happens after the session is known, so that you have the chance to know what the target locale should be.
What you must do:
  • Build and maintain the translation table.
  • Override the Object#as_() method to interface with your localization system.
  • Hook into Rails internals to harvest and translate its built-in strings that ActiveScaffold happens to use (like True/False, error_messages_for, months in the datetime selectors, etc.)
  • Pick the proper locale for your user

Now this policy still leaves open the opportunity for the ActiveScaffold community to share the work of localization. It is our hope that people will make available translation tables using an add-on plugin, wiki pages, or whatever you all find convenient.

Our goal with this policy is to get out of your way and let you do localization as you see fit. With ActiveScaffold we are solving the problems of a basic data presentation pattern, and that’s where we want to keep our focus. But we realize that you have international needs, and we want to at least provide you with a means to fill those needs.

Feedback is welcome! If you find a situation where we are not fulfilling our responsibilities, let us know in the Google group or the issue tracker.

  1. Did you have a look at GetText (How-To at http://manuals.rubyonrails.com/read/chapter/105)? I used it to localize several Rails projects and actually you just provide language files and set the locale. Of course you have to use a special method for Strings to be localized which is gettext(“Foo”) or more convinient _(“Foo”).

Sorry, comments are closed for this article.