## 4.5 Internationalization

If the language of your book is not English, you will need to translate certain English words and phrases into your language, such as the words “Figure” and “Table” when figures/tables are automatically numbered in the HTML output. Internationalization may not be an issue for LaTeX output, since some LaTeX packages can automatically translate these terms into the local language, such as the ctexcap package for Chinese.

For non-LaTeX output, you can set the language field in the configuration file _bookdown.yml. Currently the default settings are:

language:
label:
fig: 'Figure '
tab: 'Table '
eq: 'Equation '
thm: 'Theorem '
lem: 'Lemma '
cor: 'Corollary '
prp: 'Proposition '
cnj: 'Conjecture '
def: 'Definition '
exm: 'Example '
exr: 'Exercise '
hyp: 'Hypothesis '
proof: 'Proof. '
remark: 'Remark. '
solution: 'Solution. '
ui:
edit: Edit
chapter_name: ''
appendix_name: ''

For example, if you want FIGURE x.x instead of Figure x.x, you can change fig to "FIGURE ":

language:
label:
fig: "FIGURE "

The fields under ui are used to specify some terms in the user interface. The edit field specifies the text associated with the edit link in _bookdown.yml (Section 4.4). The fields chapter_name, appendix_name, fig, tab and eq can be either a character string to be prepended to chapter (e.g., 'CHAPTER ') or reference number (e.g., 'FIGURE '), or an R function that takes a number (chapter or reference number) as the input and returns a string. (e.g., !expr function(i) paste('Chapter', i)). Here is an example for Hungarian:

language:
label:
fig: !expr function(i) paste(i, 'ábra')
ui:
chapter_name: !expr function(i) paste0(i, '. fejezet')

For chapter_name and appendix_name only, if it is a character vector of length 2, the chapter title prefix will be paste0(chapter_name[1], i, chapter_name[2]), where i is the chapter number.

There is one caveat when you write in a language that uses multibyte characters, such as Chinese, Japanese, and Korean (CJK): Pandoc cannot generate identifiers from section headings that are pure CJK characters, so you will not be able to cross-reference sections (they do not have labels), unless you manually assign identifiers to them by appending {#identifier} to the section heading, where identifier is an identifier of your choice.