[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PhillyOnRails] Thanks! And topic idea.
|
It may actually be code duplicated in Globalize. Last I used Globalize, I ended up hacking it up so much, that I wrote something else. My plugin is going to end up throwing a lot more tables all over your database. In the given example, it's going to make question_titles, and question_bodies tables.
Yeah, after reading more about how Globalize does this -- it might be best if I don't present this option -- it's way too close to what's already built-in, and is probably the wrong choice for 99% of cases. It will, however, plug in to any i18n system. You just have to pass it a proc to tell it how to get the current locale(s).
On 2/28/07, Mat Schaffer <schapht@gmail.com> wrote:
On Feb 28, 2007, at 11:26 AM, Mark Chadwick wrote: > I recently wrote a acts_as_translatable plugin. It meshes well > with Globalize (or similar). The idea is to have translatable > fields on models where it doesn't really fit in to pre-translated
> strings. For example: > > I have a product that asks users questions. The questions are in > the DB, and users can make their own questions. I want the same > questions to be asked to everyone, but I want it to be the the
> correct language, so: > > class Question < AR::Base > acts_as_translatable [:title, :body] > end > > And in the migration: > Question.create_translated_tables >
> That way, when I have a Question, and I do <%= question.body %>, > It's going to check with Globalize, see what the current language > is, and display the correct translation. > > Well. That was quite a spiel. Anyone want to see a presentation on
> that?
So this works in conjunction with Globalize? It seems like the same functionality as the function 'translates' that globalize adds to AR::Base. So:
class Question < AR::Base
translates :title, :body end
The only difference I see is the migration, where globalize uses the master translation table to store the translated text. Is this option more efficient perhaps? -Mat
_______________________________________________ To unsubscribe or change your settings, visit: http://lists.phillyonrails.org/mailman/listinfo/talk
_______________________________________________
To unsubscribe or change your settings, visit:
http://lists.phillyonrails.org/mailman/listinfo/talk
|
|