Forum: Rails I18n How build two translated model in the same time with globalize2 ?

4bd765b029e26940f174831b1f0f5f5c?d=identicon&s=25 Arnette31 (Guest)
on 2010-01-22 00:16
(Received via mailing list)
Hi, I a new user of ruby on rails (2.3.4)  and globalize 2 (0.2.0). I
have some prolems to use globalize2.

I think globalize 2 is powerfull and perhaps I don't understand how it
works... with the documentation, the use seems very simple globalize2
manage all the stuff behind....

ok ok... my problem is : I want create a model with the default
language (:fr) so it's simple to do that... but after I want create
another translations of this model (:en or :es or :de or :it ..)
without change of the current language... and the validation have to
works on this translation to.... is it possible and how ?


many thanks in advance...
4bd765b029e26940f174831b1f0f5f5c?d=identicon&s=25 Arnette31 (Guest)
on 2010-01-22 17:22
(Received via mailing list)
Ok I look further in the plug in and I found one method
"set_translations" which do what I wished... but without validations
example :

I have a Comment model with two translated field and validations on it

>> I18n.locale
=> :fr
>> com = Comment.new("title"=>"lalalalal","content"=>"le francais")
=> #<Comment id: nil, value: 12, created_at: nil, updated_at: nil>
>> com.valid?
=> true
>> com.save
=> true
>> com2.set_translations("en"=>{"title"=>"","content"=>"test en"},"it"=>{"title"=>"test 
it","content"=>""})
=> ["it", "en"]

When I create a new comment the validation is performed (great) but
when I want add another locale to the same comment with the
"set_translations" method in this case the validations is not
performed... is there an issue for this.

After with the web interface I changed the default_locale to :en and I
edited my comment this time in english, in this case also the
validation is performed .. ? why the validation can't be performed
with the “set_translations” method ??


many thanks in advance...
This topic is locked and can not be replied to.