Ho studiato meglio la faccenda.
Lasciando perdere gli argomenti opzionali, sono riuscito a trovare una possibile soluzione. L’ora comincia a farsi tarda, quindi potrei aver preso un abbaglio. In sostanza, oltre a usare [tt]\string\monthname…[/tt], faccio un po’ di patching. I comandi [tt]\monthname…[/tt] hanno la stessa struttura per tutte le lingue, quindi le patch dovrebbero applicarsi a tutte con una certa tranquillità.
`\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french,italian,spanish,english]{babel}
\usepackage{lipsum,textcase}
\title{Nomi dei mesi in maiuscolo}
\author{}
\usepackage{datetime}
\usepackage{etoolbox}
\makeatletter
\newcommand*\patchmonthname[1]{%
\if@dt@multilingual
\begingroup
\expandafter\ifx\csname monthname\languagename\endcsname\relax
\typeout{No original \string\monthname\languagename}%
\endgroup
\else
\expandafter\ifx\csname p@monthname\languagename\endcsname\relax
\endgroup
\typeout{Patching \string\monthname\languagename}%
\@patchmonthname
\typeout{Patched \string\monthname\languagename}%
\else
\typeout{Already patched \string\monthname\languagename}%
\endgroup
\fi
\fi
\fi}
\def\@patchmonthname{%
% Uso \x per fare prima a scrivere
\expandafter\let\expandafter\x\csname\string\monthname\languagename\endcsname
\@@patchmonthname
\expandafter\let\csname p@monthname\languagename\endcsname\x}
\begingroup
\@makeother\#%
\gdef\@@patchmonthname{%
% Senza bisogno di generare errore se il patching fallisce:
% se il problema esiste si ripresenterà durante l'espansione
\patchcmd\x{\the\@orgargctr}{#1}\relax\relax
\patchcmd\x{\the\@orgargctr}{#1}\relax\relax
\patchcmd\x{\@orgargctr=#1\relax}{}\relax\relax
\patchcmd\x{\@orgargctr}{#1\relax}\relax\relax}
\endgroup
\newcommand*\Monthname[1]{%
\edef\xx{\noexpand\MakeTextUppercase
% Dovrei generare un errore se non è definito?
\csname p@monthname\languagename\endcsname[#1]}\xx
}
\patchmonthname{english}
\let\p@monthnameenglish\x
\apptocmd\select@language{\patchmonthname{#1}}{}{\errmessage{failure}}
\makeatother
\begin{document}
\maketitle
\section{È possibile?}
\Monthname{\month} 2012. \lipsum[2]
\begin{otherlanguage}{french}
\Monthname{\month} 2012. \lipsum[2]
\end{otherlanguage}
\begin{otherlanguage}{italian}
\Monthname{\month} 2012. \lipsum[2]
\end{otherlanguage}
\begin{otherlanguage}{spanish}
\Monthname{\month} 2012. \lipsum[2]
\end{otherlanguage}
\begin{otherlanguage}{french}
\Monthname{\month} 2012. \lipsum[2]
\end{otherlanguage}
\begin{otherlanguage}{italian}
\Monthname{\month} 2012. \lipsum[2]
\end{otherlanguage}
\begin{otherlanguage}{spanish}
\Monthname{\month} 2012. \lipsum[2]
\end{otherlanguage}
\end{document}`
Ripeto, può essere che il codice sia un po’ una schifezza, devo ragionarci meglio. Inoltre ha qualche problema, per esempio se l’inglese non è la lingua predefinita (cioè l’ultima caricata in babel). Comunque può essere una base.
Domani si vedrà! 🙂
Antonio
PS: mi sembrava che qualcuno si stesse divertendo coi link del forum… finalmente sono in blu! 😎 😉