Forum: Rails I18n Get current language locale in view

40d4fdd18976e8756b4e227416e82732?d=identicon&s=25 Israel T. (israel_t)
on 2013-05-31 20:17

I'm new in RoR and I need to write an if in a view to show a different
video based in the current language.

How can I get the current chosen locale?

6e6ad40d40c15fecdd1060573156d65f?d=identicon&s=25 Martin Svalin (Guest)
on 2013-06-01 13:21
(Received via mailing list)

I18n.locale holds the current locale.
I guess all you want to do is have different url:s to the videos, based
locale, so alternatively you can put the url in the translations with a
translation key such as "video_url". Then you won't need the conditional
your view. Translation strings don't have to be text shown to the user.

- Martin
40d4fdd18976e8756b4e227416e82732?d=identicon&s=25 Israel T. (israel_t)
on 2013-06-01 15:32
Thanks for the reply
B08130c062fb41479f7e1c3b33e75a7c?d=identicon&s=25 top 3. (top_3)
on 2013-08-09 06:19
منتديات توب عرب للمبدعين احساس منتديات عامة
افضل المنتديات العربية
This topic is locked and can not be replied to.