# Internationalise field in model (maybe with globalite)

**URL:** <https://www.ruby-forum.com/t/internationalise-field-in-model-maybe-with-globalite/136042>\
**Category:** Rails\
**Created:** [April 28, 2008, 11:38am UTC](https://www.ruby-forum.com/t/internationalise-field-in-model-maybe-with-globalite/136042 "2008-04-28T11:38:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![spross](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@spross](https://www.ruby-forum.com/u/spross)\
**Post date:** [April 28, 2008, 11:38am UTC](https://www.ruby-forum.com/t/internationalise-field-in-model-maybe-with-globalite/136042/1 "2008-04-28T11:38:51Z")

</div>

hi all

i have a model ‘user’ with a ‘country’ references field and a model  
‘country’ with a ‘name’ field. now i’m trying to internationalise my  
application with globalite. but how do i solve that in my model? shall  
i create an other field called ‘language’ in my model ‘country’ or is  
there an sexier way? maybe without an ‘country’ model?

---

<div class="post-metadata">

**Author:** ![spross](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@spross](https://www.ruby-forum.com/u/spross)\
**Post date:** [April 28, 2008, 12:04pm UTC](https://www.ruby-forum.com/t/internationalise-field-in-model-maybe-with-globalite/136042/2 "2008-04-28T12:04:56Z")

</div>

Let me get you first, what do you want make your web is automatically  
changing language based to user country? If yes, you do not need create  
language and model country, you only need to create plugin and in that  
plugin contains array or hash to detect user’s country and reference the  
country code or user’s country to translator.  
You can use mashup method to link your application to  
[google.com/tranlate\_t](http://google.com/tranlate_t) by creating plugin or helper.

Reinhart  
[http://teapoci.blogspot.com](http://teapoci.blogspot.com)

---

<div class="post-metadata">

**Author:** ![spross](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@spross](https://www.ruby-forum.com/u/spross)\
**Post date:** [April 29, 2008, 4:03pm UTC](https://www.ruby-forum.com/t/internationalise-field-in-model-maybe-with-globalite/136042/3 "2008-04-29T16:03:47Z")

</div>

i think i’m nearer at a possible solution, but i didn’t solved it  
yet 🙂 my current problem:

I have a user model, where i want to save the chosen salutation and  
country. So, i’m using Globalite [http://code.google.com/p/globalite/](http://code.google.com/p/globalite/)  
and i want to use the existing :countries\_list.l and  
my :salutation\_list.l

My current implementation: [Parked at Loopia](http://pastie.caboo.se/188608)

Now the problem is, the chosen salutation (and country) will be saved  
as string into the model. so if the user switches to an other language  
and visits the user edit page, the salutation (and country) can’t be  
mapped (taged as ‘selected’) because they were saved as strings.

Now my question: is there an easy way to map this lists to integers,  
and only save the integer values into the model, so they can mapped to  
the right list item, whatever lanugage is chosen?

it’s my first multilanguage application 🙂

thx a lot!

On 28 Apr., 12:04, Visit Indonesia 2008 \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![spross](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@spross](https://www.ruby-forum.com/u/spross)\
**Post date:** [April 30, 2008, 1:03pm UTC](https://www.ruby-forum.com/t/internationalise-field-in-model-maybe-with-globalite/136042/4 "2008-04-30T13:03:37Z")

</div>

i think i found a good solution: [http://pastie.caboo.se/189227](http://pastie.caboo.se/189227)

---

<div class="post-metadata">

**Author:** ![spross](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@spross](https://www.ruby-forum.com/u/spross)\
**Post date:** [June 3, 2008, 5:14pm UTC](https://www.ruby-forum.com/t/internationalise-field-in-model-maybe-with-globalite/136042/5 "2008-06-03T17:14:13Z")

</div>

Sorry, I forgot to paste the url  
[http://www.bluebrains.com.ar/articles/setting-up-globalite](http://www.bluebrains.com.ar/articles/setting-up-globalite)

Rodrigo

---

<div class="post-metadata">

**Author:** ![spross](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@spross](https://www.ruby-forum.com/u/spross)\
**Post date:** [June 3, 2008, 5:13pm UTC](https://www.ruby-forum.com/t/internationalise-field-in-model-maybe-with-globalite/136042/6 "2008-06-03T17:13:02Z")

</div>

We wrote an article that might be useful if you are having issues in the  
setting up of globalite plugin.

Feel free to ask anything you don’t understand.

Rodrigo
