Announcement Announcement Module
No announcement yet.
How to develop database entities with i18n support Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to develop database entities with i18n support


    I'm totaly new to spring and roo and have to evaluate, if we use roo
    for new projects in our company for the future.

    I18n support for templates is the static part, how can i add something
    like newsentries (id, published, category, ...) and newsentries_i18n (newsentry_id, locale, title, text, ...) as a dynamic part of website translation?

    Maybe i'm searching for the wrong terms with google and couldn't find
    a documentation for i18n entities.

    Hope that someone can help me

  • #2
    my suggestions


    I have a few dropdown lists in my projects and they support well any number of languages really, currently I support two languages.
    I use jinto for the i18n part (jinto - and then I standardized all my support tables.

    example : this is one of my dropdown tables, this one is to contain academic degrees

    public class AcademicDegree {
        @Size(min = 1, max = 255)
        private String description_en;
        @Size(min = 1, max = 255)
        private String description_label;
        @Size(min = 1, max = 255)
        private String description;
    example of entries in database table academic_degree
    (id, description, description_en, description_label)
    (-1, ' ','-- nothing selected --','academic_degree')
    (1, ' ','Doctorate','academic_degree_1')

    and then I have matching entries in the file
    label_is_rannis_sjodir_taxform_domain_dropdown_aca demic_degree_1=doctorate
    and another in the file for icelandic.

    then I have a slight trick in my .jspx file to translate between languages

    as you may have noticed my description column is emtpy

    but my description_label column is really the name of the label to use for translation in the file

       <c:forEach items="${academicdegrees}" var="degree">
          <spring:message code="label_is_rannis_sjodir_taxform_domain_dropdown_${degree.description_label}" var="test"/>
          <jsp:setProperty name="degree" property="description" value="${fn:escapeXml(test)}"/>
    and then lastly, has to have a converter like this.

        org.springframework.core.convert.converter.Converter<AcademicDegree, String> getAcademicDegreeConverter() {
            return new org.springframework.core.convert.converter.Converter<AcademicDegree, String>() {
                public String convert(AcademicDegree academicDegree) {
                    return new StringBuilder().append(academicDegree.getDescription()).toString();
    which basicly returns the description column and nothing else.

    hope this helps.