# Get current language locale in view

**URL:** <https://www.ruby-forum.com/t/get-current-language-locale-in-view/235120>\
**Category:** Rails I18n\
**Created:** [May 31, 2013, 8:17pm UTC](https://www.ruby-forum.com/t/get-current-language-locale-in-view/235120 "2013-05-31T20:17:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [May 31, 2013, 8:17pm UTC](https://www.ruby-forum.com/t/get-current-language-locale-in-view/235120/1 "2013-05-31T20:17:20Z")

</div>

Hi,

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?

Thanks

---

<div class="post-metadata">

**Author:** ![israel\_t](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/839c29/32.png) [@israel\_t](https://www.ruby-forum.com/u/israel_t)\
**Post date:** [June 1, 2013, 1:21pm UTC](https://www.ruby-forum.com/t/get-current-language-locale-in-view/235120/2 "2013-06-01T13:21:40Z")

</div>

Hi,

I18n.locale holds the current locale.  
I guess all you want to do is have different url:s to the videos, based  
on  
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  
in  
your view. Translation strings don’t have to be text shown to the user.

- Martin

---

<div class="post-metadata">

**Author:** ![israel\_t](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/839c29/32.png) [@israel\_t](https://www.ruby-forum.com/u/israel_t)\
**Post date:** [June 1, 2013, 3:32pm UTC](https://www.ruby-forum.com/t/get-current-language-locale-in-view/235120/3 "2013-06-01T15:32:52Z")

</div>

Thanks for the reply
