History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: APF-807
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Matt Raible
Reporter: Laurent Dejoux
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
AppFuse

Generated code provides only english messages

Created: 07/Jun/07 08:25 AM   Updated: 13/Sep/07 05:57 PM
Component/s: Tools - AppGen
Affects Version/s: 2.0-M5
Fix Version/s: None

Environment: Basic Struts


 Description  « Hide
no code generated on file ApplicationResources_fr.properties for example

 All   Comments   Change History   FishEye      Sort Order:
Matt Raible - 07/Jun/07 08:36 AM
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(i);

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(x);
            nextUpper = false;
        }

return buffer.toString();
    }

Matt Raible - 13/Sep/07 05:57 PM
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