# Getting locale information?

**URL:** <https://www.ruby-forum.com/t/getting-locale-information/81030>\
**Category:** Ruby\
**Created:** [January 3, 2007, 6:41am UTC](https://www.ruby-forum.com/t/getting-locale-information/81030 "2007-01-03T06:41:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeremy\_McAnally](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c89c15/32.png) [@Jeremy\_McAnally](https://www.ruby-forum.com/u/Jeremy_McAnally)\
**Post date:** [January 3, 2007, 6:41am UTC](https://www.ruby-forum.com/t/getting-locale-information/81030/1 "2007-01-03T06:41:17Z")

</div>

I’m working on a library, and it would be very nice to automatically  
be able to switch out the data based on the user’s locale. Is there a  
way to automatically find that? Or is that something they will need  
to setup?

Thanks,  
Jeremy

–  
My free Ruby e-book:  
[http://www.humblelittlerubybook.com/book/](http://www.humblelittlerubybook.com/book/)

My blogs:

> **[Site not found · DreamHost](http://www.mrneighborly.com/)**
>
> The owner of this domain has not yet uploaded their website.

[http://www.rubyinpractice.com/](http://www.rubyinpractice.com/)

---

<div class="post-metadata">

**Author:** ![Jeremy\_McAnally](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c89c15/32.png) [@Jeremy\_McAnally](https://www.ruby-forum.com/u/Jeremy_McAnally)\
**Post date:** [January 3, 2007, 8:02pm UTC](https://www.ruby-forum.com/t/getting-locale-information/81030/2 "2007-01-03T20:02:07Z")

</div>

On Jan 3, 2007, at 12:39 AM, Jeremy McAnally wrote:

> I’m working on a library, and it would be very nice to automatically  
> be able to switch out the data based on the user’s locale. Is there a  
> way to automatically find that? Or is that something they will need  
> to setup?
> 
> Thanks,  
> Jeremy

If you’re working in rails, it sounds like the globalize plugin might  
be what you’re looking for. It may have roots in libraries that you  
could utilities in outside of rails as well, but I can’t say for sure.  
-Mat

---

<div class="post-metadata">

**Author:** ![Jeremy\_McAnally](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c89c15/32.png) [@Jeremy\_McAnally](https://www.ruby-forum.com/u/Jeremy_McAnally)\
**Post date:** [January 3, 2007, 9:20pm UTC](https://www.ruby-forum.com/t/getting-locale-information/81030/3 "2007-01-03T21:20:20Z")

</div>

I didn’t think of that…I’m not working in Rails, but I’ll grab  
globalize and pick through it and see what I can find.

Thanks 🙂

–Jeremy

On 1/3/07, Mat S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> If you’re working in rails, it sounds like the globalize plugin might  
> be what you’re looking for. It may have roots in libraries that you  
> could utilities in outside of rails as well, but I can’t say for sure.  
> -Mat

–  
My free Ruby e-book:  
[http://www.humblelittlerubybook.com/book/](http://www.humblelittlerubybook.com/book/)

My blogs:

> **[Site not found · DreamHost](http://www.mrneighborly.com/)**
>
> The owner of this domain has not yet uploaded their website.

[http://www.rubyinpractice.com/](http://www.rubyinpractice.com/)

---

<div class="post-metadata">

**Author:** ![Jeremy\_McAnally](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c89c15/32.png) [@Jeremy\_McAnally](https://www.ruby-forum.com/u/Jeremy_McAnally)\
**Post date:** [January 4, 2007, 1:29am UTC](https://www.ruby-forum.com/t/getting-locale-information/81030/4 "2007-01-04T01:29:17Z")

</div>

Hi,

On Wed, 3 Jan 2007 14:39:02 +0900  
“Jeremy McAnally” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m working on a library, and it would be very nice to automatically  
> be able to switch out the data based on the user’s locale. Is there a  
> way to automatically find that? Or is that something they will need  
> to setup?

Ruby-GetText-Package supports the system locale.

Try GetText.locale or Locale.get.  
[http://www.yotabanana.com/gettextapi/](http://www.yotabanana.com/gettextapi/)
