Is there an option which changes default title of table of contents in Org mode?
My document is not in English so I want to translate table of content's title.
Answer
As JeanPierre said, It's about export settings. You can set LANGUAGE
at the top of your org
document this way:
#+LANGUAGE: fr
And French will be used as default language of all strings that org
produces during export.
The constant responsible for translation mappings is org-export-dictionary
in ox.el
and if your language is not supported you can drop it there and then eval-defun
to let change take place. In my case:
(defconst org-export-dictionary
...
("Table of Contents"
...
("sr" :html "Sadržaj" :utf-8 "Sadržaj")
...)
...)
I've wrote a naive function which can be useful in init.el
:
(defun org-export-translate-to-lang (term-translations &optional lang)
"Adds desired translations to `org-export-dictionary'.
TERM-TRANSLATIONS is alist consisted of term you want to translate
and its corresponding translation, first as :default then as :html and
:utf-8. LANG is language you want to translate to."
(dolist (term-translation term-translations)
(let* ((term (car term-translation))
(translation-default (nth 1 term-translation))
(translation-html (nth 2 term-translation))
(translation-utf-8 (nth 3 term-translation))
(term-list (assoc term org-export-dictionary))
(term-langs (cdr term-list)))
(setcdr term-list (append term-langs
(list
(list lang
:default translation-default
:html translation-html
:utf-8 translation-utf-8)))))))
(org-export-translate-to-lang '(("Table of Contents"
"Sadržaj"
"Sadržaj"
"Sadržaj")
("Another term"
"coilogji"))
"sr")
Disclaimer
It doesn't work if you want to export via Latex (Latex is used when Org exports to PDF). Look at Tyler's answer and comments.