[rkward-cvs] [rkward] packages/rkwarddev: two new functions to generate <i18n /> and <label /> nodes

m.eik michalke meik.michalke at uni-duesseldorf.de
Sun Feb 1 17:55:26 UTC 2015


Git commit 5f8eefefc068e093f30c40c471a0247812449862 by m.eik michalke.
Committed on 01/02/2015 at 17:55.
Pushed by meikm into branch 'master'.

two new functions to generate <i18n /> and <label /> nodes

A  +55   -0    packages/rkwarddev/R/rk.XML.i18n.R
A  +46   -0    packages/rkwarddev/R/rk.rkh.label.R
A  +31   -0    packages/rkwarddev/man/rk.XML.i18n.Rd
A  +31   -0    packages/rkwarddev/man/rk.rkh.label.Rd

http://commits.kde.org/rkward/5f8eefefc068e093f30c40c471a0247812449862

diff --git a/packages/rkwarddev/R/rk.XML.i18n.R b/packages/rkwarddev/R/rk.XML.i18n.R
new file mode 100644
index 0000000..0697cc3
--- /dev/null
+++ b/packages/rkwarddev/R/rk.XML.i18n.R
@@ -0,0 +1,55 @@
+# Copyright 2010-2015 Meik Michalke <meik.michalke at hhu.de>
+#
+# This file is part of the R package rkwarddev.
+#
+# rkwarddev is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# rkwarddev is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rkwarddev.  If not, see <http://www.gnu.org/licenses/>.
+
+
+#' Create XML node "i18n" for RKWard plugins
+#'
+#' @param label Character string, the label which is to be translated.
+#' @param id.name Character string, a unique ID for the new property.
+#'    If \code{"auto"}, an ID will be generated automatically from the label.
+#' @param i18n Either a character string or a named list with the optional elements \code{context}
+#'    or \code{comment}, to give some \code{i18n_context} information for this node.
+#' @return An object of class \code{XiMpLe.node}.
+#' @export
+#' @seealso
+#'    \code{\link[rkwarddev:rk.XML.logic]{rk.XML.logic}}
+#'    and the \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
+#' @examples
+#' test.i18n <- rk.XML.i18n(label="Label test")
+
+rk.XML.i18n <- function(label, id.name="auto", i18n=NULL){
+
+  if(identical(id.name, "auto")){
+    # try autogenerating some id
+    attr.list <- list(id=auto.ids(label, prefix=ID.prefix("i18n", length=4), chars=10))
+  } else {
+    attr.list <- list(id=id.name)
+  }
+
+  attr.list[["label"]] <- label
+
+  # check for additional i18n info
+  attr.list <- check.i18n(i18n=i18n, attrs=attr.list)
+
+  node <- check.i18n(
+    i18n=i18n,
+    node=XMLNode("i18n", attrs=attr.list),
+    comment=TRUE
+  )
+
+  return(node)
+}
diff --git a/packages/rkwarddev/R/rk.rkh.label.R b/packages/rkwarddev/R/rk.rkh.label.R
new file mode 100644
index 0000000..6cabe15
--- /dev/null
+++ b/packages/rkwarddev/R/rk.rkh.label.R
@@ -0,0 +1,46 @@
+# Copyright 2010-2015 Meik Michalke <meik.michalke at hhu.de>
+#
+# This file is part of the R package rkwarddev.
+#
+# rkwarddev is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# rkwarddev is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rkwarddev.  If not, see <http://www.gnu.org/licenses/>.
+
+
+#' Create XML "label" node for RKWard help pages
+#'
+#' @param id Either a character string (the \code{id} name of the element in the plugin, of
+#'    which to copy the \code{label} attribute), or an object of class \code{XiMpLe.node}
+#'    (whose \code{id} will be extracted and used).
+#' @param i18n Either a character string or a named list with the optional elements \code{context}
+#'    or \code{comment}, to give some \code{i18n_context} information for this node.
+#' @return An object of class \code{XiMpLe.node}.
+#' @export
+#' @seealso
+#'    \code{\link[rkwarddev:rk.rkh.doc]{rk.rkh.doc}}
+#'    and the \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
+#' @examples
+#' test.cbox <- rk.XML.cbox(label="foo", value="bar")
+#' (test.label <- rk.rkh.label(test.cbox))
+
+rk.rkh.label <- function(id, i18n=NULL){
+  # check for additional i18n info
+  attr.list <- check.i18n(i18n=i18n, attrs=list(id=id))
+
+  node <- check.i18n(
+    i18n=i18n,
+    node=XMLNode("label", attrs=attr.list),
+    comment=TRUE
+  )
+
+  return(node)
+}
diff --git a/packages/rkwarddev/man/rk.XML.i18n.Rd b/packages/rkwarddev/man/rk.XML.i18n.Rd
new file mode 100644
index 0000000..e92337e
--- /dev/null
+++ b/packages/rkwarddev/man/rk.XML.i18n.Rd
@@ -0,0 +1,31 @@
+% Generated by roxygen2 (4.1.0): do not edit by hand
+% Please edit documentation in R/rk.XML.i18n.R
+\name{rk.XML.i18n}
+\alias{rk.XML.i18n}
+\title{Create XML node "i18n" for RKWard plugins}
+\usage{
+rk.XML.i18n(label, id.name = "auto", i18n = NULL)
+}
+\arguments{
+\item{label}{Character string, the label which is to be translated.}
+
+\item{id.name}{Character string, a unique ID for the new property.
+If \code{"auto"}, an ID will be generated automatically from the label.}
+
+\item{i18n}{Either a character string or a named list with the optional elements \code{context}
+or \code{comment}, to give some \code{i18n_context} information for this node.}
+}
+\value{
+An object of class \code{XiMpLe.node}.
+}
+\description{
+Create XML node "i18n" for RKWard plugins
+}
+\examples{
+test.i18n <- rk.XML.i18n(label="Label test")
+}
+\seealso{
+\code{\link[rkwarddev:rk.XML.logic]{rk.XML.logic}}
+   and the \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
+}
+
diff --git a/packages/rkwarddev/man/rk.rkh.label.Rd b/packages/rkwarddev/man/rk.rkh.label.Rd
new file mode 100644
index 0000000..f11c11c
--- /dev/null
+++ b/packages/rkwarddev/man/rk.rkh.label.Rd
@@ -0,0 +1,31 @@
+% Generated by roxygen2 (4.1.0): do not edit by hand
+% Please edit documentation in R/rk.rkh.label.R
+\name{rk.rkh.label}
+\alias{rk.rkh.label}
+\title{Create XML "label" node for RKWard help pages}
+\usage{
+rk.rkh.label(id, i18n = NULL)
+}
+\arguments{
+\item{id}{Either a character string (the \code{id} name of the element in the plugin, of
+which to copy the \code{label} attribute), or an object of class \code{XiMpLe.node}
+(whose \code{id} will be extracted and used).}
+
+\item{i18n}{Either a character string or a named list with the optional elements \code{context}
+or \code{comment}, to give some \code{i18n_context} information for this node.}
+}
+\value{
+An object of class \code{XiMpLe.node}.
+}
+\description{
+Create XML "label" node for RKWard help pages
+}
+\examples{
+test.cbox <- rk.XML.cbox(label="foo", value="bar")
+(test.label <- rk.rkh.label(test.cbox))
+}
+\seealso{
+\code{\link[rkwarddev:rk.rkh.doc]{rk.rkh.doc}}
+   and the \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
+}
+


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
rkward-cvs mailing list
rkward-cvs at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rkward-cvs


More information about the rkward-tracker mailing list