Fix source code to properly generate xlat.c

This commit is contained in:
Dianne Skoll
2025-08-11 18:13:47 -04:00
parent f21f8ee8d0
commit 865ebae6f8
4 changed files with 19 additions and 10 deletions

View File

@@ -49,7 +49,7 @@ test: all
xlat.c: $(REMINDSRCS)
@echo "#include <stddef.h>" > xlat.c
@echo "char const *translatables[] = {" >> xlat.c
@cat $(REMINDSRCS) | grep 'tr(".*")' | sed -e 's/.*tr."/"/' -e 's/").*/"/' | LANG=C LC_ALL=C sort | uniq | grep -E -v '^"(am|at|from now|hour|minute|now|on|pm|today|tomorrow|was)"$$' | sed -e 's/^/ /' -e 's/$$/,/' >> xlat.c
@cat $(REMINDSRCS) | grep 'tr(".*")' | sed -e 's/.*tr."/"/' -e 's/").*/"/' | LANG=C LC_ALL=C sort | uniq | grep -E -v '^"(ago|am|and|at|from now|is|hour|minute|now|on|pm|today|tomorrow|was)"$$' | sed -e 's/^/ /' -e 's/$$/,/' >> xlat.c
@echo " NULL" >> xlat.c
@echo "};" >> xlat.c

View File

@@ -2529,7 +2529,7 @@ void WriteJSONTrigger(Trigger const *t, int include_tags)
}
}
static void WriteSimpleEntryProtocol2(CalEntry *e, int today)
static void WriteSimpleEntryProtocol2(CalEntry *e)
{
char const *s;
if (DoPrefixLineNo) {
@@ -2661,7 +2661,7 @@ static void WriteSimpleEntries(int col, int dse)
}
DidADay = 1;
printf("{\"date\":\"%04d-%02d-%02d\",", y, m+1, d);
WriteSimpleEntryProtocol2(e, dse);
WriteSimpleEntryProtocol2(e);
printf("}");
if (PsCal != PSCAL_LEVEL3) {
printf("\n");
@@ -2894,7 +2894,8 @@ char const *SimpleTime(int tim)
if (h == 0) hh=12;
else if (h > 12) hh=h-12;
else hh=h;
snprintf(buf, sizeof(buf), "%d%c%02d%.64s ", hh, TimeSep, min, (h>=12) ? tr("pm") : tr("am"));
snprintf(buf, sizeof(buf), "%d%c%02d%.64s ", hh, TimeSep, min, (h>=12) ? tr("pm") :
tr("am"));
}
break;

View File

@@ -98,7 +98,8 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig const *tt, int
mplu = (mdiff == 1 ? "" : DynamicMplu);
hplu = (hdiff == 1 ? "" : DynamicHplu);
when = (tdiff < 0) ? tr("ago") : tr("from now");
when = (tdiff < 0) ? tr("ago") :
tr("from now");
h = tim / 60;
min = tim % 60;
@@ -122,7 +123,8 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig const *tt, int
}
}
if (r != OK) {
pm = (h < 12) ? tr("am") : tr("pm");
pm = (h < 12) ? tr("am") :
tr("pm");
}
hh = (h == 12 || h == 0) ? 12 : h % 12;
@@ -149,7 +151,8 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig const *tt, int
}
}
if (r != OK) {
cpm = (h < 12) ? tr("am") : tr("pm");
cpm = (h < 12) ? tr("am") :
tr("pm");
}
chh = (ch == 0 || ch == 12) ? 12 : ch % 12;
@@ -373,7 +376,9 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig const *tt, int
case 'L':
case 'U':
case 'V':
snprintf(s, sizeof(s), "%s", (diff == 1 ? tr("tomorrow") : diff == -1 ? tr("yesterday") : tr("today")));
snprintf(s, sizeof(s), "%s", (diff == 1 ? tr("tomorrow") :
diff == -1 ? tr("yesterday") :
tr("today")));
SHIP_OUT(s);
done = 1;
break;
@@ -618,7 +623,8 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig const *tt, int
snprintf(s, sizeof(s), "%d %s%s %s", hdiff, tr("hour"), hplu, when);
else
snprintf(s, sizeof(s), "%d %s%s %s %d %s%s %s", hdiff, tr("hour"), hplu,
tr("and"), mdiff, tr("minute"), mplu, when);
tr("and"), mdiff,
tr("minute"), mplu, when);
SHIP_OUT(s);
break;
@@ -676,7 +682,8 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig const *tt, int
break;
case '!':
snprintf(s, sizeof(s), "%s", (tdiff >= 0 ? tr("is") : tr("was")));
snprintf(s, sizeof(s), "%s", (tdiff >= 0 ? tr("is") :
tr("was")));
SHIP_OUT(s);
break;

View File

@@ -25047,6 +25047,7 @@ TRANSLATE "here" ""
TRANSLATE "psmoon() is deprecated; use SPECIAL MOON instead." ""
TRANSLATE "psshade() is deprecated; use SPECIAL SHADE instead." ""
TRANSLATE "remaining call frames omitted" ""
TRANSLATE "yesterday" ""
+----------------------------------------------------------------------------+
| February 2024 |
+----------+----------+----------+----------+----------+----------+----------+