Localized database strings

Posted by Steve on Stack Overflow See other posts from Stack Overflow or by Steve
Published on 2009-10-27T18:49:58Z Indexed on 2010/12/28 9:54 UTC
Read the original article Hit count: 125

Filed under:

I have a small Grails application that has the following domain:

class Meal {
  String name
  String description
  String allergyNote
}

For localization purposes the three strings should now be available in multiple languages. For example, while an English user would see name="Steak", a Spanish user should see name="Filete" in the output. I was thinking of doing the following:

class Language {
  String isoCode
  String languageName
}

class TranslatedString {
  Language language
  String   translation
}

but I am not sure how to link the Meals with the TranslatedStrings as it is used for three members, also I would like to use it for other classes (not just Meal) as well (or do I need to have separated tables, i.e. a MealNameTranslated, MealDescriptionTranslated, etc tables?). I know this is probably a stupid question, but I am a beginner and have not been able to figure this out :-(

© Stack Overflow or respective owner

Related posts about grails