* remove linewrap
[citadel.git] / webcit / subst.c
index 3231c931e086dfd5157eaf35f6b95b107ef81612..c4abfc890612b69b1700e01ce77bb1d3531b85e8 100644 (file)
@@ -32,9 +32,11 @@ HashList *Iterators;
 HashList *Conditionals;
 HashList *SortHash;
 
+int DumpTemplateI18NStrings = 0;
 int LoadTemplates = 0;
 int dbg_bactrace_template_errors = 0;
 WCTemplputParams NoCtx;
+StrBuf *I18nDump = NULL;
 
 #define SV_GETTEXT 1
 #define SV_CONDITIONAL 2
@@ -1138,6 +1140,9 @@ TemplateParam *GetNextParameter(StrBuf *Buf, const char **pCh, const char *pe, W
               (*pch == ',' )||
               (*pch == '\n')) pch ++;
 
+       if (DumpTemplateI18NStrings && (Parm->Type == TYPE_GETTEXT)) {
+               StrBufAppendPrintf(I18nDump, "_(\"%s\");\n", Parm->Start);
+       }
        *pCh = pch;
        return Parm;
 }
@@ -1250,6 +1255,9 @@ WCTemplateToken *NewTemplateSubstitute(StrBuf *Buf,
                        NewToken->Flags = 0;
                        break;
                }
+               if (DumpTemplateI18NStrings) {
+                       StrBufAppendPrintf(I18nDump, "_(\"%s\");\n", NewToken->Params[0]->Start);
+               }
                break;
        case SV_SUBTEMPL:
                if (NewToken->nParameters != 1) {