[rkward-cvs] [rkward] packages/rkwarddev/R: fixed a regex issue in i18n(), looking for placeholders

m.eik michalke meik.michalke at uni-duesseldorf.de
Sun Feb 1 20:35:49 UTC 2015


Git commit d19e381f1e17201c545ee0a1550e16e08a29cf0a by m.eik michalke.
Committed on 01/02/2015 at 20:35.
Pushed by meikm into branch 'master'.

fixed a regex issue in i18n(), looking for placeholders

M  +2    -1    packages/rkwarddev/R/i18n.R

http://commits.kde.org/rkward/d19e381f1e17201c545ee0a1550e16e08a29cf0a

diff --git a/packages/rkwarddev/R/i18n.R b/packages/rkwarddev/R/i18n.R
index 47ea15e..0d48d14 100644
--- a/packages/rkwarddev/R/i18n.R
+++ b/packages/rkwarddev/R/i18n.R
@@ -53,7 +53,8 @@ i18n <- function(msgid, ..., context=NULL, plural=NULL, newline=""){
   if(length(placeholders) > 0){
     # do some sanitiy checks here -- is there a placeholder in the strings for each dots value?
     # grep valid placeholders out of the messages
-    msgSplit <- unique(unlist(strsplit(paste(msgid, plural), "[[:space:]]+")))
+    msgCleaned <- gsub("([^%[:digit:]]{2,})", " ", paste(msgid, plural))
+    msgSplit <- unique(unlist(strsplit(msgCleaned, "[[:space:]]+")))
     msgPlHd <- msgSplit[grep("%[[:digit:]]", msgSplit)]
     # which placeholders are needed?
     plHdNeeded <- paste0("%", 1:length(placeholders))


------------------------------------------------------------------------------
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