Hi, On Mon, Sep 20, 2010 at 11:12 PM, [Ricardo Rodriguez] eBioTIC. <[email protected]> wrote: > Thanks, Raluca, > > Raluca Stavro wrote: >> On Mon, Sep 20, 2010 at 9:29 AM, Raluca Stavro <[email protected]> >> wrote: >> >>> On Sat, Sep 18, 2010 at 12:38 PM, [Ricardo Rodriguez] eBioTIC. >>> <[email protected]> wrote: >>> Hi, >>> >>> You can use translations (See >>> http://platform.xwiki.org/xwiki/bin/view/DevGuide/InternationalizingApplications). >>> For class properties, the translation format is like this: >>> >>> ClassSpaceBane.ClassDocName_propertyName=A_Translation_Text >>> >> >> ClassSpaceName.ClassDocName_propertyName=A_Translation_Text >> >> > I'm in fact using this method in a rather simple application we have > created, but whereas it is rather simple to edit and fill-in properties > in a given instantiate class, it is not so "straight" to use the method > we talk about here to the same. For instance, consider this (awful, but > it could be useful to illustrate the discussion) model... > > http://ftp.ebiotic.net/onPdr/pescaderiasDataModel.png > > I've implemented it by using Documents to instantiate User and Species > classes. Species classes has two properties that hold translations of > its name. If I manage to get a new translation, I do need to add a new > property to this class. Or to instruct translators to edit the > translations document and fill in the property the name of the variable > in the format you have told before. I do prefer not to have people to > tweak with this kind of "raw" XWiki documents. > > Could it be possible to create a new class for each name to be > translated and instatiate it such many times as different languages a > given name is translated to? This class will have two properties: > Language Code and Translation. WDYT? > > I think all I have to do is to understand how http://l10n.xwiki.org > works! But I think this is a bit far from my capabilities rigth now! As > stated in some other message, any entry-level help will be welcome!
See this document in order to learn the basics of the translations module: http://platform.xwiki.org/xwiki/bin/view/Features/I18N . A trick to solve your problem would be to have a single 'name' property for the 'Species' class. Let's say that you attached an object of type 'YourSpace.Species' class to a document named 'YourSpace.DocName'. You set the value of the 'name' property to 'sp_name_key' (use a key in order to be able to use translations based on it). Edit the document in wiki mode and write: {{velocity}} #set($thisDocSpeciesNameKey = $doc.getObject('YourSpace.Species').getProperty('name').value) ## $thisDocSpeciesNameKey value is 'sp_name_key' $msg.get("$!thisDocSpeciesNameKey") {{/velocity}} ## save the document In the translations document, for the 'en' version you write the key & value like this: sp_name_key=my EN sp name ## save the document For the 'fr' version, you write this: sp_name_key=my FR sp name ## save the document Now, if you go to .../view/YourSpace/DocName (your document in 'view' mode), by changing the language you will see that the displayed name is different for each language. Raluca. > > Thanks! > > -- > Ricardo RodrÃguez > CTO > eBioTIC. > Life Sciences, Data Modeling and Information Management Systems > > _______________________________________________ > users mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/users > _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
