3

I see the quastion How to translate tikz calendar names? and I try to make farsi calendar wti this code:

\documentclass{standalone}

\usepackage[farsi]{babel}
\usepackage[farsi]{translator}

\usepackage{tikz}
\usetikzlibrary{calendar}

\begin{document}

\sffamily\scriptsize
\tikz
  \calendar [dates=2000-01-01 to 2000-12-31,
    month list,month label left,month yshift=1.25em]
    if (Sunday) [black!50];

\end{document}

like that quastion but it shows me below error: ! LaTeX Error: Encoding scheme LAE' unknown. ! LaTeX Error: Command \alefhamza unavailable in encoding OT1. ! LaTeX Error: Unknown optionfarsi' for package translator'. ! LaTeX Error: Font familyLAE+cmss' unknown.

what can I do ? tanks

2 Answers2

3

I don't know Farsi, but one of my languages is not supported out-of-the-box by the translator package. It's a shame calendar can't use Babel directly, since the language definition files include month names and are available for a wider variety of languages. But it is not difficult to cook-up your own.

You need to find translator-months-dictionary-English.dict and copy it into your working directory as translator-months-dictionary-Farsi.dict. On Linux, for Welsh, you could use

cp $(kpsewhich translator-months-dictionary-English.dict) ./translator-months-dictionary-Welsh.dict

Just use whatever method you usually use to find, copy and rename files. The .dict file is part of the translator now and this is no longer part of Beamer, but a standalone package.

Open the renamed file in your text editor and replace the Welsh words and abbreviations with Farsi translations of the English. Change the word Welsh at the top to Farsi.

\ProvidesDictionary{translator-months-dictionary}{Welsh}

\providetranslation{January}{Ionawr} \providetranslation{February}{Chwefror} \providetranslation{March}{Mawrth} \providetranslation{April}{Ebrill} \providetranslation{May}{Mai} \providetranslation{June}{Mehefin} \providetranslation{July}{Gorffennaf} \providetranslation{August}{Awst} \providetranslation{September}{Medi} \providetranslation{October}{Hydref} \providetranslation{November}{Tachwedd} \providetranslation{December}{Rhagfyr}

\providetranslation{Jan}{Ion} \providetranslation{Feb}{Chwe} \providetranslation{Mar}{Maw} \providetranslation{Apr}{Ebr} \providetranslation{May}{Mai} \providetranslation{Jun}{Meh} \providetranslation{Jul}{Gorff} \providetranslation{Aug}{Awst} \providetranslation{Sep}{Medi} \providetranslation{Oct}{Hyd} \providetranslation{Nov}{Tach} \providetranslation{Dec}{Rhag}

\providetranslation{Monday}{Llun} \providetranslation{Tuesday}{Mawrth} \providetranslation{Wednesday}{Mercher} \providetranslation{Thursday}{Iau} \providetranslation{Friday}{Gwener} \providetranslation{Saturday}{Sadwrn} \providetranslation{Sunday}{Sul}

\providetranslation{Mon}{Llun} \providetranslation{Tue}{Maw} \providetranslation{Wed}{Mer} \providetranslation{Thu}{Iau} \providetranslation{Fri}{Gwe} \providetranslation{Sat}{Sad} \providetranslation{Sun}{Sul}

That is, the bits which aren't English should be Farsi and the word Welsh, which is English, should be Farsi.

I then used

\documentclass[welsh]{standalone}
\usepackage{babel}
\usepackage{translator}

\usepackage{tikz} \usetikzlibrary{calendar}

\begin{document}

\sffamily\scriptsize \tikz \calendar [dates=2000-01-01 to 2000-12-31, month list,month label left,month yshift=1.25em] if (Sunday) [black!50];

\end{document}

with the result

Welsh calendar

cfr
  • 198,882
0

You can use the month text=\ifcase\the\numexpr\pgfcalendarcurrentmonth-1 translationofJan\or translationofFeb ...\or translationofDec\fi in the calendar option lists.

dax
  • 91