On Wed, Feb 15, 2012 at 1:53 PM, Guillaume Delhumeau
<gdelhumeau(a)xwiki.com> wrote:
Hi guys.
Let met describe you my problem.
I get the rendered content of a document on a velocity script :
#set($newsletterContent = $newsletterContentDoc.getRenderedContent())
But I would like to specify the language I want ('fr' or 'en') because
my
document contains translation keys.
Of course, I tried to use
Document.getTranslatedDocument() before rendering
it, but it doesn't work, maybe because my translated content is inside a
velocity script of the document.
The best way would be having a language parameter into getRenderedContent()
function but since we can't, is there an easy way to do it?
You can render explicitly the content of the translated document with
$targetDocument.getRenderedContent($targetDocument.getTranslatedContent('fr'),
$targetDocument.syntax.toIdString())
but this won't fix the fact that $msg.get('key') takes into account
the context language, not the document language. If you can use
programming rights then you can try setting the context language
before rendering the document, and revert it afterwards.
Hope this helps,
Marius
--
I also tried to do this :
#set($newsletterContent =
$xwiki.getURLContent($newsletterContentDoc.getExternalURL('get','outputSyntax=plain&language=fr')))
but it is very dirty and doesn't work since the wiki ask for credentials
when I do getURLContent().
--
Thx a lot.
Guillaume
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users