I'll definitely try that. And using a cache I could give my users the functionality to change at runtime the label translations, which I'm planning anyway since google translate isn't always perfect.
On 6 February 2010 12:19, Alexander Muthmann <[email protected]> wrote: > 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: [email protected] > For additional commands, e-mail: [email protected] > >
