GETTEXT: optionaly allow to escape translated tokens.
authorWilfried Goesgens <dothebart@citadel.org>
Sun, 23 Jun 2013 14:41:24 +0000 (16:41 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 23 Jun 2013 14:41:24 +0000 (16:41 +0200)
webcit/gettext.c
webcit/setup.c
webcit/subst.c

index d687588..ba4b5f3 100644 (file)
@@ -427,10 +427,11 @@ void initialize_locales(void) {
 
 #endif /* ENABLE_NLS */
 
-
 void TmplGettext(StrBuf *Target, WCTemplputParams *TP)
 {
-       StrBufAppendBufPlain(Target, _(TP->Tokens->Params[0]->Start), -1, 0);
+       const char *Text = _(TP->Tokens->Params[0]->Start);
+
+       StrBufAppendTemplateStr(Target, TP, Text, 1);
 }
 
 
index cfb215e..ebac8d2 100644 (file)
@@ -28,6 +28,10 @@ void RegisterNS(const char *NSName, long len,
                WCHandlerFunc HandlerFunc,
                WCPreevalFunc PreEvalFunc,
                int ContextRequired){}
+void StrBufAppendTemplateStr(StrBuf *Target, 
+                            WCTemplputParams *TP,
+                            const char *Source, 
+                            int FormatTypeIndex){}
 void RegisterHeaderHandler(const char *Name, long Len, Header_Evaluator F){}
 pthread_key_t MyConKey;
 
index 6c80802..2ab6e6b 100644 (file)
@@ -43,6 +43,7 @@ const char EmptyStr[]="";
 #define SV_PREEVALUATED 6
 
 
+
 /*
  * Dynamic content for variable substitution in templates
  */
@@ -1203,10 +1204,10 @@ WCTemplateToken *NewTemplateSubstitute(StrBuf *Buf,
                }
                break;
        case SV_GETTEXT:
-               if (NewToken->nParameters !=1) {
+               if ((NewToken->nParameters < 1) || (NewToken->nParameters > 2)) {
                        LogTemplateError(                               
                                NULL, "Gettext", ERR_NAME, &TP,
-                               "requires exactly 1 parameter, you gave %d params", 
+                               "requires 1 or 2 parameter, you gave %d params", 
                                NewToken->nParameters);
                        NewToken->Flags = 0;
                        break;
@@ -2534,7 +2535,6 @@ void tmpl_do_tabbed(StrBuf *Target, WCTemplputParams *TP)
        {
 ////   TODO jetzt      memcpy (&SubTP, TP, sizeof(WCTemplputParams));
 //             SubTP.Filter.ControlContextType = ;
-
                StrTabbedDialog(Target, nTabs, TabNames);
                for (i = 0; i < ntabs; i++) {
                        memset(&TS, 0, sizeof(tab_struct));