When I understood the API of com.day.cq.i18n.I18n right if have to use one
of the get methods to translate my system texts. For example in the
previously mentioned library:

/apps/lib/components/aComponent/aComponent.jsp

<%
        I18n.get(resourceBundle, "Press here");
%>

Now I want to include this component in my app:

/apps/anApp/components/page/page.jsp

<sling:include resource="${resource}"
resourceType="lib/components/aComponent" />

And the Translations are:

/apps/lib/i18n/en
        - key1 (sling:key = "Press here", sling:message = "Press here")
/apps/anApp/i18n/en
        - key1 (sling:key = "Press here ((anApp))", sling:message = "Press
the button")

With this content I have to use "anApp" as comment in the I18n.get()
invocation. But when I want to use the component located in the lib I'm not
able to set this parameter (I don't want to copy the components jsp into my
app)

Am I right? Can you give an example that shows how to use the I18n API for
this use case?

Cheers,
Dirk


-----Ursprüngliche Nachricht-----
Von: Alexander Klimetschek [mailto:[email protected]] 
Gesendet: Mittwoch, 7. November 2012 12:07
An: [email protected]; [email protected]
Betreff: Re: Overriding of sling:messages in sling i18n

On 07.11.2012, at 10:06, Dirk Rudolph <[email protected]>
wrote:

> When I now introduce an "app" that should use the component defined in 
> the lib, they shouldn't use the keys defined in the lib because it's 
> possible that a translation of one message differs for different "apps"

This is IMHO a typical scenario for using translation comments as mentioned.

Cheers,
Alex


Reply via email to