<
From version < 7.1 >
edited by Thomas Mortagne
on 2010/04/20
To version < 8.1 >
edited by Sergiu Dumitriu
on 2010/10/03
>
Change comment: Added snippet for selecting translated objects

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.ThomasMortagne
1 +XWiki.Sergiu
Content
... ... @@ -53,7 +53,12 @@
53 53  
54 54  This is currently not implemented (see our logged issue: [[XWIKI-69>>http://jira.xwiki.org/jira/browse/XWIKI-69]]). There are 2 workarounds you can use:
55 55  
56 -* Have several objects, one for each language, with a language field, and then decide which object to use (for example in a Class Sheet, based on the current language).
56 +* Have several objects, one for each language, with a language field, and then decide which object to use (for example in a Class Sheet, based on the current language):(((
57 +{{code language="none"}}
58 +$doc.getObject('Your.Class', 'lang', $context.language')
59 +## Will select the object whose 'lang' property is set to the current language
60 +{{/code}}
61 +)))
57 57  * Use Velocity scripting to do an IF in your object. For example, you could have:(((
58 58  {{code language="none"}}
59 59  #if ($context.language == "fr")

Get Connected