Hi,


Paul Hodgetts wrote:

Should I be able to do the following localization using
extended tiles definitions?

In tiles-defs.xml:

<tiles-definitions>
    <definition name=".page.base" page="/default-layout.jsp">
        <put name="header" value="/header.jsp"/>
        <put name="footer" value="/footer.jsp"/>
    </definition>
    <definition name=".page.index" extends=".page.local">
        <put name="content" value="/index-content.jsp"/>
    </definition>
    <definition name=".page.cart" extends=".page.local">
        <put name="content" value="/cart-content.jsp"/>
    </definition>
</tiles-definitions>

You need a .page.local definition in this file too. This file is used as default when the locale can't be resolved. In your case, when the locale is not de_DE. So, this file must be able to be fully resolved by itself.


In tiles-defs_de_DE.xml:


<tiles-definitions>
    <definition name=".page.local" extends=".page.base">
        <put name="menus" value="/menus_de_DE.jsp"/>
    </definition>
</tiles-definitions>

This is ok. When the locale is de_DE, this definition will be used in place of the definition with the same name in the default config file.



In other words, there is a common base page across all the locales. Each local adds a locale-specific menu to every page. Then there are the variety of specific pages that add their unique content.

Does this make sense?

Yes, in your localized files, just rewrite the definition that need to be rewritten.


Is this the right way to do this, or
is there some other way to accomplish this?

This is the right way to do, but don't forget that you need a default configuration file. This later should be fully resolvable when it is read by the definition factory. This mean that all ancestor definitions must be accessible in the file, or in one of the file specified in the factory config.


In Tiles, there is one factory for each matching locale (a matching locale = there exist a file with appropriate suffix for the locale). The factory is loaded when the locale is encountered. File loading follow the java i18n rule: The default file is loaded, then it is overloaded by files with the same name and a local matching i18n suffix.

Cedric




Right now, I'm getting an error saying that it can't find a
definition for .page.local, but I may be doing something
else wrong.

Thanks,
Paul
-----
Paul Hodgetts -- Principal Consultant
Agile Logic  -- www.agilelogic.com
Consulting, Coaching, Training -- On-Site & Out-Sourced Development
Java, J2EE, C++, OOA/D -- Agile Methods/XP/Scrum, Use Cases, UI/IA


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to