latex3 / babel

The multilingual framework to localize LaTeX, LuaLaTeX and XeLaTeX
https://latex3.github.io/babel/
LaTeX Project Public License v1.3c
130 stars 35 forks source link

Incomplete reverse-BCP47 #79

Closed viktoriasee closed 4 years ago

viktoriasee commented 4 years ago

There are cases where you wish to query the locale that is actually used.

MWE

\documentclass{article}
\usepackage[nswissgerman]{babel}
\BabelEnsureInfo

\begin{document}

\makeatletter
    \getlocaleproperty\mainlang
        {\bbl@main@language}
        {identification/tag.bcp47}
\makeatother

\typeout{THE MAIN LANGUAGE IS "\mainlang"}

Lorem ipsum.

\end{document}

This outputs «de». Tested under MikTeX and TexLife, XeTeX, LuaHBTeX and pdfTeX. It's not specific to Swiss German it happens to other languages as well.

Expected behaviour

Output should be «de-CH» or even «de-CH-1996» for the 1996 spelling reform.

jbezos commented 4 years ago

I assigned the <language type=".."> in the CLDR to tag.bcp47, which is clearly misleading. The locale actually loaded should be in tag.ini, but it seems it's not loaded correctly. I'll fix both issues.

jbezos commented 4 years ago

Fixed in 3.46. Now tag.bcp47 contains what it's name promises.