diff --git a/AGENTS.md b/AGENTS.md index a93f7b61..14d91338 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -46,7 +46,9 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt title (`dtsystemsettings.msg`, 32 messages); it calls `setlocale` before its first message, because the window title is already an argument of `XtVaAppInitialize` and a catalog opened then would stay the C one - (measured 2026-11-16). A new catalog must be added to + (measured 2026-11-16). dtlaunch (`dtlaunch.msg`, 3 messages) has no + libDtSvc to link, so it calls `catopen`/`catgets` itself and its + Makefile passes `CDE_INSTALLATION_TOP`. A new catalog must be added to `programs/localized/templates/msg.C.am` for C and to the PLIST (C plain, a locale with `${PLIST.nls}`). diff --git a/pkgsrc/PLIST b/pkgsrc/PLIST index af535f34..fc9f2f65 100644 --- a/pkgsrc/PLIST +++ b/pkgsrc/PLIST @@ -2776,6 +2776,7 @@ dt/lib/nls/msg/C/dticon.cat dt/lib/nls/msg/C/dtimsstart.cat dt/lib/nls/msg/C/dtinfo.cat dt/lib/nls/msg/C/dtinfo_start.cat +dt/lib/nls/msg/C/dtlaunch.cat dt/lib/nls/msg/C/dtlogin.cat dt/lib/nls/msg/C/dtlp.cat dt/lib/nls/msg/C/dtmailopts.cat @@ -7508,6 +7509,7 @@ ${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dticon.cat ${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtimsstart.cat ${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtinfo.cat ${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtinfo_start.cat +${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtlaunch.cat ${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtlogin.cat ${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtlp.cat ${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtmailopts.cat diff --git a/programs/dtlaunch/Makefile.am b/programs/dtlaunch/Makefile.am index b12df904..8bd7886b 100644 --- a/programs/dtlaunch/Makefile.am +++ b/programs/dtlaunch/Makefile.am @@ -5,7 +5,7 @@ MAINTAINERCLEANFILES = Makefile.in bin_PROGRAMS = dtlaunch dtlaunch_SOURCES = dtlaunch.c model.c model.h -dtlaunch_CPPFLAGS = $(XFIXES_CPPFLAGS) +dtlaunch_CPPFLAGS = $(XFIXES_CPPFLAGS) -DCDE_INSTALLATION_TOP=\"$(CDE_INSTALLATION_TOP)\" dtlaunch_LDADD = $(XFIXESLIB) $(XTOOLLIB) -lm check_PROGRAMS = test_model diff --git a/programs/dtlaunch/dtlaunch.c b/programs/dtlaunch/dtlaunch.c index 687d2512..d587a307 100644 --- a/programs/dtlaunch/dtlaunch.c +++ b/programs/dtlaunch/dtlaunch.c @@ -46,6 +46,7 @@ #include #include +#include #include #include #include @@ -688,6 +689,25 @@ parental_log(const char *program) fclose(f); } +/* dtlaunch's message catalog (programs/dtlaunch/dtlaunch.msg, the locale's + * copy in programs/localized//msg, installed under lib/nls/msg) */ +static nl_catd cat = (nl_catd) -1; + +static const char * +Tr(int n, const char *text) +{ + if (cat == (nl_catd) -1) { + if (getenv("NLSPATH") == NULL) + (void) setenv("NLSPATH", CDE_INSTALLATION_TOP + "/lib/nls/msg/%L/%N.cat:" CDE_INSTALLATION_TOP + "/lib/nls/msg/C/%N.cat", 0); + cat = catopen("dtlaunch", NL_CAT_LOCALE); + } + if (cat == (nl_catd) -1) + return text; + return catgets(cat, 1, n, text); +} + static void hint_text(const char *text) { @@ -705,11 +725,11 @@ run_args(const char *program, char *const argv[]) pid_t pid; if (!parental_in_hours()) { - hint_text("Outside the allowed hours (Parental Controls)."); + hint_text(Tr(2, "Outside the allowed hours (Parental Controls).")); return 0; } if (!ParentalAllowed(program)) { - hint_text("This program is not allowed (Parental Controls)."); + hint_text(Tr(3, "This program is not allowed (Parental Controls).")); return 0; } parental_log(program); @@ -1010,8 +1030,8 @@ main(int argc, char **argv) if (L.keep_history && !watch_clipboard()) (void)XtAppAddTimeOut(L.app, POLL_MS, poll_clipboard, NULL); if (!L.keep_history) { - XmString none = XmStringCreateLocalized((char *)"Type to find a " - "program, a setting, a snippet, or =1+2"); + XmString none = XmStringCreateLocalized((char *)Tr(1, + "Type to find a program, a setting, a snippet, or =1+2")); XtVaSetValues(L.hint, XmNlabelString, none, NULL); XmStringFree(none); diff --git a/programs/dtlaunch/dtlaunch.msg b/programs/dtlaunch/dtlaunch.msg new file mode 100644 index 00000000..cbb65e8a --- /dev/null +++ b/programs/dtlaunch/dtlaunch.msg @@ -0,0 +1,7 @@ +$ MCDE dtlaunch message catalog (set 1) -- English is the source; a locale's copy lives in programs/localized//msg/dtlaunch.msg. +$ +$set 1 + +1 Type to find a program, a setting, a snippet, or =1+2 +2 Outside the allowed hours (Parental Controls). +3 This program is not allowed (Parental Controls). diff --git a/programs/localized/de_DE.UTF-8/msg/dtlaunch.msg b/programs/localized/de_DE.UTF-8/msg/dtlaunch.msg new file mode 100644 index 00000000..96f91599 --- /dev/null +++ b/programs/localized/de_DE.UTF-8/msg/dtlaunch.msg @@ -0,0 +1,7 @@ +$ MCDE dtlaunch message catalog, German. +$ +$set 1 + +1 Tippen: ein Programm, eine Einstellung, einen Schnipsel oder =1+2 +2 Außerhalb der erlaubten Zeiten (Kindersicherung). +3 Dieses Programm ist nicht erlaubt (Kindersicherung). diff --git a/programs/localized/templates/msg.C.am b/programs/localized/templates/msg.C.am index a1cc08f2..993f1b1f 100644 --- a/programs/localized/templates/msg.C.am +++ b/programs/localized/templates/msg.C.am @@ -5,7 +5,7 @@ BUILT_SOURCES = Xm.cat Mrm.cat Uil.cat DtHelp.cat DtMail.cat \ DtPrint.cat DtWidget.cat MotifApp.cat SUNW_TOOLTALK.cat dt.cat \ dtact.cat dtbuilder.cat dtcalc.cat dtcm.cat dtcodegen.cat \ - dtbar.cat dtconfig.cat dtsystemsettings.cat dtcopy.cat dtcreate.cat dtfile.cat dthello.cat \ + dtbar.cat dtconfig.cat dtlaunch.cat dtsystemsettings.cat dtcopy.cat dtcreate.cat dtfile.cat dthello.cat \ dthelpgen.cat dthelpprint.cat dticon.cat dtimsstart.cat \ dtlogin.cat dtlp.cat dtmailopts.cat dtpad.cat \ dtpdm.cat dtpdmd.cat dtprintinfo.cat dtscreen.cat dtsearch.cat \ @@ -117,6 +117,10 @@ dtsystemsettings.cat: $(TOP)/dtsystemsettings/dtsystemsettings.msg $(RM) $@ LANG=C $(GENCAT) $@ $^ || $(RM) $@ +dtlaunch.cat: $(TOP)/dtlaunch/dtlaunch.msg + $(RM) $@ + LANG=C $(GENCAT) $@ $^ || $(RM) $@ + dtfile.cat: $(TOP)/dtfile/dtfile.msg $(RM) $@ LANG=C $(GENCAT) $@ $^ || $(RM) $@