josephwright / siunitx

A comprehensive (SI) units package for LaTeX
LaTeX Project Public License v1.3c
350 stars 25 forks source link

English text in Swiss German ranges #712

Closed robinschwab closed 5 months ago

robinschwab commented 5 months ago

When I print a number range in a document with nswissgerman as the language option for babel then I get a strange English output: «2 °C to (numerical range) 10 °C»

\documentclass{article}
\usepackage[nswissgerman]{babel}
\usepackage{translations}
\usepackage{siunitx}
%\sisetup{range-phrase=~bis~} %work around

\begin{document}
\qtyrange{2}{10}{\celsius}
\end{document}

This does not happen when I use german as the language option. I get «2 °C bis 10 °C» instead.

Expected behaviour: Same output with nswissgerman as with german.

josephwright commented 5 months ago

This is not an siunitx issue: rather, translator doesn't seem to be picking up the correct relationship between Swiss German and German (for which there is a translation of to (numerical range)). Please report at https://github.com/cgnieder/translations/issues. A demo:

\documentclass{article}
\usepackage[english,nswissgerman,german]{babel}
\usepackage{translations}
\DeclareTranslation{English}{to (numerical range)}{to}
\DeclareTranslation{German}{to (numerical range)}{to}
\begin{document}
\selectlanguage{english}
\GetTranslation{to (numerical range)}
\selectlanguage{nswissgerman}
\GetTranslation{to (numerical range)}
\selectlanguage{german}
\GetTranslation{to (numerical range)}
\end{document}
robinschwab commented 5 months ago

I opened an issue at translations.

In the meantime a more elegant workaround is to use \DeclareLanguageAlias{nswissgerman}{swissgerman} instead of my proposed \sisetup{range-phrase=~bis~}.