# Multilingual model content

**URL:** <https://www.ruby-forum.com/t/multilingual-model-content/167716>\
**Category:** Rails I18n\
**Created:** [May 11, 2009, 10:16pm UTC](https://www.ruby-forum.com/t/multilingual-model-content/167716 "2009-05-11T22:16:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![roa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@roa](https://www.ruby-forum.com/u/roa)\
**Post date:** [May 11, 2009, 10:16pm UTC](https://www.ruby-forum.com/t/multilingual-model-content/167716/1 "2009-05-11T22:16:20Z")

</div>

Hi

I’m looking for some insight in a small problem I have.

I need multilingual input in my models. Lets say you have a Product  
model. That product contains title, description and price. The price is  
allways the same, but the title and description need to be inputted in  
diffrent languages.

I have used the I18n framework build in Rails, so no external plugin and  
I would like to keep it that way.

One idea I was playing with is the following model build:

## Product

id  
price

## ProductI18n

id  
product\_id  
language -\> I18n code like EN, BE, FR  
title  
description

But how do I link those 2 together, so that I can show the product  
details in the current user language?

Is there a way to pass a variable trough the Product association like  
this:

has\_one :product\_language, :class\_name =\> :product\_i18n, :conditions =\>  
“language = users\_current\_language\_code”

I know I’m on the good track, but I know I’m missing something.

thank you for the insight

---

<div class="post-metadata">

**Author:** ![roa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@roa](https://www.ruby-forum.com/u/roa)\
**Post date:** [May 20, 2009, 9:54am UTC](https://www.ruby-forum.com/t/multilingual-model-content/167716/2 "2009-05-20T09:54:23Z")

</div>

Take a look at the globalize 2 plugin on github:

> **[GitHub - joshmh/globalize2: The second incarnation of Globalize for Rails](https://github.com/joshmh/globalize2/tree/master)**
>
> master

It covers model translation like you want to do and is recommended by  
the author of the I18n Rails guide:

> **[Rails Internationalization (I18n) API — Ruby on Rails Guides](https://guides.rubyonrails.org/i18n.html)**
>
> Rails Internationalization (I18n) APIThe Ruby I18n (shorthand for internationalization) gem which is shipped with Ruby on Rails (starting from Rails 2.2) provides an easy-to-use and extensible framework for translating your application to a single...
