Attempt to save the template in the appropriate language subfolder of
the user template directory (and propose to create it if it doesn't exist
yet).
That way, user-generated templates (1.) get the correct language attribution
in the lyxfiles dialog and (2.) users can easily generate different
language versions of a template.
Several changes are needed to get things right:
* nested supersripts only work with inheritFonts=true.
* to get caret position right, it is necessary to remember the outside
font of the inset before computing metrics.
* to get the size right at insertion time, it is necessary to trigger
a metrics computation just after inset insertion.
While math style (scriptstyle,...) is not really something that can be
set, it is useful for text subscripts and superscripts and therefore
it makes sense to handle it in some places.
With this change, style is still not a first class feature, but good
enough for now. In particular, it is taken into account in update().
* "platex" fails with "inputencoding default", if there is text in other languages.
"jis-platex" works fine, "jis-utf8" fails with German Umlauts (maybe more).
* The expert setting "inputencoding default" switches the inpute encoding
with language switches without marking this in the LaTeX source.
It is rarely required (if ever) and makes documents easy to break.
It is not required for AMS Books, Simple CV, ... (probabely a tex2lyx issue).
"utf8" and "auto" work fine.
Instead of the weird corner line, display a pilcrow sign (even when
disabled in prefs) to mark inserted/deleted end of paragraph.
Incidentally, this fixes the recent placement bug of the corner line.
Now only the languages available for the selected file are displayed.
By default, LyX pre-selects the GUI language (and falls back to English
if this is not available). Once another language has been selected by
the user, this one is preferred before the GUI language (and the English
fallback).