AppFuse
  1. AppFuse
  2. APF-807

Generated code provides only english messages

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0-M5
    • Fix Version/s: None
    • Component/s: Tools - AppGen
    • Labels:
      None
    • Environment:
      Basic Struts

      Description

      no code generated on file ApplicationResources_fr.properties for example

        Activity

        Hide
        Matt Raible added a comment -

        This is not something we plan on fixing, unless someone provides a patch. Unfortunately, I only speak English.

        The FreeMarker template (ApplicationResources.ftl) can be viewed at http://tinyurl.com/2x9r66. The getFieldDescription() method in DataHelper handles creating the field labels:

        /**

        • Parse a field name and convert it to a titled set of words.
        • @param fieldName the pojo.property
        • @return A string suitable for i18n
          */
          public String getFieldDescription(String fieldName) {
          StringBuffer buffer = new StringBuffer();
          boolean nextUpper = false;
          for (int i = 0; i < fieldName.length(); i++) {
          char c = fieldName.charAt;

        if (i == 0)

        { buffer.append(Character.toUpperCase(c)); continue; }

        if (Character.isUpperCase(c))

        { buffer.append(' '); buffer.append(c); continue; }

        if (c == '.')

        { buffer.delete(0, buffer.length()); nextUpper = true; continue; }

        char x = nextUpper ? Character.toUpperCase(c) : c;
        buffer.append;
        nextUpper = false;
        }

        return buffer.toString();
        }

        Show
        Matt Raible added a comment - This is not something we plan on fixing, unless someone provides a patch. Unfortunately, I only speak English. The FreeMarker template (ApplicationResources.ftl) can be viewed at http://tinyurl.com/2x9r66 . The getFieldDescription() method in DataHelper handles creating the field labels: /** Parse a field name and convert it to a titled set of words. @param fieldName the pojo.property @return A string suitable for i18n */ public String getFieldDescription(String fieldName) { StringBuffer buffer = new StringBuffer(); boolean nextUpper = false; for (int i = 0; i < fieldName.length(); i++) { char c = fieldName.charAt ; if (i == 0) { buffer.append(Character.toUpperCase(c)); continue; } if (Character.isUpperCase(c)) { buffer.append(' '); buffer.append(c); continue; } if (c == '.') { buffer.delete(0, buffer.length()); nextUpper = true; continue; } char x = nextUpper ? Character.toUpperCase(c) : c; buffer.append ; nextUpper = false; } return buffer.toString(); }
        Hide
        Matt Raible added a comment -

        Do you have any suggestions on how to solve this? Maybe we should provide a big if statement in the following file that switches locales and outputs different messages (and adds to the appropriate ApplicationResources.properties file).

        ApplicationResources.ftl --------------------

        1. – $ {pojo.shortName}-START
          <#assign pojoNameLower = pojo.shortName.substring(0,1).toLowerCase()+pojo.shortName.substring(1)>
          <#foreach field in pojo.getAllPropertiesIterator()>
          <#if !c2h.isCollection(field) && !c2h.isManyToOne(field) && !c2j.isComponent(field)>
          <#lt/>${pojoNameLower}.${field.name}=${data.getFieldDescription(field.name)}
          </#if>
          </#foreach>

          ${pojoNameLower}.added=${pojo.shortName}

          has been added successfully.
          $

          {pojoNameLower}.updated=${pojo.shortName} has been updated successfully.
          ${pojoNameLower}

          .deleted=$

          {pojo.shortName} has been deleted successfully.

          # – ${pojoNameLower} list page –
          ${pojoNameLower}List.title=${pojo.shortName}

          List
          $

          {pojoNameLower}List.heading=${util.getPluralForWord(pojo.shortName)}
          ${pojoNameLower}

          List.$

          {pojoNameLower}=${pojoNameLower}

          $

          {pojoNameLower}List.${util.getPluralForWord(pojoNameLower)}=${util.getPluralForWord(pojoNameLower)}

          # – ${pojoNameLower}

          detail page –
          $

          {pojoNameLower}Detail.title=${pojo.shortName} Detail
          ${pojoNameLower}

          Detail.heading=$

          {pojo.shortName} Information
          # – ${pojo.shortName}

          -END

        Show
        Matt Raible added a comment - Do you have any suggestions on how to solve this? Maybe we should provide a big if statement in the following file that switches locales and outputs different messages (and adds to the appropriate ApplicationResources.properties file). ApplicationResources.ftl -------------------- – $ {pojo.shortName}-START <#assign pojoNameLower = pojo.shortName.substring(0,1).toLowerCase()+pojo.shortName.substring(1)> <#foreach field in pojo.getAllPropertiesIterator()> <#if !c2h.isCollection(field) && !c2h.isManyToOne(field) && !c2j.isComponent(field)> <#lt/>${pojoNameLower}.${field.name}=${data.getFieldDescription(field.name)} </#if> </#foreach> ${pojoNameLower}.added=${pojo.shortName} has been added successfully. $ {pojoNameLower}.updated=${pojo.shortName} has been updated successfully. ${pojoNameLower} .deleted=$ {pojo.shortName} has been deleted successfully. # – ${pojoNameLower} list page – ${pojoNameLower}List.title=${pojo.shortName} List $ {pojoNameLower}List.heading=${util.getPluralForWord(pojo.shortName)} ${pojoNameLower} List.$ {pojoNameLower}=${pojoNameLower} $ {pojoNameLower}List.${util.getPluralForWord(pojoNameLower)}=${util.getPluralForWord(pojoNameLower)} # – ${pojoNameLower} detail page – $ {pojoNameLower}Detail.title=${pojo.shortName} Detail ${pojoNameLower} Detail.heading=$ {pojo.shortName} Information # – ${pojo.shortName} -END

          People

          • Assignee:
            Matt Raible
            Reporter:
            Laurent Dejoux
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development