Skip to content

Consistent handling of i18n translations for Figure, Section, etc #6581

@mewmew

Description

@mewmew

This issue tracks how to get consistent handling of i18n translations for Figure, Section, Bibliography, etc. by relying on existing translations used for LaTeX and cleveref.

Based on comments from:

From @laurmaedje:

This makes me think that we should probably have done that from the start. Just researching the LaTeX name data once and supporting all the languages they support immediately instead of having the terms decided by contributors one by one. I think that came up once in the past, but nobody ever followed up on it...

Thanks! While we should research the LaTeX data more, no need to further wait with this PR.

For reference, the following LaTeX source was used to ensure that the same Swedish translations are used for Typst as those used by LaTeX and cleveref. It can be adapted for other languages.

\documentclass[12pt,a4paper,swedish]{article}

\usepackage{graphicx}
\usepackage{listings}

\usepackage[swedish]{cleveref}

\usepackage[swedish]{babel}

\begin{filecontents}{foo.bib}
@phdthesis{typst_phd,
	title={A Programmable Markup Language for Typesetting},
	author={M{\"a}dje, Laurenz},
	year={2022},
	school={Technical University of Berlin}
}
\end{filecontents}

\begin{document}

\tableofcontents

\section{foo}
\label{sec:foo}

Se \cref{fig:foo}.

Se \cref{tab:bar}.

Se \cref{eq:baz}.

Se \cref{sec:foo}.

Se \cref{lst:foobar}.

Se \cite{typst_phd}.

\begin{figure}[htbp]
	\centering
	\includegraphics[width=0.5\textwidth]{example-image-a}
	\caption{foo}
	\label{fig:foo}
\end{figure}

\begin{table}[htbp]
	\caption{bar}
	\label{tab:bar}
	\begin{tabular}{ccc}
	foo & bar & baz \\
	\end{tabular}
\end{table}

\begin{equation}
	x = y^2
	\label{eq:baz}
\end{equation}

\begin{lstlisting}[language=C, caption={foobar\label{lst:foobar}}]
printf("hello world");
\end{lstlisting}

\bibliography{foo.bib}
\bibliographystyle{ieeetr}

\end{document}

Metadata

Metadata

Assignees

No one assigned

    Labels

    change requestA proposal for changes to an existing featuretextRelated to the text category, which is all about text handling, shaping, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions