Closed u-fischer closed 3 years ago
1-2/ I'll fix it the next release (that's weird - it's like I accidentally deleted them, because I sure wrote it).
3/ “without having to force the loading of the ini file with \BabelEnsureInfo“.
It's something I've had a lot of doubts about. My logic was:
ini
files at all, so loading it is pointless (unlike xe/amd lua, which require the language system for fonts).\BabelEnsureInfo
.ini
file, without babel
.But I can reconsider it. As I said, I'm not clear on this.
Regaring 3: I didn't mean that the whole ini should be loaded (and for the same reason you don't want to load them, I don't want to force the loading in hyperref either). But imho it would be useful is at least the tag.bcp47
is always set.
The point is how 🙂. There must be some source, and the only other possibility I think of is by adding it in every ldf
. Or by creating a list in a single file (which, in turn, may require some maintenance, updaters and the like, which I dislike).
Imho in the long run, this should be a required setting in the ldf, but I'm not sure how exactly. Actually I don't even know exactly how ldf and ini relate. Who wins if they clash and are both loaded?
They never clash (so I hope 😉). Once loaded an ldf
, its behavior is either extended or modified by an ini
file.
I think we have different views about "fully expandable". \localeinfo expands fine if the info exists, but for some languages there is no ini and then it errors and this means I can't use it in an edef to test if the info is there. Currently I'm resorting to test an internal babel command but I would prefer a real interface. E.g. an \localeinfoEXP
which expands to -no-value-, or a test \iflocaleinfo{tag.bcp47}
\documentclass{article}
\usepackage[portuges]{babel}
\BabelEnsureInfo
\begin{document}
xx
%\edef\testlocale{\localeinfo{tag.bcp47}} %errors
%that works:
\ifcsname bbl@\csname bbl@info@tag.bcp47\endcsname @\languagename\endcsname
true\else false \fi
\end{document}
Every more or less official language name should have a babel-...tex
file, but there is none for portuges
(a somewhat absurd name coming form the age of 8-letter file names, which very likely should be deprecated).
I think we have different views about "fully expandable".
So it seems 🙂. Returning ??
would be an alternative, but I'm not sure this actually helps.
Every more or less official language name should have a babel-...tex file,
A few are missing. Beside portuges
I found acadian
, magyar
, brazil
,
Returning ?? would be an alternative, but I'm not sure this actually helps.
Returning ??
would be fine with me. It doesn't explode in an edef and is easily tested.
And it doesn't have to be done by \localeinfo if you want to keep it as it is, I'm fine with some other command.
Doesn't \getlocaleproperty*
work for you? It's aimed at cases like this, because the returned value if it doesn't exist is \relax
(without the star it raises an error). Not expandable, but I presume you can retrieve the value before.
I had excluded it, because I thought I need to know the name, but \getlocaleproperty*\test{\languagename}{identification/tag.bcp47}
seems to work. Thanks I will try with it.
I tried with \getlocaleproperty. But it is simply not stable enough. E.g this here errors
\documentclass{article}
\usepackage[english]{babel}
\AddBabelHook{test}{afterextras}{\getlocaleproperty*\mytest{\languagename}{identification/tag.bcp47}}
\begin{document}
bbb
\selectlanguage{ngerman}
bbbb
\end{document}
with
! Undefined control sequence.
\bbl@usehooks ...@}\ifx \languagename \@undefined
Overlapping elt's. Fixed.
According to the documentation
\localefinfo
is fully expandable. But actually it issues an error message if the ini has not been loaded and the info is not known. Could it instead call some expandable marker?The documentation names the fields
language.tag.bcp47
andtag.ini
but both seems not to work.Would it be possible to ensure that at least
language.tag.bcp47
andtag.bcp47
are always defined, without having to force the loading of the ini file with\BabelEnsureInfo
? That would make it easier for a package to add language support without having to worry about such loading details.