# \[internationalization\] Multiple strings in one DB field

**URL:** <https://www.ruby-forum.com/t/internationalization-multiple-strings-in-one-db-field/150232>\
**Category:** Rails\
**Created:** [October 6, 2008, 11:04am UTC](https://www.ruby-forum.com/t/internationalization-multiple-strings-in-one-db-field/150232 "2008-10-06T11:04:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chriscole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/5fc32e/32.png) [@chriscole](https://www.ruby-forum.com/u/chriscole)\
**Post date:** [October 6, 2008, 11:04am UTC](https://www.ruby-forum.com/t/internationalization-multiple-strings-in-one-db-field/150232/1 "2008-10-06T11:04:49Z")

</div>

Hello, I’m trying to find the best solution to handle DB localized datas  
and I don’t want to use a plugin for database fields translation.

1. Serializing a hash using the locale as a key.

Eg. caption field in table categories could contain  
{:fr =\> ‘Livres’, :en =\> ‘Books’}

Using serialization I’ll will be able to do rails find or SQL find LIKE.  
The only drawback I see is when editing the category : the view must  
generate dynamically the input fields depending on the content and name  
them accordingly (caption\_fr, caption\_en) - I don’t know if it will  
cause me a lot of troubles in regard of the validation rules  
(validate\_format with the right regex pattern could do the trick)  
I really want to avoid the full blow internationalization plugins

1. One db field per locale (caption\_fr, caption\_en) but :

- Need to alter the DB structure when adding new locales

1. Caption field contains an ID, (ID of a string resource) with a join  
to the resources table. The caption corresponding to the current locale  
is retrieved on the view with some application helpers

- Added complexity in forms and controllers when editing records

Any thought, advice or alternative solution about this idea ?

Thanks
