3

I am using the pgfgantt package in a project that is supposed to be written in Swedish and I'm having trouble changing the names of months. I found this and tried using \usepackage[swedish]{translator} before \usepackage{pgfgantt}but the language is still in English.

I am using Sharelatex with the PdfLaTeX compiler.

HankyP
  • 33
  • 1
    Welcome to TeX.SE. Please, always add an MWE, showing, what you have already tried. It helps us to help you. – Jan Jan 31 '17 at 09:06

1 Answers1

3

translator is not enough, you also need to load babel. Language name can be introduced as a documentclass option and it will be applied to both babel and translator.

Note: As I don't have Swedish translator dictionary, the example uses Spanish.

\documentclass[spanish]{article}
\usepackage{babel}
\usepackage{translator}
\usepackage{pgfgantt}

\begin{document}
\begin{ganttchart}[
hgrid,
vgrid,
x unit=18mm,
time slot format=little-endian
]{7.1.2013}{13.1.2013}
\gantttitlecalendar*{7.1.2013}{13.1.2013}{
month, month=name, month=shortname, weekday,
weekday=name, weekday=shortname
}
\end{ganttchart}
\end{document}

enter image description here

Update:

As it seems that Swedish dictionaries doesn't officially exist for translator, you will have to provide corresponding translations in your source file:

\documentclass[Swedish]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{translator}
\usepackage{pgfgantt}

\uselanguage{Swedish}
\languagepath{Swedish}
\providetranslation[to=Swedish]{January}{Januari}
\providetranslation[to=Swedish]{Monday}{Måndag}
%---- Complete with missing months and days

\begin{document}
\begin{ganttchart}[
hgrid,
vgrid,
x unit=18mm,
time slot format=little-endian
]{7.1.2013}{13.1.2013}
\gantttitlecalendar*{7.1.2013}{13.1.2013}{
month, month=name, month=shortname, weekday,
weekday=name, weekday=shortname
}
\end{ganttchart}
\end{document}

enter image description here

Ignasi
  • 136,588