[rkward-devel] Question about plugin's translations

meik michalke meik.michalke at uni-duesseldorf.de
Fri May 24 14:39:15 UTC 2013


hi,

Am Freitag, 24. Mai 2013, 10:09:54 schrieb Thomas Friedrichsmeier:
> On Thursday 23 May 2013 23:33:03 Yuri Chornoivan wrote:
> > Guessing on the catalog sizes and their numbers, it would better to have
> > one catalog for every pluginmap.
> 
> Yes, I think so, too. I guess it would be really helpful to have a script
> that will extract all files used by a given .pluginmap. This could well be
> an R script using XiMpLe. Meik, I'm not sure just how much of this task you
> have already scripted in XiMpLe adn/or rkwarddev. Is this trivial, already?

yes, should be as easy as this:

 library(XiMpLe)
 # parse the .pluginmap
 some.plugin <- parseXMLTree("<path_to>/some.pluginmap")
 # extract the <component> nodes, returns a list
 some.plugin.comp <- XMLScan(some.plugin, "component")
 # get the values of all "file" attributes
 sapply(some.plugin.comp, function(x) XMLAttrs(x)[["file"]])

this could be condensed into a one-liner, but then it's harder to read ;-)

some things to be aware of: parseXMLTree() might either abort or produce 
rubbish if the .pluginmap includes erroneous XML (e.g., a missing "/" or an 
invalid "&"), even if RKWard gracefully ignores it. see that as a bug tracking 
feature ;-) also, i've just commited a new boolean argument to XMLScan(), 
"as.list", because if there's exactly one result, it will directly return the 
single XiMpLe node, not a list of length one. the latter can now be forced by 
"as.list=TRUE" -- but this shouldn't matter here, i guess.


viele grüße :: m.eik

-- 
  dipl. psych. meik michalke
  abt. f"ur diagnostik und differentielle psychologie
  institut f"ur experimentelle psychologie
  heinrich-heine-universit"at d"usseldorf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20130524/33d0c1fe/attachment.sig>


More information about the Rkward-devel mailing list