latex2e icon indicating copy to clipboard operation
latex2e copied to clipboard

use \msg_module_name:n in ltkeys were appropriate

Open u-fischer opened this issue 2 years ago • 5 comments

Brief outline of the enhancement

Currently messages e.g. about a load time option that is ignored use directly the family name. It would be nice if they would use \msg_module_name:n to allow to translate internal module prefixes.

Minimal example showing the current behaviour

\begin{filecontents}[overwrite]{testnewkeys.sty}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{testnewkeys}[%
    2022/06/14
    v1
    test new key]
\ExplSyntaxOn    
\prop_gput:Nnn \g_msg_module_name_prop { mypkg }{ testnewkeys }
%\msg_set:nnn
%  { keys } { load-option-ignored }
%  { Package~"\msg_module_name:n{#1}"~has~already~been~loaded:~ignoring~load-time~option~"#2".}

\DeclareKeys[mypkg]
 {
  ,testload    .tl_set:N   = \testload
  ,testload    .usage:n    = load
 }
\ExplSyntaxOff 
\ProcessKeyOptions[mypkg]
\endinput
\end{filecontents}

\documentclass{article}
\usepackage[testload=a]{testnewkeys}
\usepackage[testload=b]{testnewkeys}

\begin{document}
abc
\end{document}

gives

LaTeX3 Warning: Package "mypkg" has already been loaded: ignoring load-time
(LaTeX3)        option "testload".

If one uncomment the msg definition one get the wanted

LaTeX3 Warning: Package "testnewkeys" has already been loaded: ignoring
(LaTeX3)        load-time option "testload".

u-fischer avatar Jul 07 '22 13:07 u-fischer

This is controlled at the expl3 end

josephwright avatar Jul 07 '22 13:07 josephwright

No this special message is in ltkeys.dtx:

\msg_new:nnn { keys } { load-option-ignored }
  { Package~"#1"~has~already~been~loaded:~ignoring~load-time~option~"#2". }

u-fischer avatar Jul 07 '22 13:07 u-fischer

I've bounced it back :)

josephwright avatar Jul 07 '22 13:07 josephwright

@u-fischer It's an easy fix: I guess if we see PL6 on the horizon I could do there ...

josephwright avatar Jul 07 '22 13:07 josephwright

yes, fine (the message load-only should be adapted too).

u-fischer avatar Jul 07 '22 13:07 u-fischer