# lualatex error with Brazilian Portuguese babel option

It seems that lualatex does not known the Brazilian dialect of the Portuguese language with the babel package.

When compiling the simple document:

\documentclass{article}
\usepackage[brazil]{babel}

\begin{document}

Documento de teste.

\end{document}


lualatex gives the following error message:

! LuaTeX error ...re/texmf-dist/tex/luatex/hyph-utf8/luatex-hyphen.lua:50: luat
ex-hyphen: no entry in language.dat.lua for this language: brazil
stack traceback:
[C]: in function 'error'
...re/texmf-dist/tex/luatex/hyph-utf8/luatex-hyphen.lua:22: in function 'err'
anguage'
<\directlua >:1: in main chunk.
\bbl@patterns ...pestring {#1}", \the \language )}
\fi \fi \fi
l.165 \ldf@finish\CurrentOption


Is this a known bug? Is there any fix for it?

• Interesting. I made an attempt with \usepackage[portuges,brazilian]{babel} and \selectlanguage{brazilian}, and the error is gone. Just don't ask me why, it was purely trial and error. :) I'm also intrigued with this question. – Paulo Cereda Mar 11 '12 at 13:43
• This does seem to be a bug; there should be a synonym set for brazil in the hyphenation pattern database (since there is only on Portuguese hyphenation file). The reason Paulo's solution works is that loading portuges is sufficient to load the hyphenation patterns; loading babel with brazil as the last language sets it as the main language (so no \selectlanguage is needed.) – Alan Munn Mar 11 '12 at 14:20
• The same bug will affect Austrian users, since there's no synonim set for german and ngerman, while babel allows the options austrian and naustrian. – egreg Mar 11 '12 at 16:49

Khaled Honsy wrote a patch and I submitted a new version of hyph-utf8 to CTAN, so it should end up in TeX Live pretty soon.

If anyone wants to test, try replacing texmf-dist/tex/luatex/hyph-utf8/hyphen.cfg and texmf-dist/tex/luatex/hyph-utf8/luatex-hyphen.lua in your distribution and running

sudo fmtutil-sys --byfmt lualatex


or simply fmtutil --byfmt lualatex. In MikTeX you can rebuild formats somewhere in GUI.

The only language synonyms influenced by the change are currently:

canadian               => english
australian, newzealand => british
austrian               => german
naustrian              => ngerman
brazilian, brazil      => portuguese


Claudio Beccari found out that many synonyms fail to work in Polyglossia as well. We might change the way synonyms are treated in future, but this should hopefully get the problem fixed for now.

• 'hungarian' also needs synonym 'magyar'. – marczellm Nov 27 '14 at 13:50

A quick workaround is to locate language.dat.lua on your computer (watch out, there might be two of them, you need the one in TEXMFVAR if you are using TeX Live; mine is at /usr/local/texlive/2011/texmf-var/tex/generic/config/language.dat.lua) and change the synonyms for portuguese to

synonyms = { 'portuges', 'brazil', 'brazilian' },


For a proper fix I'll talk to the author of luatex-specific code for loading hyphenation patterns (Manuel). If he or somebody else can provide a fix quickly, we'll apply it, else I will do a temporary workaround in TeX Live and add the two extra synonyms to hyphen-portuguese.tlpsrc. How serious is the issue with Austrian - do people actually use \usepackage[austrian]{babel}?

• I guess so: there are notable differences between the austrian and german options. – egreg Mar 11 '12 at 20:21