0

I am creating a babel .ini file for my language, and I want to create an accompanying document that lists all strings defined in the said file. For captions, I can do this by calling \[key]name (e.g., \prefacename).

\NewDocumentCommand{\keyitem}{m}{%
    \item[#1] \expandafter\csname#1name\endcsname\relax%
}

\begin{description}
    \keyitem{preface}
    % More strings
\end{description}

Is there a way I can do this for date.gregorian? I would like to be able to print the wide, abbreviated, and narrow strings. I have tried \monthiname, etc. but I get an "Undefined control sequence" error message.

1 Answer 1

1

You can retrieve them with \getlocaleproperty. For example and with an existing locale:

\documentclass{article}

\usepackage[spanish, provide=*]{babel}

\begin{document}

\getlocaleproperty{\result}{spanish}{date.gregorian/days.abbreviated.mon}
\result

\getlocaleproperty{\result}{spanish}{date.gregorian/days.abbreviated.tue}
\result

\end{document}

will print:

lun
mar

The first argument is set to the value of the key in the last argument (the section and the key are separated with /).

1
  • Thank you for this! I'd like to add that the captions must be loaded via provide=* package option or \babelprovide. Commented Nov 21, 2023 at 13:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .