# \vref uses wrong language in LyX as soon as I use two languages

I am using LyX fro writing a bi-lingual document, for wich I use the following custom package definition under "Settings -> Language":

\usepackage[english,ngerman]{babel}


As soon as I add the second language "english", resulting in "ngerman" being the default one and english for occasionally use, the \vref references are using "on page" rather than the German version "auf Seite".

Does anyone have an idea on how to fix that? I read that varioref needs the language to be set with the document class but I wasn't able to find a way to do that in LyX.

Thank you!

EDIT:

Here is an minimal example of the not working behaviour:

\lyxformat 474
\begin_document
\language ngerman
\language_package \usepackage[english,ngerman]{babel}

\begin_body

\begin_layout Section
A
\end_layout

\begin_layout Standard
Bitte vergleichen mit Kapitel
\begin_inset CommandInset ref
LatexCommand vref
reference "sec:B"
\end_inset
.
\end_layout

\begin_layout Standard
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
clearpage
\end_layout
\end_inset
\end_layout

\begin_layout Section
\begin_inset CommandInset label
LatexCommand label
name "sec:B"
\end_inset
B
\end_layout

\end_body
\end_document


This renders to

Bitte vergleichen mit Kapitel 2 on the following page.

but when you change line 5 to

\language_package default


it renders correctly to

Bitte vergleichen mit Kapitel 2 auf der nächsten Seite.

• Minimal example? Note that a .lyx file is just a text file so it is easy to copy/paste. Please read wiki.lyx.org/FAQ/MinimalExample – scottkosty Mar 21 '16 at 4:00
• Thank you for pointing that out. Great idea! I just added a minimal example. – Kie Mar 21 '16 at 4:21
• OK I gave a workaround. By the way, your .lyx file is strange and possibly corrupted. Did you by chance edit it directly with a text editor? Be very careful if you do that. – scottkosty Mar 21 '16 at 5:05
• Yes I did, I removed everything unnecessary, and it still opens perfectly well in my LyX without all the other boilerplate settings. :) I thought that was meant by minimal example. – Kie Mar 21 '16 at 5:07
• Ah makes sense. I appreciate the effort but it is best to do that inside of LyX. The best way is to create a new document and build it up, rather than stripping down a complicated document, but I understand your approach also. You do not get an error with 2.1.x, but if you open the file you posted here (unless you resave within LyX before reopening) in LyX 2.2.0, you will get errors because lyx2lyx will run and will be confused by your manual edits. You're playing with fire, which is fine---it is fun and useful to play with fire as long as you are aware of the consequences :) – scottkosty Mar 21 '16 at 5:17