Make hyperref's \autoref output in Bulgarian

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}

Result

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?


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:

enter image description here

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