[rkward-cvs] SF.net SVN: rkward-code:[4815] trunk/rkward/packages/rkwarddev
m-eik at users.sf.net
m-eik at users.sf.net
Sat Sep 13 23:29:11 UTC 2014
Revision: 4815
http://sourceforge.net/p/rkward/code/4815
Author: m-eik
Date: 2014-09-13 23:29:09 +0000 (Sat, 13 Sep 2014)
Log Message:
-----------
rkwarddev: refined static i18n of plugins, now works with RKWard :-)
Modified Paths:
--------------
trunk/rkward/packages/rkwarddev/ChangeLog
trunk/rkward/packages/rkwarddev/DESCRIPTION
trunk/rkward/packages/rkwarddev/R/rk.XML.plugin.R
trunk/rkward/packages/rkwarddev/R/rk.XML.pluginmap.R
trunk/rkward/packages/rkwarddev/R/rk.XML.require.R
trunk/rkward/packages/rkwarddev/R/rk.plugin.skeleton.R
trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R
trunk/rkward/packages/rkwarddev/inst/NEWS.Rd
trunk/rkward/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
trunk/rkward/packages/rkwarddev/man/rk.XML.pluginmap.Rd
trunk/rkward/packages/rkwarddev/man/rk.XML.require.Rd
trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd
Modified: trunk/rkward/packages/rkwarddev/ChangeLog
===================================================================
--- trunk/rkward/packages/rkwarddev/ChangeLog 2014-09-13 23:26:56 UTC (rev 4814)
+++ trunk/rkward/packages/rkwarddev/ChangeLog 2014-09-13 23:29:09 UTC (rev 4815)
@@ -1,16 +1,21 @@
ChangeLog for package rkwarddev
-changes in version 0.06-4 (2014-09-01)
+changes in version 0.06-4 (2014-09-14)
added:
- - new functions rk.set.language(), rk.get.language() and i18n() to facilitate
- static internationalisation of plugins; makes use of a new internal environment
- .rkdev.env
- - new parameter "lang" in functions rk.rkh.doc(), rk.XML.plugin(), rk.XML.pluginmap()
- and rk.plugin.skeleton() for internationalisation. if used, the attributes "lang"
- and "xml:lang" will be set in the <document> root of the generated files, respectively
+ - new functions rk.set.language(), rk.get.language() and i18n() to
+ facilitate static internationalisation of plugins; makes use of a new internal
+ environment .rkdev.env
+ - new parameter "lang" in functions rk.rkh.doc(), rk.XML.plugin(),
+ rk.XML.pluginmap() and rk.plugin.skeleton() for internationalisation. if used, the
+ attributes "lang" and "xml:lang" will be set in the <document> root of
+ the generated files, respectively
+ - new parameter "localized" in rk.XML.require() for internationalisation
+ - the document id in rk.XML.pluginmap() can now be set manually
fixed:
- abbreviation of labels now limits valid characters to [0-9A-Za-z]
-
+ - in rk.XML.pluginmap(), "components" and "hierarchy" may be set to NULL if
+ "require" is used accordingly
+
changes in version 0.06-3 (2013-12-21)
fixed:
- fixed outdated example code for rk.plugin.component()
@@ -18,9 +23,10 @@
- new function rk.uniqueIDs() checks for duplicate IDs
- rk.JS.array() can now be told to quote values
changed:
- - rk.plugin.component() and rk.rkh.doc() do now interpret the "hints" argument to prevent the
- generation of optional XML nodes.
- - rk.plugin.component() now automatically calls rk.uniqueIDs() and stops if IDs are not unique
+ - rk.plugin.component() and rk.rkh.doc() do now interpret the "hints"
+ argument to prevent the generation of optional XML nodes.
+ - rk.plugin.component() now automatically calls rk.uniqueIDs() and stops if
+ IDs are not unique
changes in version 0.06-2 (2013-04-04)
changed:
Modified: trunk/rkward/packages/rkwarddev/DESCRIPTION
===================================================================
--- trunk/rkward/packages/rkwarddev/DESCRIPTION 2014-09-13 23:26:56 UTC (rev 4814)
+++ trunk/rkward/packages/rkwarddev/DESCRIPTION 2014-09-13 23:29:09 UTC (rev 4815)
@@ -15,7 +15,7 @@
Authors at R: c(person(given="Meik", family="Michalke",
email="meik.michalke at hhu.de", role=c("aut", "cre")))
Version: 0.06-4
-Date: 2014-09-01
+Date: 2014-09-14
Collate:
'echo.R'
'i18n.R'
Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.plugin.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.plugin.R 2014-09-13 23:26:56 UTC (rev 4814)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.plugin.R 2014-09-13 23:29:09 UTC (rev 4815)
@@ -80,13 +80,13 @@
if(is.null(lang)){
lang.file <- NULL
} else {
- lang.file <- paste0(".", lang)
+ lang.file <- paste0(lang, ".")
}
- all.children[[length(all.children)+1]] <- rk.XML.code(file=paste0(name, lang.file, ".js"))
+ all.children[[length(all.children)+1]] <- rk.XML.code(file=paste0(lang.file, name, ".js"))
if(isTRUE(help)){
- all.children[[length(all.children)+1]] <- rk.XML.help(file=paste0(name, lang.file, ".rkh"))
+ all.children[[length(all.children)+1]] <- rk.XML.help(file=paste0(lang.file, name, ".rkh"))
} else {}
if(!is.null(include)){
Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.pluginmap.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.pluginmap.R 2014-09-13 23:26:56 UTC (rev 4814)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.pluginmap.R 2014-09-13 23:29:09 UTC (rev 4815)
@@ -23,13 +23,15 @@
#' See \code{link[XiMpLe:rk.XML.about]{rk.XML.about}} for details. Skipped if \code{NULL}.
#' @param components Either an object of class \code{XiMpLe.node} to be pasted as the \code{<components>} section (see
#' \code{\link[rkwarddev:rk.XML.components]{rk.XML.components}} for details). Or a character vector with at least
-#' one plugin component file name, relative path from the pluginmap file and ending with ".xml".
+#' one plugin component file name, relative path from the pluginmap file and ending with ".xml". Can be set to \code{NULL} if
+#' \code{require} is used accordingly.
#' @param hierarchy Either an object of class \code{XiMpLe.node} to be pasted as the \code{<hierarchy>} section (see
#' \code{\link[rkwarddev:rk.XML.hierarchy]{rk.XML.hierarchy}} for details). Or a character vector with instructions
#' where to place the plugin in the menu hierarchy, one list or string for each included component. Valid single values are
#' \code{"file"}, \code{"edit"}, \code{"view"}, \code{"workspace"}, \code{"run"}, \code{"data"},
#' \code{"analysis"}, \code{"plots"}, \code{"distributions"}, \code{"windows"}, \code{"settings"} and \code{"help"},
#' anything else will place it in a "test" menu. If \code{hierarchy} is a list, each entry represents the label of a menu level.
+#' Can be set to \code{NULL} if \code{require} is used accordingly.
#' @param require Either a (list of) objects of class \code{XiMpLe.node} to be pasted as a \code{<require>} section (see
#' \code{\link[rkwarddev:rk.XML.require]{rk.XML.require}} for details). Or a character vector with at least
#' one .pluginmap filename to be included in this one.
@@ -53,13 +55,18 @@
rk.XML.pluginmap <- function(name, about=NULL, components, hierarchy="test",
require=NULL, x11.context=NULL, import.context=NULL, clean.name=TRUE, hints=FALSE, gen.info=TRUE,
- dependencies=NULL, namespace=name, priority="medium", lang=rk.get.language()){
+ dependencies=NULL, namespace=name, priority="medium", id.name="auto", lang=rk.get.language()){
name.orig <- name
if(isTRUE(clean.name)){
# to besure, remove all non-character symbols from name
name <- clean.name(name)
} else {}
+ # one of components or require *must* be used
+ if(is.null(components) && is.null(require)){
+ stop(simpleError("'components' or 'require' must be specified!"))
+ } else {}
+
# .pluginmap has these children in <document>:
# - dependencies (optional)
# - about (optional)
@@ -122,46 +129,48 @@
}
## components section
- if(inherits(components, "XiMpLe.node")){
- # check if this is *really* a components section, otherwise quit and go dancing
- valid.parent("components", node=components, see="rk.XML.components")
- all.children[[length(all.children)+1]] <- components
- # get the IDs for hierarchy section
- component.IDs <- sapply(slot(components, "children"), function(this.comp){
- slot(this.comp, "attributes")$id
- })
- } else {
- components.XML.list <- list()
- num.compos <- length(components)
- compo.names <- names(components)
- for (this.comp.num in 1:num.compos){
- this.comp <- components[this.comp.num]
- if(num.compos > 1) {
- # let's see if we have entry names
- if(length(compo.names) == length(components)){
- xml.basename <- compo.names[this.comp.num]
+ if(!is.null(components)){
+ if(inherits(components, "XiMpLe.node")){
+ # check if this is *really* a components section, otherwise quit and go dancing
+ valid.parent("components", node=components, see="rk.XML.components")
+ all.children[[length(all.children)+1]] <- components
+ # get the IDs for hierarchy section
+ component.IDs <- sapply(slot(components, "children"), function(this.comp){
+ slot(this.comp, "attributes")$id
+ })
+ } else {
+ components.XML.list <- list()
+ num.compos <- length(components)
+ compo.names <- names(components)
+ for (this.comp.num in 1:num.compos){
+ this.comp <- components[this.comp.num]
+ if(num.compos > 1) {
+ # let's see if we have entry names
+ if(length(compo.names) == length(components)){
+ xml.basename <- compo.names[this.comp.num]
+ } else {
+ # remove any directory names and .EXT endings
+ xml.basename <- gsub("(.*/)?([[:alnum:]_]*).+(.*)?", "\\2", this.comp, perl=TRUE)
+ }
} else {
- # remove any directory names and .EXT endings
- xml.basename <- gsub("(.*/)?([[:alnum:]_]*).+(.*)?", "\\2", this.comp, perl=TRUE)
+ xml.basename <- name.orig
}
- } else {
- xml.basename <- name.orig
- }
- names(this.comp) <- NULL
- components.XML.list[[length(components.XML.list) + 1]] <- rk.XML.component(
- label=xml.basename,
- file=this.comp,
- # if this ID get's a change, also change it in rk.plugin.skeleton(show=TRUE)!
- id.name=auto.ids(paste0(name, xml.basename), prefix=ID.prefix("component"), chars=25))
- }
- components.XML <- rk.XML.components(components.XML.list)
+ names(this.comp) <- NULL
+ components.XML.list[[length(components.XML.list) + 1]] <- rk.XML.component(
+ label=xml.basename,
+ file=this.comp,
+ # if this ID get's a change, also change it in rk.plugin.skeleton(show=TRUE)!
+ id.name=auto.ids(paste0(name, xml.basename), prefix=ID.prefix("component"), chars=25))
+ }
+ components.XML <- rk.XML.components(components.XML.list)
- all.children[[length(all.children)+1]] <- components.XML
- # get the IDs for hierarchy section
- component.IDs <- sapply(slot(components.XML, "children"), function(this.comp){
- slot(this.comp, "attributes")$id
- })
- }
+ all.children[[length(all.children)+1]] <- components.XML
+ # get the IDs for hierarchy section
+ component.IDs <- sapply(slot(components.XML, "children"), function(this.comp){
+ slot(this.comp, "attributes")$id
+ })
+ }
+ } else {}
## hierachy section
if(inherits(hierarchy, "XiMpLe.node")){
@@ -169,72 +178,79 @@
valid.parent("hierarchy", node=hierarchy, see="rk.XML.hierarchy")
all.children[[length(all.children)+1]] <- hierarchy
} else {
- # correct for cases with one component and a list
- if(length(component.IDs) == 1 & is.list(hierarchy)){
- if(!is.list(hierarchy[[1]]))
- hierarchy <- list(hierarchy)
- } else {}
- # check if the numbers fit
- if(length(hierarchy) != length(component.IDs)){
- stop(simpleError("Length of 'hierarchy' and number of components must be the same!"))
- } else {}
- # predefined menu points
- main.menu <- c(file="File", edit="Edit", view="View", workspace="Workspace", run="Run",
- data="Data", analysis="Analysis", plots="Plots", distributions="Distributions",
- windows="Windows", settings="Settings", help="Help")
+ # if require loads another pluginmap, we might not need a hierarchy at all
+ if(is.null(hierarchy)){
+ if(is.null(require)){
+ stop(simpleError("if 'hierarchy' is NULL, 'require' must be specified!"))
+ } else {}
+ } else {
+ # correct for cases with one component and a list
+ if(length(component.IDs) == 1 & is.list(hierarchy)){
+ if(!is.list(hierarchy[[1]]))
+ hierarchy <- list(hierarchy)
+ } else {}
+ # check if the numbers fit
+ if(length(hierarchy) != length(component.IDs)){
+ stop(simpleError("Length of 'hierarchy' and number of components must be the same!"))
+ } else {}
+ # predefined menu points
+ main.menu <- c(file="File", edit="Edit", view="View", workspace="Workspace", run="Run",
+ data="Data", analysis="Analysis", plots="Plots", distributions="Distributions",
+ windows="Windows", settings="Settings", help="Help")
- hier.comp.XML <- sapply(1:length(hierarchy), function(this.dial){
- this.comp <- component.IDs[this.dial]
- if(is.list(hierarchy)){
- this.hier <- hierarchy[[this.dial]]
- } else {
- this.hier <- hierarchy[this.dial]
- }
-
- # hierachy can either be a list with menu paths, or predefined
- if(is.list(this.hier)){
- # check if we need to generate a hierarchy tree
- if(length(this.hier) > 1){
- new.hierarchy <- this.hier[2:length(this.hier)]
- new.hierarchy[[length(new.hierarchy) + 1]] <- this.comp
+ hier.comp.XML <- sapply(1:length(hierarchy), function(this.dial){
+ this.comp <- component.IDs[this.dial]
+ if(is.list(hierarchy)){
+ this.hier <- hierarchy[[this.dial]]
} else {
- new.hierarchy <- rk.XML.entry(this.comp)
+ this.hier <- hierarchy[this.dial]
}
- if(this.hier[[1]] %in% names(main.menu)){
- id.names <- sapply(this.hier, function(hier.id){
- return(clean.name(hier.id))
- })
- hier.XML <- rk.XML.menu(
- label=unlist(main.menu[this.hier[[1]]]),
- new.hierarchy,
- id.name=id.names)
+ # hierachy can either be a list with menu paths, or predefined
+ if(is.list(this.hier)){
+ # check if we need to generate a hierarchy tree
+ if(length(this.hier) > 1){
+ new.hierarchy <- this.hier[2:length(this.hier)]
+ new.hierarchy[[length(new.hierarchy) + 1]] <- this.comp
+ } else {
+ new.hierarchy <- rk.XML.entry(this.comp)
+ }
+ if(this.hier[[1]] %in% names(main.menu)){
+ id.names <- sapply(this.hier, function(hier.id){
+ return(clean.name(hier.id))
+ })
+
+ hier.XML <- rk.XML.menu(
+ label=unlist(main.menu[this.hier[[1]]]),
+ new.hierarchy,
+ id.name=id.names)
+ } else {
+ hier.XML <- rk.XML.menu(
+ label=this.hier[[1]],
+ new.hierarchy)
+ }
} else {
- hier.XML <- rk.XML.menu(
- label=this.hier[[1]],
- new.hierarchy)
- }
- } else {
- entry.XML <- rk.XML.menu(
- label=name.orig,
- rk.XML.entry(component=this.comp),
- id.name=auto.ids(paste0(name, this.comp), prefix=ID.prefix("menu"), chars=12))
+ entry.XML <- rk.XML.menu(
+ label=name.orig,
+ rk.XML.entry(component=this.comp),
+ id.name=auto.ids(paste0(name, this.comp), prefix=ID.prefix("menu"), chars=12))
- if(this.hier %in% names(main.menu)){
- hier.XML <- rk.XML.menu(
- label=main.menu[this.hier],
- entry.XML,
- id.name=this.hier)
- } else {
- hier.XML <- rk.XML.menu(
- label="Test",
- entry.XML,
- id.name="test")
+ if(this.hier %in% names(main.menu)){
+ hier.XML <- rk.XML.menu(
+ label=main.menu[this.hier],
+ entry.XML,
+ id.name=this.hier)
+ } else {
+ hier.XML <- rk.XML.menu(
+ label="Test",
+ entry.XML,
+ id.name="test")
+ }
}
- }
- return(hier.XML)
- })
- all.children[[length(all.children)+1]] <- rk.XML.hierarchy(hier.comp.XML)
+ return(hier.XML)
+ })
+ all.children[[length(all.children)+1]] <- rk.XML.hierarchy(hier.comp.XML)
+ }
}
## context sections
@@ -278,8 +294,12 @@
} else {}
}
- # clean the ID of dots and append "_rkward"
- doc.ID.name <- paste0(gsub("[.]*", "", name), "_rkward")
+ if(identical(id.name, "auto") | is.null(id.name)){
+ # clean the ID of dots and append "_rkward"
+ doc.ID.name <- paste0(gsub("[.]*", "", name), "_rkward")
+ } else {
+ doc.ID.name <- id.name
+ }
# check for empty "namespace" value
if(is.null(namespace)){
namespace <- "rkward"
Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.require.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.require.R 2014-09-13 23:26:56 UTC (rev 4814)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.require.R 2014-09-13 23:29:09 UTC (rev 4815)
@@ -27,6 +27,9 @@
#' preferred over \code{map} if that file is in the same package.
#' @param map Character string, should be \code{"namespace::id"} of another .pluginmap to be included.
#' Can be used to address plugin maps which are not part of the same plugin package.
+#' @param localized Logical, only useful for plugins with static internationalisation. Adds the \code{localized}
+#' attribute if set to \code{TRUE}; \code{file} must then point to the default pluginmap in a subdirectory
+#' containing all localised pluginmaps.
#' @return An object of class \code{XiMpLe.node}.
#' @export
#' @seealso \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
@@ -34,7 +37,7 @@
#' test.require <- rk.XML.require("another.pluginmap")
#' cat(pasteXML(test.require))
-rk.XML.require <- function(file=NULL, map=NULL){
+rk.XML.require <- function(file=NULL, map=NULL, localized=FALSE){
# one of file or map *must* be used
if(is.null(file) && is.null(map)){
stop(simpleError("'file' or 'map' must be specified!"))
@@ -45,17 +48,22 @@
} else {}
# now that we know one of both is set
+ set.localized <- NULL
if(!is.null(file)){
if(length(file) > 1 || !is.character(file)){
stop(simpleError("'file' must be a character string!"))
} else {}
+ # check for i18n
+ if(isTRUE(localized)){
+ set.localized <- "true"
+ } else {}
} else {
if(length(map) > 1 || !is.character(map)){
stop(simpleError("'map' must be a character string!"))
} else {}
}
- node <- XMLNode("require", attrs=list(file=file, map=map))
+ node <- XMLNode("require", attrs=list(localized=set.localized, file=file, map=map))
return(node)
}
Modified: trunk/rkward/packages/rkwarddev/R/rk.plugin.skeleton.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.plugin.skeleton.R 2014-09-13 23:26:56 UTC (rev 4814)
+++ trunk/rkward/packages/rkwarddev/R/rk.plugin.skeleton.R 2014-09-13 23:29:09 UTC (rev 4815)
@@ -187,8 +187,12 @@
# check for i18n
if(!is.null(lang)){
- lang <- paste0(".", lang)
- } else {}
+ translate <- TRUE
+ lang.file <- paste0(lang, ".")
+ } else {
+ translate <- FALSE
+ lang.file <- NULL
+ }
# define paths an file names
main.dir <- file.path(path, name)
@@ -197,11 +201,26 @@
namespace.file <- file.path(main.dir, "NAMESPACE")
changelog.file <- file.path(main.dir, "ChangeLog")
rkward.dir <- file.path(main.dir, "inst", "rkward")
+ i18n.dir <- file.path(rkward.dir, "po")
plugin.dir <- file.path(rkward.dir, "plugins")
- # the basic file names
- plugin.fname.pluginmap <- paste0(name, lang, ".pluginmap")
# file names with paths
- plugin.pluginmap <- file.path(rkward.dir, plugin.fname.pluginmap)
+ toplevel.fname.pluginmap <- paste0(name, ".pluginmap")
+ # check for i18n
+ if(isTRUE(translate)){
+ # don't prefix pluginmap for the english default
+ if(identical(lang, "en")){
+ plugin.fname.pluginmap <- paste0(name, ".pluginmap")
+ } else {
+ plugin.fname.pluginmap <- paste0(lang.file, name, ".pluginmap")
+ }
+ plugin.pluginmap <- file.path(i18n.dir, plugin.fname.pluginmap)
+ toplevel.pluginmap <- file.path(rkward.dir, toplevel.fname.pluginmap)
+ default.pluginmap <- file.path(i18n.dir, toplevel.fname.pluginmap)
+ require.default.pluginmap <- file.path("po", toplevel.fname.pluginmap)
+ } else {
+ plugin.fname.pluginmap <- paste0(lang.file, name, ".pluginmap")
+ plugin.pluginmap <- file.path(rkward.dir, toplevel.fname.pluginmap)
+ }
tests.main.dir <- file.path(rkward.dir, "tests")
tests.dir <- file.path(rkward.dir, "tests", name)
testsuite.file <- file.path(tests.main.dir, "testsuite.R")
@@ -228,6 +247,10 @@
stopifnot(dir.create(tests.dir, recursive=TRUE))
message(paste0("Created directory ", tests.dir, "."))
} else {}
+ if(isTRUE(translate) & !file_test("-d", i18n.dir)){
+ stopifnot(dir.create(i18n.dir, recursive=TRUE))
+ message(paste0("Created directory ", i18n.dir, "."))
+ } else {}
## create the main component
got.pm.options <- names(pluginmap)
@@ -264,9 +287,9 @@
rkh.doc <- slot(this.comp, "rkh")
# the basic file names
- plugin.fname.xml <- paste0(comp.name, lang, ".xml")
- plugin.fname.js <- paste0(comp.name, lang, ".js")
- plugin.fname.rkh <- paste0(comp.name, lang, ".rkh")
+ plugin.fname.xml <- paste0(lang.file, comp.name, ".xml")
+ plugin.fname.js <- paste0(lang.file, comp.name, ".js")
+ plugin.fname.rkh <- paste0(lang.file, comp.name, ".rkh")
# file names with paths
plugin.xml <- file.path(plugin.dir, plugin.fname.xml)
plugin.js <- file.path(plugin.dir, plugin.fname.js)
@@ -316,7 +339,11 @@
# get components and hierarchy info from the components list
all.components <- sapply(components, function(this.comp){
comp.name <- slot(this.comp, "name")
- named.compo <- paste0("plugins/", clean.name(comp.name), lang, ".xml")
+ if(isTRUE(translate)){
+ named.compo <- paste0("../plugins/", lang.file, clean.name(comp.name), ".xml")
+ } else {
+ named.compo <- paste0("plugins/", clean.name(comp.name), ".xml")
+ }
# we'll name the component, to nicen the menu entry
names(named.compo) <- comp.name
return(named.compo)
@@ -334,13 +361,30 @@
require=pluginmap[["require"]],
hints=hints,
gen.info=gen.info,
- dependencies=dependencies.node)
+ dependencies=dependencies.node,
+ id.name=paste(gsub("[.]*", "", pluginmap[["name"]]), lang, "rkward", sep="_"))
cat(pasteXML(XML.pluginmap, shine=2, indent.by=indent.by), file=plugin.pluginmap)
# needed for "show"
pm.id.name <- pluginmap[["name"]]
} else {
pm.id.name <- name
}
+
+ if(isTRUE(translate)){
+ # generate toplevel pluginmap for i18n
+ XML.i18n.require <- rk.XML.require(file=require.default.pluginmap, localized=TRUE)
+ XML.i18n.pluginmap <- rk.XML.pluginmap(
+ name=pluginmap[["name"]],
+ components=NULL,
+ hierarchy=NULL,
+ require=XML.i18n.require,
+ hints=FALSE,
+ gen.info=gen.info,
+ id.name=paste0(gsub("[.]*", "", pluginmap[["name"]]), "_main_rkward"),
+ lang="en")
+ cat(pasteXML(XML.i18n.pluginmap, shine=2, indent.by=indent.by), file=toplevel.pluginmap)
+ } else {}
+
if(isTRUE(edit)){
rk.edit.files(plugin.pluginmap, title=plugin.fname.pluginmap, prompt=FALSE)
} else {}
@@ -353,6 +397,7 @@
} else {}
} else {}
} else {}
+
## create testsuite.R
if(isTRUE(tests)){
Modified: trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R 2014-09-13 23:26:56 UTC (rev 4814)
+++ trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R 2014-09-13 23:29:09 UTC (rev 4815)
@@ -4,7 +4,7 @@
#' Package: \tab rkwarddev\cr
#' Type: \tab Package\cr
#' Version: \tab 0.06-4\cr
-#' Date: \tab 2014-09-01\cr
+#' Date: \tab 2014-09-14\cr
#' Depends: \tab R (>= 2.9.0),methods,XiMpLe (>= 0.03-21),rkward (>= 0.5.7)\cr
#' Enhances: \tab rkward\cr
#' Encoding: \tab UTF-8\cr
Modified: trunk/rkward/packages/rkwarddev/inst/NEWS.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/inst/NEWS.Rd 2014-09-13 23:26:56 UTC (rev 4814)
+++ trunk/rkward/packages/rkwarddev/inst/NEWS.Rd 2014-09-13 23:29:09 UTC (rev 4815)
@@ -1,20 +1,25 @@
\name{NEWS}
\title{News for Package 'rkwarddev'}
\encoding{UTF-8}
-\section{Changes in rkwarddev version 0.06-4 (2014-09-01)}{
+\section{Changes in rkwarddev version 0.06-4 (2014-09-14)}{
\subsection{added}{
\itemize{
- \item new functions \code{rk.set.language()}, \code{rk.get.language()} and \code{i18n()} to facilitate
- static internationalisation of plugins; makes use of a new internal environment
- .rkdev.env
- \item new parameter \code{"lang"} in functions \code{rk.rkh.doc()}, \code{rk.XML.plugin()}, \code{rk.XML.pluginmap()}
- and \code{rk.plugin.skeleton()} for internationalisation. if used, the attributes \code{"lang"}
- and "xml:lang" will be set in the <document> root of the generated files, respectively
+ \item new functions \code{rk.set.language()}, \code{rk.get.language()} and \code{i18n()} to
+ facilitate static internationalisation of plugins; makes use of a new internal
+ environment .rkdev.env
+ \item new parameter \code{"lang"} in functions \code{rk.rkh.doc()}, \code{rk.XML.plugin()},
+ \code{rk.XML.pluginmap()} and \code{rk.plugin.skeleton()} for internationalisation. if used, the
+ attributes \code{"lang"} and "xml:lang" will be set in the <document> root of
+ the generated files, respectively
+ \item new parameter \code{"localized"} in \code{rk.XML.require()} for internationalisation
+ \item the document id in \code{rk.XML.pluginmap()} can now be set manually
}
}
\subsection{fixed}{
\itemize{
\item abbreviation of labels now limits valid characters to [0-9A-Za-z]
+ \item in \code{rk.XML.pluginmap()}, \code{"components"} and \code{"hierarchy"} may be set to NULL if
+ \code{"require"} is used accordingly
}
}
}
@@ -32,9 +37,10 @@
}
\subsection{changed}{
\itemize{
- \item \code{rk.plugin.component()} and \code{rk.rkh.doc()} do now interpret the \code{"hints"} argument to prevent the
- generation of optional XML nodes.
- \item \code{rk.plugin.component()} now automatically calls \code{rk.uniqueIDs()} and stops if IDs are not unique
+ \item \code{rk.plugin.component()} and \code{rk.rkh.doc()} do now interpret the \code{"hints"}
+ argument to prevent the generation of optional XML nodes.
+ \item \code{rk.plugin.component()} now automatically calls \code{rk.uniqueIDs()} and stops if
+ IDs are not unique
}
}
}
Modified: trunk/rkward/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
===================================================================
(Binary files differ)
Modified: trunk/rkward/packages/rkwarddev/man/rk.XML.pluginmap.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.XML.pluginmap.Rd 2014-09-13 23:26:56 UTC (rev 4814)
+++ trunk/rkward/packages/rkwarddev/man/rk.XML.pluginmap.Rd 2014-09-13 23:29:09 UTC (rev 4815)
@@ -7,7 +7,7 @@
require = NULL, x11.context = NULL, import.context = NULL,
clean.name = TRUE, hints = FALSE, gen.info = TRUE,
dependencies = NULL, namespace = name, priority = "medium",
- lang = rk.get.language())
+ id.name = "auto", lang = rk.get.language())
}
\arguments{
\item{name}{Character string, name of the plugin.}
@@ -18,7 +18,8 @@
\item{components}{Either an object of class \code{XiMpLe.node} to be pasted as the \code{<components>} section (see
\code{\link[rkwarddev:rk.XML.components]{rk.XML.components}} for details). Or a character vector with at least
one plugin component file name,
- relative path from the pluginmap file and ending with ".xml".}
+ relative path from the pluginmap file and ending with ".xml". Can be set to \code{NULL} if
+\code{require} is used accordingly.}
\item{hierarchy}{Either an object of class \code{XiMpLe.node} to be pasted as the \code{<hierarchy>} section (see
\code{\link[rkwarddev:rk.XML.hierarchy]{rk.XML.hierarchy}} for details). Or a character vector with instructions
@@ -29,7 +30,8 @@
\code{"analysis"}, \code{"plots"}, \code{"distributions"}, \code{"windows"},
\code{"settings"} and \code{"help"},
anything else will place it in a "test" menu. If \code{hierarchy} is a list,
- each entry represents the label of a menu level.}
+ each entry represents the label of a menu level.
+Can be set to \code{NULL} if \code{require} is used accordingly.}
\item{require}{Either a (list of) objects of class \code{XiMpLe.node} to be pasted as a \code{<require>} section (see
\code{\link[rkwarddev:rk.XML.require]{rk.XML.require}} for details). Or a character vector with at least
Modified: trunk/rkward/packages/rkwarddev/man/rk.XML.require.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.XML.require.Rd 2014-09-13 23:26:56 UTC (rev 4814)
+++ trunk/rkward/packages/rkwarddev/man/rk.XML.require.Rd 2014-09-13 23:29:09 UTC (rev 4815)
@@ -3,7 +3,7 @@
\alias{rk.XML.require}
\title{Create XML "require" node for RKWard plugins}
\usage{
-rk.XML.require(file = NULL, map = NULL)
+rk.XML.require(file = NULL, map = NULL, localized = FALSE)
}
\arguments{
\item{file}{Character string,
@@ -13,6 +13,11 @@
\item{map}{Character string,
should be \code{"namespace::id"} of another .pluginmap to be included.
Can be used to address plugin maps which are not part of the same plugin package.}
+
+\item{localized}{Logical,
+ only useful for plugins with static internationalisation. Adds the \code{localized}
+attribute if set to \code{TRUE}; \code{file} must then point to the default pluginmap in a subdirectory
+containing all localised pluginmaps.}
}
\value{
An object of class \code{XiMpLe.node}.
Modified: trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd 2014-09-13 23:26:56 UTC (rev 4814)
+++ trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd 2014-09-13 23:29:09 UTC (rev 4815)
@@ -11,7 +11,7 @@
Package: \tab rkwarddev\cr
Type: \tab Package\cr
Version: \tab 0.06-4\cr
-Date: \tab 2014-09-01\cr
+Date: \tab 2014-09-14\cr
Depends: \tab R (>= 2.9.0),methods,XiMpLe (>= 0.03-21),rkward (>= 0.5.7)\cr
Enhances: \tab rkward\cr
Encoding: \tab UTF-8\cr
More information about the rkward-tracker
mailing list