This led to errors when compiling with polyglossia (and non-TeX fonts).
A minimal (currently non-compiling) test sample is kept in autotests/export/
and inverted in suspiciousTests.
--- /dev/null
+#LyX 2.3 created this file. For more info see http://www.lyx.org/
+\lyxformat 512
+\begin_document
+\begin_header
+\save_transient_properties true
+\origin unavailable
+\textclass scrbook
+\use_default_options false
+\begin_modules
+customHeadersFooters
+enumitem
+logicalmkup
+\end_modules
+\maintain_unincluded_children false
+\language french
+\language_package default
+\inputencoding auto
+\fontencoding global
+\font_roman "lmodern" "default"
+\font_sans "lmss" "default"
+\font_typewriter "lmtt" "default"
+\font_math "auto" "auto"
+\font_default_family default
+\use_non_tex_fonts true
+\font_sc false
+\font_osf false
+\font_sf_scale 100 100
+\font_tt_scale 100 100
+\use_microtype false
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command bibtex
+\index_command default
+\paperfontsize 12
+\spacing single
+\use_hyperref false
+\pdf_title "Guide de l'utilisateur de LyX"
+\pdf_author "L'équipe LyX, Traduction: Adrien Rebollo, Siegfried Meunier-Guttin-Cluzel et Jean-Pierre Chrétien"
+\pdf_subject "LyX"
+\pdf_keywords "LyX"
+\pdf_bookmarks true
+\pdf_bookmarksnumbered true
+\pdf_bookmarksopen false
+\pdf_bookmarksopenlevel 1
+\pdf_breaklinks false
+\pdf_pdfborder false
+\pdf_colorlinks true
+\pdf_backref false
+\pdf_pdfusetitle false
+\pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue, pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false"
+\papersize default
+\use_geometry false
+\use_package amsmath 1
+\use_package amssymb 1
+\use_package cancel 0
+\use_package esint 1
+\use_package mathdots 1
+\use_package mathtools 0
+\use_package mhchem 1
+\use_package stackrel 0
+\use_package stmaryrd 0
+\use_package undertilde 0
+\cite_engine basic
+\cite_engine_type default
+\biblio_style plain
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\justification true
+\use_refstyle 1
+\notefontcolor #0000ff
+\branch Question
+\selected 1
+\filename_suffix 0
+\color #00ff00
+\end_branch
+\branch Réponse
+\selected 0
+\filename_suffix 0
+\color #aa55ff
+\end_branch
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 2
+\paragraph_separation skip
+\defskip medskip
+\quotes_language french
+\papercolumns 1
+\papersides 2
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Standard
+\paragraph_spacing single
+Verbatim
+\begin_inset Index idx
+status open
+
+\begin_layout Plain Layout
+
+\lang english
+Verbatim
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+If the index inset contains English text but the rest of the document is
+ french, compilation fails with
+\end_layout
+
+\begin_layout LyX-Code
+! LaTeX Error:
+\backslash
+begin{otherlanguage} on input line 10 ended by
+\backslash
+end{theindex}.
+\end_layout
+
+\begin_layout Standard
+with language package Polyglossia while no error is shown with Babel.
+\end_layout
+
+\begin_layout Standard
+(Should we prevent language switches in index insets?)
+\end_layout
+
+\begin_layout Standard
+If the index inset is in a section heading, the error is cryptic:
+\end_layout
+
+\begin_layout LyX-Code
+! Undefined control sequence.
+
+\backslash
+in@ #1#2->
+\backslash
+begingroup
+\backslash
+def
+\backslash
+in@@ ##1#1{}
+\backslash
+toks@
+\backslash
+expandafter {
+\backslash
+in@@ #2{}{}#1...
+ l.42 }}
+\end_layout
+
+\begin_layout Standard
+\begin_inset CommandInset nomencl_print
+LatexCommand printnomenclature
+set_width "auto"
+
+\end_inset
+
+
+\begin_inset CommandInset index_print
+LatexCommand printindex
+type "idx"
+
+\end_inset
+
+
+\end_layout
+
+\end_body
+\end_document
# side-effects: Ukrainean instead of Russian date, different hyphenation.
export/examples/uk/splash_(dvi3|pdf[45])_texF
-# missing commands (polyglossia?)
-# Explore! (works with language_package==babel)
-export/doc/fr/UserGuide_.*_systemF
-
# Missing characters (U+0361, U+1E61) in LM,
# set different system font in the source?
# + language nesting problem (may disappear after completed translation)
# Probably language mess
export/export/ja/wrong_auto_encoding_(dvi|pdf(|3))
+# language nesting in index insets
+# fails with polyglossia, works with language_package==babel)
+export/export/languagenesting_index_inset_.*_systemF
+
# Missing characters with Latin Modern Unicode:
# 0000 NULL (where does this come from?)
# 212B ANGSTROM SIGN (literal character in the source, replace with 00C5)
export/mathmacros/testcases_speed_(lyx16|lyx21|dvi|pdf|pdf[23]|(dvi3|pdf[45])_(texF|systemF))
check_load/mathmacros/testcases_speed
-# The "longest label" marker in a labeling must be valid LaTeX (just like ERT).
-# What should we do:
-# - document this,
-# - escape special characters,
-# - convert to LaTeXString,
-# or just report this at Trac for now?
-export/export/LongestLabelWithUnderscore_[^x].*
-
Sublabel: lyxbugs
#
export/doc/(es|ja)/UserGuide_xhtml
export/examples/spreadsheet_xhtml
+# Compilation error if longest label marker in labeling style
+# contains underscores etc. Ticket #10371
+export/export/LongestLabelWithUnderscore_[^x].*
+
Sublabel: ert
#
-#LyX 2.2 created this file. For more info see http://www.lyx.org/
-\lyxformat 508
+#LyX 2.3 created this file. For more info see http://www.lyx.org/
+\lyxformat 512
\begin_document
\begin_header
\save_transient_properties true
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
+\use_microtype false
\graphics default
\default_output_format pdf2
\output_sync 0
\begin_layout Subsubsection
Verbatim
\begin_inset Index idx
-status collapsed
+status open
\begin_layout Plain Layout
-
-\lang english
Verbatim
\end_layout
\end_layout
\begin_layout Verbatim
-
This is Verbatim.
\end_layout
\begin_layout Verbatim
\noindent
\align block
-
The following 2 lines are empty:
\end_layout
\end_layout
\begin_layout Verbatim
-
Almost everything is allowed in Verbatim:"%&$§#~'`
\backslash
}][{|
\end_layout
\begin_layout Verbatim*
-
This is Verbatim*.
\end_layout
\begin_layout Standard
\begin_inset Branch Question
+inverted 0
status open
\begin_layout Standard
\begin_layout Standard
\begin_inset Branch Réponse
+inverted 0
status collapsed
\begin_layout Standard
\begin_layout Standard
\begin_inset Branch Question
+inverted 0
status open
\begin_layout Standard
\begin_layout Standard
\begin_inset Branch Réponse
+inverted 0
status collapsed
\begin_layout Standard