Concise, localized Rails URL helpers? Solved (twice).
posted: May 13th, 2007 · by: Sven
Originally triggered by Jeremy Hubert I’ve posted some thoughts about more concise and transparently localized Rails url_helper methods last month.
Basically Jeremy nailed a problem that occurs as soon as you define a Rails route that includes the locale as the leftmost parameter: you now can’t use Rails’ url_helper methods in a reasonable DRY way any more! A reasonable solution was pending.
Plugins to the rescue. By the end of this article you’ll be able to choose between two different solutions to this problem.
Read the rest of this entryConcise & transparently localized Rails url_helper methods?
posted: April 24th, 2007 · by: Sven
Update: It’s worth noting that the following information has been updated in the follow-up article: Concise, localized Rails URL helpers? Solved (twice).
Recently Jeremy Hubert commented on my tutorial about routes setup for Globalize. In short he criticized that Globalize doesn’t provide a solution for transparently adding the locale to Rails url_helpers where needed. Instead of being able to say:
article_url(@article)
You have to specify the locale for each and every call to an url_helper, like so:
article_url(@current_locale, @article)
Needless to say that this does raise some eyebrows in the Rails community. So let’s see if we can come up with an acceptable solution here. This post describes some intermediary results.
Read the rest of this entryHow to set up your routes? - Get on Rails with Globalize! Part 4 of 8
posted: March 17th, 2007 · by: Sven
Routes are one of the harder-to-grasp areas of Rails. How should you set up your routes for Globalize? Do you need to change anything at all?
As often, the short answer is: it depends. It might well be that you can leave your routes setup completely untouched. Probably they’ll need some easy touches though.
This article tries to provide a (slightly) longer answer and shows some of the basic options you have. (There has been quite some request for a howto on this topic, so I’ve decided to change the original outline of this series).
Read the rest of this entryJoin the release-party: Globalize now ready for Rails 1.2!
posted: March 7th, 2007 · by: Sven
If you haven’t joined the masses yet camping in the front of the doors of the Globalize developers team, eagerly awaiting the Globalize for-1.2 release to get out of the doors … finally, time has come now.
Globalize is now fully compatible with the much celebrated Ruby on Rails 1.2 release! So get your party heads on, use your noise makers and start dancing!
Read the rest of this entryGlobalize's advanced features - Get on Rails with Globalize! Part 3 of 8
posted: January 14th, 2007 · by: Sven
In Part 2 of this series you’ve seen:
- how to setup your application to use Unicode
- how to select and keep the current user’s locale
- how to translate entire templates (instead of individual strings)
- how to translate Rails ActiveRecord messages
In this article we’ll talk about some of the more advanced features Globalize comes with like:
- Abstracting ViewTranslations (sprintf-like usage)
- Singular and (multiple) plural ViewTranslations
- Globalize’s Currency class
- Piggybacking translations of associated models