diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-24 21:26:53 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-24 21:26:53 +0200 |
commit | df247efec654e512242e4f4f1b0212034f9e01fe (patch) | |
tree | 25c02e16957f3aa613af30c140fd8e8a3d52fda6 /app/i18n/stripmsg.c | |
parent | d0b6a8a4ec298024f14f704f9e40a6f9d324ccf3 (diff) | |
parent | a5ade52caa489cf0a713e0f02b764000d203140e (diff) |
Merge branch 'release/debian/1%5.2.0Beta2.1-1' into masterdebian/1%5.2.0Beta2.1-1
Diffstat (limited to 'app/i18n/stripmsg.c')
-rw-r--r-- | app/i18n/stripmsg.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/app/i18n/stripmsg.c b/app/i18n/stripmsg.c index 1e3dc36..6010530 100644 --- a/app/i18n/stripmsg.c +++ b/app/i18n/stripmsg.c @@ -28,18 +28,31 @@ */ typedef enum { MODE_XTR, MODE_XTQ, MODE_TIP } mode_e; +/** + * Write translator comments to messagefile + * + * \param [in,out] file the source file. + * \param line the source line. + */ + +void translatorcomment(char *file, unsigned line) +{ + printf("// i18n: %s:%d\n", file, line); +} /* Process the given input file. */ -void process( mode_e mode, FILE * inFile ) +void process( mode_e mode, FILE * inFile, char *fileName ) { char line[4096]; char * cp; int len; int offset; int i; + unsigned lineNo = 0; while ( fgets( line, sizeof(line), inFile ) != NULL ) { + lineNo++; offset = 0; switch (mode) @@ -47,7 +60,9 @@ void process( mode_e mode, FILE * inFile ) case MODE_XTR: if (strncmp( line, "MESSAGE", 7 ) == 0) { + translatorcomment(fileName, lineNo); while ( ( fgets( line, sizeof(line), inFile ) ) != NULL ) { + lineNo++; if ( strncmp(line, "END", 3) == 0) /* End of message block */ break; @@ -110,6 +125,7 @@ void process( mode_e mode, FILE * inFile ) line[len] = '\0'; if (len == 0) break; + translatorcomment(fileName, lineNo); printf("N_(\"%s\");\n", line+offset); } break; // case MODE_XTQ: @@ -130,6 +146,7 @@ void process( mode_e mode, FILE * inFile ) cp[1] = '\0'; + translatorcomment(fileName, lineNo); /* if line ended with a continuation sign, get the rest */ while (*cp=='\\') { *cp++ = '\\'; @@ -139,7 +156,7 @@ void process( mode_e mode, FILE * inFile ) if (!fgets( cp, (sizeof(line)) - (cp-line), inFile )) { return; } - + lineNo++; /* lines starting with hash sign are ignored (comments) */ if (*cp=='#') continue; @@ -239,7 +256,7 @@ int main ( int argc, char * argv[] ) } /* Process file */ - process( mode, inFile ); + process( mode, inFile, argv[i] ); /* Close file */ files++; |