On Mon, Apr 26, 2010 at 17:58, Marnen Laibow-Koser
[email protected]wrote:
Yes it is better to store the multilanguage strings in the .yml files.
First it is a bad database design which will lead to unnecessary
complications while searching for data, also for indexing.
Wrong. Internationalized strings have nothing to do with searching for
data.
eg.) Lets say I have a User model and each user has a āroleā as a
column. So
if I want to internationalize the value of the āRoleā, you propose that
it
should be done using the database ?
I imagine so then for internationalizing to 5 different languages, I
would
then have to create 5 records for this very user with different āRoleā
values for each language.
That is first of all not normalized data.
Second of all it makes your basic search / find queries to be lesser
performant (compared to if you werenāt doing this) since you will always
have to ensure that you get the record with the specific language you
are
currently displaying, meaning you will have a perpetual where clause.
If your solution is to have the value of āRoleā as a set of localized
values
delimited by some special character, then that is even worse. If I
wanted to
get users by āRoleā I would then have to use a LIKE query instead of a
ā=ā,
which is obviously not as performant again.
I simply choose to have a simple set of values of Roles, say āAdminā,
āUserā, etc which I can easily capture and use i18n to get the
appropriate
transated text loaded from the appropriate .yml file
If I have to support somewhere around 5-10 different languages, I really
think having a 5-10 .yml files for translations will be a lot more
performant compared to a 5-10 times larger database.
Wrong again. It may well be faster to use the DB.
You are wrong here, the files will be loaded in memory once, I canāt
imagine
any database query performing better than querying a file that is
already in
memory.
locales makes me think youāre not really qualified to have an opinion
here.
I have just tried the exact scenario using mongrel. I had to restart the
app
once I changed the locale. So my assumption was based on that.
Maybe there are other better ways of doing the same without restarting
my
app, or maybe fusion or other servers support the same, but as I said
āin my
experienceā¦ā
I donāt claim to be any expert, I have little experience in rails, I was
expressing what I had experienced.
Posted via http://www.ruby-forum.com/.
ā
Thanks & Regards,
Dhruva Sā¦