Click to Globalize: rewritten and moved to GitHub

Posted by luca
on Monday, May 12

Click to Globalize has been rewritten, in order to use all instance methods of the JavaScript class, instead of class methods.

I also fixed some tiny issues:

  • The form_authentication_token method is called only if the application is protected against the CSRF attacks (protect_against_forgery? returns true)
  • It uses as parameter key what request_forgery_protection_token returns, instead of the hard-coded authenticity_token
  • The JavaScript class uses Prototype's dom:loaded custom event.

I also migrated the plugin GitHub. The new repo is http://github.com/jodosha/click-to-globalize/tree/master, so the oldest one is deprecated.
Have a nice globalization!

If you enjoyed this post, feel free to recommend me on Working With Rails.

Comments

Leave a response

  1. Nick SmallJune 06, 2008 @ 06:50 AM
    Luca, Rails 2.1 doesn't seem to like the trunk version of Click to Globalize. At least, I can't get it to work. The first page request after I boot up the server returns: undefined local variable or method `click_to_globalize' for #<actionview::base:0x21b2af4> which is being thrown by the <%= click_to_globalize %> call in my layout. Any requests after that result in an ArgumentError in MainController#index: "Callbacks must be a symbol denoting the method to call, a string to be evaluated, a block to be invoked, or an object responding to the callback method." That is the actual error message. Uninstalling Click to Globalize causes this to go away. Any ideas? Thanks a lot, Nick Small
  2. Luca GuidiJune 06, 2008 @ 09:21 PM
    Hi Nick, as you probably know, Click to Globalize is an extension of Globalize, which it still doesn't support the newest Rails version. This is the result of their test suite with a blank Rails 2.1 app:
    210 tests, 529 assertions, 40 failures, 38 errors.
  3. Nick SmallJune 09, 2008 @ 06:19 AM
    Luca, Actually, I've been able to patch Globalize to work just fine with 2.1. It's in their Trac if you're interested. Now for some reason, CtG doesn't like 2.1. I suppose I'll start hacking around inside your code and see if I can find the source of the error... Thanks, Nick
  4. Luca GuidiJune 10, 2008 @ 10:15 AM
    Nick, I'm not able to find your patch on their trac, but just the ticket. I'm figuring out how to fix CtG, but, anyway, I should wait for their fix in trunk. Maybe I'll fork their repo and start to hack around.