[rkward-cvs] SF.net SVN: rkward-code:[4999] trunk/rkward/packages/rkwarddev
m-eik at users.sf.net
m-eik at users.sf.net
Sun Nov 9 19:39:38 UTC 2014
Revision: 4999
http://sourceforge.net/p/rkward/code/4999
Author: m-eik
Date: 2014-11-09 19:39:37 +0000 (Sun, 09 Nov 2014)
Log Message:
-----------
rkwarddev: some initial support for <!-- i18n: ... --> and i18n_context="..."
Modified Paths:
--------------
trunk/rkward/packages/rkwarddev/ChangeLog
trunk/rkward/packages/rkwarddev/DESCRIPTION
trunk/rkward/packages/rkwarddev/R/rk-internal.R
trunk/rkward/packages/rkwarddev/R/rk.XML.attribute.R
trunk/rkward/packages/rkwarddev/R/rk.XML.cbox.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.attribute.Rd
trunk/rkward/packages/rkwarddev/man/rk.XML.cbox.Rd
trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd
Modified: trunk/rkward/packages/rkwarddev/ChangeLog
===================================================================
--- trunk/rkward/packages/rkwarddev/ChangeLog 2014-11-08 20:34:47 UTC (rev 4998)
+++ trunk/rkward/packages/rkwarddev/ChangeLog 2014-11-09 19:39:37 UTC (rev 4999)
@@ -1,6 +1,6 @@
ChangeLog for package rkwarddev
-changes in version 0.06-6 (2014-10-27)
+changes in version 0.06-6 (2014-11-09)
fixed:
- rk.XML.optionset() does now allow to re-use objects defined in the same
function call (i.e., refer to optioncolumns in the logic section)
@@ -11,6 +11,8 @@
to have more control over the markup
- added "property" and "duplicates" arguments to rk.XML.valueslot() and rk.XML.varslot().
- rk.XML.pluginmap() now adds a "po_id" attribute to pluginmaps, necessary for i18n
+ - new attribute "i18n" added to several XML functions; it takes a list with the named arguments
+ "comment" or "context" to either produce an i18n comment node or an "i18n_context" attribute
changes in version 0.06-5 (2014-10-19)
fixed:
Modified: trunk/rkward/packages/rkwarddev/DESCRIPTION
===================================================================
--- trunk/rkward/packages/rkwarddev/DESCRIPTION 2014-11-08 20:34:47 UTC (rev 4998)
+++ trunk/rkward/packages/rkwarddev/DESCRIPTION 2014-11-09 19:39:37 UTC (rev 4999)
@@ -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-6
-Date: 2014-10-26
+Date: 2014-11-09
Collate:
'00_class_01_rk.JS.arr.R'
'00_class_02_rk.JS.var.R'
Modified: trunk/rkward/packages/rkwarddev/R/rk-internal.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk-internal.R 2014-11-08 20:34:47 UTC (rev 4998)
+++ trunk/rkward/packages/rkwarddev/R/rk-internal.R 2014-11-09 19:39:37 UTC (rev 4999)
@@ -1344,4 +1344,48 @@
} else {}
})
}
-## end function rk.register.options()
\ No newline at end of file
+## end function rk.register.options()
+
+
+## function check.i18n()
+# checks for additional i18n info in XiMpLe nodes. returns either an appended or altered list of
+# attributes, or a XiMpLe node with an i18n comment
+# i18n: either a list with possible named elements "context" or "comment", or FALSE;
+# if the latter, "label" will be renamed to "noi18n_label", "title" to "noi18n_title"
+# attrs: a list of previously defined attributes
+# comment: if TRUE, returns a comment node, else a list of attributes
+check.i18n <- function(i18n=NULL, attrs=list(), comment=FALSE){
+ if(isTRUE(comment)){
+ result <- NULL
+ } else {
+ result <- attrs
+ }
+ if(is.null(i18n)){
+ return(result)
+ } else {
+ if(is.list(i18n)){
+ if(!names(i18n) %in% c("comment", "context")){
+ stop(simpleError("i18n: only elements named \"comment\" or \"context\" are supported!"))
+ } else {}
+ if(isTRUE(comment)){
+ if("comment" %in% names(i18n)){
+ result <- XMLNode("!--", paste0("i18n: ", i18n[["comment"]]))
+ } else {}
+ } else {
+ if("context" %in% names(i18n)){
+ result[["i18n_context"]] <- i18n[["context"]]
+ } else{}
+ }
+ } else if(is.logical(i18n) & !isTRUE(i18n)){
+ if("label" %in% names(result)){
+ result[["noi18n_label"]] <- result[["label"]]
+ result[["label"]] <- NULL
+ } else {}
+ if("title" %in% names(result)){
+ result[["noi18n_title"]] <- result[["title"]]
+ result[["title"]] <- NULL
+ } else {}
+ } else {}
+ }
+ return(result)
+} ## end function check.i18n()
Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.attribute.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.attribute.R 2014-11-08 20:34:47 UTC (rev 4998)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.attribute.R 2014-11-09 19:39:37 UTC (rev 4999)
@@ -25,6 +25,9 @@
#' or an object of class \code{XiMpLe.node} (whose \code{id} will be extracted and used).
#' @param value Character string, new value for the attribute.
#' @param label Character string, label associated with the attribute.
+#' @param i18n A named list with the optional element \code{context}, to give some \code{i18n_context}
+#' information for this node. If set to \code{FALSE}, the attribute \code{label} will be renamed into
+#' \code{noi18n_label}.
#' @return An object of class \code{XiMpLe.node}.
#' @export
#' @seealso
@@ -36,7 +39,7 @@
#' test.attribute <- rk.XML.attribute(test.checkbox, value="bar2", label="bar")
#' cat(pasteXML(test.attribute))
-rk.XML.attribute <- function(id, value=NULL, label=NULL){
+rk.XML.attribute <- function(id, value=NULL, label=NULL, i18n=NULL){
# let's see if we need to extract IDs first
attr.list <- list(id=check.ID(id))
@@ -51,6 +54,9 @@
attr.list[["label"]] <- label
} else {}
+ # check for additional i18n info; if FALSE, "label" will be renamed to "noi18n_label"
+ attr.list <- check.i18n(i18n=i18n, attrs=attr.list)
+
node <- XMLNode("attribute", attrs=attr.list)
return(node)
Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.cbox.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.cbox.R 2014-11-08 20:34:47 UTC (rev 4998)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.cbox.R 2014-11-09 19:39:37 UTC (rev 4999)
@@ -30,6 +30,9 @@
#' @param component Character string, name of the component this node belongs to. Only needed if you
#' want to use the scan features for automatic help file generation; needs \code{help} to be set
#' accordingly, too!
+#' @param i18n A named list with the optional element \code{context}, to give some \code{i18n_context}
+#' information for this node. If set to \code{FALSE}, the attribute \code{label} will be renamed into
+#' \code{noi18n_label}.
#' @return An object of class \code{XiMpLe.node}.
#' @note There's also a simple wrapper function \code{rk.XML.checkbox}.
#' @export
@@ -42,7 +45,7 @@
#' rk.XML.cbox(label="bar", value="bar2"))))
#' cat(pasteXML(test.checkboxes))
-rk.XML.cbox <- function(label, value="true", un.value=NULL, chk=FALSE, id.name="auto", help=NULL, component=rk.get.comp()){
+rk.XML.cbox <- function(label, value="true", un.value=NULL, chk=FALSE, id.name="auto", help=NULL, component=rk.get.comp(), i18n=NULL){
if(identical(id.name, "auto")){
id <- auto.ids(label, prefix=ID.prefix("checkbox"))
} else {
@@ -57,6 +60,9 @@
attr.list[["checked"]] <- "true"
} else {}
+ # check for additional i18n info; if FALSE, "label" will be renamed to "noi18n_label"
+ attr.list <- check.i18n(i18n=i18n, attrs=attr.list)
+
checkbox <- XMLNode("checkbox", attrs=attr.list)
# check for .rkh content
Modified: trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R 2014-11-08 20:34:47 UTC (rev 4998)
+++ trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R 2014-11-09 19:39:37 UTC (rev 4999)
@@ -4,7 +4,7 @@
#' Package: \tab rkwarddev\cr
#' Type: \tab Package\cr
#' Version: \tab 0.06-6\cr
-#' Date: \tab 2014-10-26\cr
+#' Date: \tab 2014-11-09\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-11-08 20:34:47 UTC (rev 4998)
+++ trunk/rkward/packages/rkwarddev/inst/NEWS.Rd 2014-11-09 19:39:37 UTC (rev 4999)
@@ -1,7 +1,7 @@
\name{NEWS}
\title{News for Package 'rkwarddev'}
\encoding{UTF-8}
-\section{Changes in rkwarddev version 0.06-6 (2014-10-26)}{
+\section{Changes in rkwarddev version 0.06-6 (2014-11-09)}{
\subsection{fixed}{
\itemize{
\item \code{rk.XML.optionset()} does now allow to re-use objects defined in the same
@@ -15,6 +15,9 @@
\item all \code{"help"} values can now be a list of character strings or XiMpLe nodes,
to have more control over the markup
\item added \code{"property"} and \code{"duplicates"} arguments to \code{rk.XML.valueslot()} and \code{rk.XML.varslot()}.
+ \item \code{rk.XML.pluginmap()} now adds a \code{"po_id"} attribute to pluginmaps, necessary for i18n
+ \item new attribute \code{"i18n"} added to several XML functions; it takes a list with the named arguments
+ \code{"comment"} or \code{"context"} to either produce an i18n comment node or an \code{"i18n_context"} attribute
}
}
}
Modified: trunk/rkward/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
===================================================================
(Binary files differ)
Modified: trunk/rkward/packages/rkwarddev/man/rk.XML.attribute.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.XML.attribute.Rd 2014-11-08 20:34:47 UTC (rev 4998)
+++ trunk/rkward/packages/rkwarddev/man/rk.XML.attribute.Rd 2014-11-09 19:39:37 UTC (rev 4999)
@@ -3,7 +3,7 @@
\alias{rk.XML.attribute}
\title{Create XML "attribute" node for RKWard plugins}
\usage{
-rk.XML.attribute(id, value = NULL, label = NULL)
+rk.XML.attribute(id, value = NULL, label = NULL, i18n = NULL)
}
\arguments{
\item{id}{Either a character string (the \code{id} of the property whose attribute should be set),
@@ -12,6 +12,12 @@
\item{value}{Character string, new value for the attribute.}
\item{label}{Character string, label associated with the attribute.}
+
+\item{i18n}{A named list with the optional element \code{context},
+ to give some \code{i18n_context}
+information for this node. If set to \code{FALSE},
+ the attribute \code{label} will be renamed into
+\code{noi18n_label}.}
}
\value{
An object of class \code{XiMpLe.node}.
Modified: trunk/rkward/packages/rkwarddev/man/rk.XML.cbox.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.XML.cbox.Rd 2014-11-08 20:34:47 UTC (rev 4998)
+++ trunk/rkward/packages/rkwarddev/man/rk.XML.cbox.Rd 2014-11-09 19:39:37 UTC (rev 4999)
@@ -5,7 +5,7 @@
\title{Create XML node "checkbox" for RKWard plugins}
\usage{
rk.XML.cbox(label, value = "true", un.value = NULL, chk = FALSE,
- id.name = "auto", help = NULL, component = rk.get.comp())
+ id.name = "auto", help = NULL, component = rk.get.comp(), i18n = NULL)
}
\arguments{
\item{label}{Character string, a text label for this plugin element.}
@@ -29,6 +29,12 @@
name of the component this node belongs to. Only needed if you
want to use the scan features for automatic help file generation; needs \code{help} to be set
accordingly, too!}
+
+\item{i18n}{A named list with the optional element \code{context},
+ to give some \code{i18n_context}
+information for this node. If set to \code{FALSE},
+ the attribute \code{label} will be renamed into
+\code{noi18n_label}.}
}
\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-11-08 20:34:47 UTC (rev 4998)
+++ trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd 2014-11-09 19:39:37 UTC (rev 4999)
@@ -11,7 +11,7 @@
Package: \tab rkwarddev\cr
Type: \tab Package\cr
Version: \tab 0.06-6\cr
-Date: \tab 2014-10-26\cr
+Date: \tab 2014-11-09\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