summaryrefslogtreecommitdiff
path: root/app/i18n/stripmsg.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-08 11:53:12 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-08 11:53:12 +0200
commite50482f994b6ebcce864a412111d376e99205cdb (patch)
treeff3192c6aaf213c4922521bed988e4ed4147f537 /app/i18n/stripmsg.c
parentd3897ce090dbeb220ed2c782f095597e417cf3cc (diff)
parentb623f5953691b2a0614e6f1f4def86bdbb9a4113 (diff)
Update upstream source from tag 'upstream/5.2.0Beta2.1'
Update to upstream version '5.2.0Beta2.1' with Debian dir 1576f25f4c1496abfed44af31ead67d32c7be650
Diffstat (limited to 'app/i18n/stripmsg.c')
-rw-r--r--app/i18n/stripmsg.c23
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++;