Fast idea:
You could override the existing provider for Message-Entries and add a function to look at google translate if the requestes label was not found. The service would be ComponentDefaultProvider and the needed method defaultLabel:

public String defaultLabel(ComponentResources resources)
    {
        Defense.notNull(resources, "resources");

        String componentId = resources.getId();
        String key = componentId + "-label";

Messages containerMessages = resources.getContainerResources().getMessages();

if (containerMessages.contains(key)) return containerMessages.get(key);

        \\here you can check google translate

        return TapestryInternalUtils.toUserPresentable(componentId);
 }

On the marked position you could add a new cache for already used labels...


On 06.02.2010 13:12, Nuno Ferreira wrote:
Hi,

I would like to know if there is a way to programatically add and remove an
entry from a messages catalog.

The only way I see how to do this is to write to the file
app_{locale}.properties, but I would like a cleaner way if there is one.

I want to use google translate to automatically fill every catalog, and
would love to hear there is something like messages.add(translation,locale)
:)

Thanks in advance,
Nuno Ferreira


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to