# Make hyperref's \autoref output in Bulgarian

I'm trying to use hyperref for references, but by default it outputs them in English like "chapter 2". According to Hyperref ignores \setdefaultlanguage from polyglossia, doing

\usepackage[bulgarian]{hyperref}


Should do the trick, but this gives me a cryptic error:

! Package xkeyval Error: bulgarian' undefined in families Hyp'.

See the xkeyval package documentation for explanation.
Type  H <return>  for immediate help.
...

l.4319 \ProcessKeyvalOptions{Hyp}


Note that it works for german. Here is my styling:

\ProvidesPackage{style}

\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{DejaVu Serif}
\setsansfont[Ligatures=TeX]{DejaVu Sans}
\setmonofont[Ligatures=TeX]{DejaVu Sans Mono}
% \newfontfamily{\TelSubstFont}[Ligatures=TeX]{Cantarell}

\usepackage{polyglossia}
\setmainlanguage{bulgarian}
\setdefaultlanguage{bulgarian}

\usepackage{minted}

\usepackage[bulgarian]{hyperref}
\hypersetup{pdflang=bg}

\usepackage[numbers]{natbib}


P.S. I'm still new to LaTeX, using XeLaTeX to compile the document.

-

Since Bulgarian is not yet supported, you can convince it to cooperate with hyperref by defining the needed keywords yourself:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{FreeSerif}

\usepackage{polyglossia}
\setmainlanguage{bulgarian}
\setotherlanguage{english}

\usepackage{hyperref}

\makeatletter
\ifdefined\HyLang@bulgarian\else
\appto\blockextras@bulgarian{%
\def\equationautorefname{Equation}%
\def\footnoteautorefname{footnote}%
\def\itemautorefname{item}%
\def\figureautorefname{Figure}%
\def\tableautorefname{Таблица}%
\def\partautorefname{Part}%
\def\appendixautorefname{Appendix}%
\def\chapterautorefname{chapter}%
\def\sectionautorefname{section}%
\def\subsectionautorefname{subsection}%
\def\subsubsectionautorefname{subsubsection}%
\def\paragraphautorefname{paragraph}%
\def\subparagraphautorefname{subparagraph}%
\def\FancyVerbLineautorefname{line}%
\def\theoremautorefname{Theorem}%
\def\pageautorefname{page}%
}
% \inlineextras@bulgarian is empty, so we simply set it
% equal to \blockextras@bulgarian
\let\inlineextras@bulgarian\blockextras@bulgarian
\fi
\makeatother

\begin{document}
\begin{table}
\caption{A table}\label{A}
\end{table}
\autoref{A}

\end{document}


Here I have modified from the English keywords only the one corresponding to "Table". A picture of the result:

The \ifdefined...\fi wrapper means that when hyperref will have the support for Bulgarian, the part in between will not be read any more.

-

The Bulgarian language is not yet supported in package hyperref, because I, as maintainer of hyperref, am not familiar with that language and nobody has sent me the Bulgarian names for the \autoref names. If someone can send me the Bulgarian translations, then I can add them to hyperref. The definitions of \HyLang@english and/or \HyLang@russian could be used as starting point for the translation. I prefer the LaTeX names for the Cyrillic glyphs as in \HyLang@russian, because hyperref should work with many input encodings and TeX compilers. UTF-8 should also be fine, then I can try the conversion myself.

The \autoref names can also be redefined:

\renewcommand*{\sectionautorefname}{New section name}


See the manual of hyperref that also contains an example with the babel language package.

## Bulgarian names

With the help of Google Translate, the comparison of lshort-english with lshort-bulgarian, and gloss-bulgarian.ldf of polyglossia I managed the following table. (The font setting is taken from egreg's file):

\documentclass{article}
\usepackage{fontspec}
\setmainfont{FreeSerif}

\usepackage{polyglossia}
\setmainlanguage{bulgarian}
\setotherlanguage{english}

\begin{document}
\centering
\begin{tabular}{lll}
EN & BG/UTF-8 & source \\
\hline
Equation & уравнение \\
footnote & бележка под линия /  забележка под линия & / lshort \\
item & точка \\
Figure & Фигура / фигура & lshort\\
Table & Таблица / таблица & lshort \\
Part & част \\
Appendix & апендикс / Приложение & / polyglossia \\
chapter & глава & lshort \\
section & Раздел / раздел & lshort \\
subsection & подраздел\\
subsubsection & подраздел / подподраздел ? \\
paragraph & параграф \\
subparagraph & подпараграф ? \\
line & редица \\
Theorem & теорема \\
page & страница / стp.  & lshort\\
\end{tabular}
\end{document}


Of course, there is plenty room for corrections:

• Which names should have the first character as uppercase letter. What are the conventions in the Bulgarian language, if things like chapters, figures, pages, ... are referenced?

• Are the translations correct, which is the best variant?

• What about subsection, subsubsection, and subparagraph?

-
I would like to help and provide translations, the problem is that I'm not very good with TeX (I'm a developer, though). Contact me at: emil dot vladev at gmail if interested. I'll most likely succeed if you send me a template(s) in English, along with some explanations what to translate and I will send it back to you translated (in UTF8 of course, I didn't get the glyphs part, something LaTeX specific?). –  Emil Ivanov Jan 19 '13 at 20:44
Which names should have the first character as uppercase letter. What are the conventions in the Bulgarian language, if things like chapters, figures, pages, ... are referenced? - Unless it's the start of a new sentence, it's lowercase. Are the translations correct, which is the best variant? - Yes, actually. Some are better, though - footnote is better as "бележка под линия", appendix as "приложение", subsubsection just doesn't sound well in Bulgarian, it's better to be the same as subsection ("подраздел"). Same for subparagraph. –  Emil Ivanov Jan 20 '13 at 9:47
Line, if it's in case of a line in a law, the word is "алинеа". "редица" is more like row. I would need an example in English for that. Page is ok to be shortened as "стр.". Subsection is ok and correct. –  Emil Ivanov Jan 20 '13 at 9:51