Translations for listings insets

The listings inset and include inset of type listings use two english terms
that are not localized yet: "Listing" for the caption and "Listings" for the
list of listings (not supported natively by LyX yet). The existing layout
translation mechanism has been extended to translate these terms as well:

1) Support [[stuff]] context in lib/layouttranslations
2) Support BabelPreamble and LangPreamble in InsetLayout
3) Use a InsetLayout for InsetInclude of type listings
4) Define BabelPreamble and LangPreamble in the layouts for InsetInclude
   and InsetListings
This commit is contained in:
Georg Baum 2012-04-10 20:21:01 +02:00
parent 8961be22ec
commit a2e8cb758b
18 changed files with 311 additions and 85 deletions

View File

@ -14254,6 +14254,31 @@ InsetLayout
definition can contain the following entries:
\end_layout
\begin_layout Description
\change_inserted -195340706 1333913893
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
BabelPreamble
\end_layout
\end_inset
Preamble for changing languages. See section
\begin_inset space ~
\end_inset
\begin_inset CommandInset ref
LatexCommand ref
reference "sub:I18n"
\end_inset
.
\end_layout
\begin_layout Description
\begin_inset Flex Code
status collapsed
@ -14904,6 +14929,34 @@ Branch
\end_inset
) modify this label on the fly.
\end_layout
\begin_layout Description
\change_inserted -195340706 1333913893
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
LangPreamble
\end_layout
\end_inset
Language dependent preamble. See section
\begin_inset space ~
\end_inset
\begin_inset CommandInset ref
LatexCommand ref
reference "sub:I18n"
\end_inset
.
\end_layout
\begin_layout Description

View File

@ -382,6 +382,44 @@ fggf
\end_inset
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "float,language={C++}"
inline false
status open
\begin_layout Plain Layout
\begin_inset Caption
\begin_layout Plain Layout
ccc
\end_layout
\end_inset
while(true);
\end_layout
\end_inset
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
lstlistoflistings
\end_layout
\end_inset
\end_layout
\end_body

View File

@ -4,7 +4,7 @@
#
# Detailed format description is available in the customization manual
Format 36
Format 38
Provides stdinsets 1
@ -170,8 +170,28 @@ InsetLayout Phantom
ForcePlain true
End
InsetLayout IncludeListings
# We need the [[List of Listings]] context, since "Listings" is also
# the name of the inset and translated differently.
# "Listings[[List of Listings]]" is the name of the "List of listings"
# ("Listings" is the predefined english name) in listings.sty, so it
# must be used here as well.
BabelPreamble
\addto\captions$$lang{\renewcommand{\lstlistingname}{_(Listing)}}
\addto\captions$$lang{\renewcommand{\lstlistlistingname}{_(Listings[[List of Listings]])}}
EndBabelPreamble
# The commands do not need to be defined in LangPreamble, since
# listings.sty does that already. However they need to be redefined
# in order to be used for non-english single-language documents.
LangPreamble
\renewcommand{\lstlistingname}{_(Listing)}
\renewcommand{\lstlistlistingname}{_(Listings[[List of Listings]])}
EndLangPreamble
End
InsetLayout Listings
LabelString Listings
CopyStyle IncludeListings
LabelString Listings[[inset]]
LatexType none
Decoration minimalistic
Font

View File

@ -30,6 +30,8 @@ Translation ar
"List of Graphs" "قائمة الرسوم البيانية"
"List of Schemes" "قائمة التصميمات"
"List of Tableaux" "قائمة الجداول"
"Listing" "عمل قوائم"
"Listings[[List of Listings]]" "Listings"
"Notation" "تدوين"
"Note" "ملاحظة"
"Problem" "مشكلة"
@ -106,6 +108,8 @@ Translation ca
"List of Graphs" "List of Graphs"
"List of Schemes" "List of Schemes"
"List of Tableaux" "List of Tableaux"
"Listing" "Llistat"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notació"
"Note" "Nota"
"Problem" "Problema"
@ -145,6 +149,8 @@ Translation cs
"List of Graphs" "Seznam grafů"
"List of Schemes" "Seznam schémat"
"List of Tableaux" "Seznam tabel"
"Listing" "Výpis"
"Listings[[List of Listings]]" "Listings"
"Notation" "Značení"
"Note" "Poznámka"
"Problem" "Úloha"
@ -184,6 +190,8 @@ Translation da
"List of Graphs" "Grafliste"
"List of Schemes" "Schemaliste"
"List of Tableaux" "Tableauliste"
"Listing" "Listing"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notation"
"Note" "Notat"
"Problem" "Problem"
@ -223,6 +231,8 @@ Translation de
"List of Graphs" "Liste der Graphen"
"List of Schemes" "Liste der Schemata"
"List of Tableaux" "Tableaux-Verzeichnis"
"Listing" "Listing"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notation"
"Note" "Notiz"
"Problem" "Problem"
@ -266,6 +276,8 @@ Translation el
"List of Graphs" "Λίστα Γραφημάτων"
"List of Schemes" "Λίστα Σχεδίων"
"List of Tableaux" "Λίστα Ταμπλό"
"Listing" "Καταλογοποίηση"
"Listings[[List of Listings]]" "Listings"
"Notation" "Σημειογραφία"
"Note" "Σημείωση"
"Problem" "Πρόβλημα"
@ -305,6 +317,8 @@ Translation en
"List of Graphs" "List of Graphs"
"List of Schemes" "List of Schemes"
"List of Tableaux" "List of Tableaux"
"Listing" "Listing"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notation"
"Note" "Note"
"Problem" "Problem"
@ -344,6 +358,8 @@ Translation es
"List of Graphs" "Índice de gráficos"
"List of Schemes" "Índice de esquemas"
"List of Tableaux" "Índice de Tableaux"
"Listing" "Listado"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notación"
"Note" "Nota"
"Problem" "Problema"
@ -383,6 +399,8 @@ Translation eu
"List of Graphs" "Grafikoen zerrenda"
"List of Schemes" "Eskemen zerrenda"
"List of Tableaux" "Taulen zerrenda"
"Listing" "Zerrenda"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notazioa"
"Note" "Ohar"
"Problem" "Buruketa"
@ -422,6 +440,8 @@ Translation fi
"List of Graphs" "Kuvaajien luettelo"
"List of Schemes" "Kuvausten lettelo"
"List of Tableaux" "Taulujen luettelo"
"Listing" "Listaus"
"Listings[[List of Listings]]" "Listings"
"Notation" "Merkintätapa"
"Note" "Muistiinpano"
"Problem" "Ongelma"
@ -461,6 +481,8 @@ Translation fr
"List of Graphs" "Liste des graphiques"
"List of Schemes" "Liste des schémas"
"List of Tableaux" "Liste des tableaux (TO)"
"Listing" "Listing"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notation"
"Note" "Note"
"Problem" "Problème"
@ -500,6 +522,8 @@ Translation gl
"List of Graphs" "List of Graphs"
"List of Schemes" "List of Schemes"
"List of Tableaux" "List of Tableaux"
"Listing" "Lista"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notación"
"Note" "Nota"
"Problem" "Problema"
@ -539,6 +563,8 @@ Translation he
"List of Graphs" "רשימת גרפים"
"List of Schemes" "רשימת סכמות"
"List of Tableaux" "List of Tableaux"
"Listing" "רישום קוד"
"Listings[[List of Listings]]" "Listings"
"Notation" "צורת רישום"
"Note" "הערה"
"Problem" "בעיה"
@ -578,6 +604,8 @@ Translation hu
"List of Graphs" "Grafikonok listája"
"List of Schemes" "Sémák listája"
"List of Tableaux" "Csoportképek listája"
"Listing" "Lista"
"Listings[[List of Listings]]" "Listings"
"Notation" "Jelölés"
"Note" "Megjegyzés"
"Problem" "Probléma"
@ -617,6 +645,8 @@ Translation ia
"List of Graphs" "Lista de graphicos"
"List of Schemes" "Lista de schemas"
"List of Tableaux" "Lista de tableau"
"Listing" "Listar"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notation"
"Note" "Nota"
"Problem" "Problema"
@ -656,6 +686,8 @@ Translation id
"List of Graphs" "Daftar Grafik"
"List of Schemes" "Daftar Skema"
"List of Tableaux" "Daftar Tableaux"
"Listing" "Listing"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notasi"
"Note" "Nota"
"Problem" "Masalah"
@ -695,6 +727,8 @@ Translation it
"List of Graphs" "Elenco dei grafici"
"List of Schemes" "Elenco degli schemi"
"List of Tableaux" "Elenco dei tableau"
"Listing" "Listato"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notazione"
"Note" "Nota"
"Problem" "Problema"
@ -734,6 +768,8 @@ Translation ja
"List of Graphs" "グラフ一覧"
"List of Schemes" "スキーム一覧"
"List of Tableaux" "絵画一覧"
"Listing" "リスト"
"Listings[[List of Listings]]" "Listings"
"Notation" "記法"
"Note" "注釈"
"Problem" "問題"
@ -810,6 +846,8 @@ Translation nb
"List of Graphs" "Grafer"
"List of Schemes" "Struktruformler"
"List of Tableaux" "Tablåer"
"Listing" "«Listing»"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notasjon"
"Note" "Merknad"
"Problem" "Problem"
@ -849,6 +887,8 @@ Translation nl
"List of Graphs" "Grafiekenlijst"
"List of Schemes" "Schema-lijst"
"List of Tableaux" "Lijst van Tableaus"
"Listing" "Opsomming"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notatie"
"Note" "Noot"
"Problem" "Opgave"
@ -888,6 +928,8 @@ Translation nn
"List of Graphs" "Liste over grafar"
"List of Schemes" "Liste over skjema"
"List of Tableaux" "Liste over tablå"
"Listing" "Kodeliste"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notasjon"
"Note" "Notis"
"Problem" "Problem"
@ -927,6 +969,8 @@ Translation pl
"List of Graphs" "Lista grafów"
"List of Schemes" "Lista schematów"
"List of Tableaux" "List of Tableaux"
"Listing" "Listing"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notacja"
"Note" "Notka"
"Problem" "Problem"
@ -966,6 +1010,8 @@ Translation pt
"List of Graphs" "Lista de Gráficos"
"List of Schemes" "Lista de Esquemas"
"List of Tableaux" "Lista de Quadros"
"Listing" "Listagem"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notação"
"Note" "Nota"
"Problem" "Problema"
@ -1010,6 +1056,8 @@ Translation ro
"List of Graphs" "Listă de Grafice"
"List of Schemes" "Listă de Scheme"
"List of Tableaux" "Listă de Tabele"
"Listing" "Listare"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notație"
"Note" "Notă"
"Problem" "Problemă"
@ -1049,6 +1097,8 @@ Translation ru
"List of Graphs" "Список графиков"
"List of Schemes" "Список схем"
"List of Tableaux" "Список таблиц"
"Listing" "Листинг"
"Listings[[List of Listings]]" "Listings"
"Notation" "Нотация"
"Note" "Заметка"
"Problem" "Проблема"
@ -1088,6 +1138,8 @@ Translation sk
"List of Graphs" "Zoznam grafík"
"List of Schemes" "Zoznam náčrtkov"
"List of Tableaux" "Zoznam tablov"
"Listing" "Výpis"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notácia"
"Note" "Poznámka"
"Problem" "Problém"
@ -1164,6 +1216,8 @@ Translation sr
"List of Graphs" "Spisak Grafikona"
"List of Schemes" "Spisak Šema"
"List of Tableaux" "Spisak Tabela "
"Listing" "Listing"
"Listings[[List of Listings]]" "Listings"
"Notation" "Zabeleška"
"Note" "Napomena"
"Problem" "Problem"
@ -1203,6 +1257,8 @@ Translation sv
"List of Graphs" "Lista över grafer"
"List of Schemes" "Lista över scheman"
"List of Tableaux" "Lista över tablåer"
"Listing" "Listning"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notation"
"Note" "Not"
"Problem" "Problem"
@ -1242,6 +1298,8 @@ Translation tr
"List of Graphs" "List of Graphs"
"List of Schemes" "Plan Listesi"
"List of Tableaux" "Tablo Listesi"
"Listing" "Liste"
"Listings[[List of Listings]]" "Listings"
"Notation" "Notasyon"
"Note" "Not"
"Problem" "Problem"
@ -1281,6 +1339,8 @@ Translation uk
"List of Graphs" "Список графіків"
"List of Schemes" "Список схем"
"List of Tableaux" "Список табло"
"Listing" "Текст програми"
"Listings[[List of Listings]]" "Listings"
"Notation" "Позначення"
"Note" "Примітка"
"Problem" "Проблема"
@ -1320,6 +1380,8 @@ Translation zh_CN
"List of Graphs" "图形列表"
"List of Schemes" "方案列表"
"List of Tableaux" "场景列表"
"Listing" "列表"
"Listings[[List of Listings]]" "Listings"
"Notation" "记号"
"Note" "备忘"
"Problem" "问题"
@ -1359,6 +1421,8 @@ Translation zh_TW
"List of Graphs" "List of Graphs"
"List of Schemes" "List of Schemes"
"List of Tableaux" "List of Tableaux"
"Listing" "列表"
"Listings[[List of Listings]]" "Listings"
"Notation" "記法"
"Note" "註記"
"Problem" "問題"

View File

@ -129,6 +129,9 @@ import os, re, string, sys
# Implement the citation engine machinery in layouts.
# Change CiteFormat to CiteFormat (default|authoryear|numerical).
# Incremented to format 38, 08 April 2012 by gb
# Introduce LangPreamble and BabelPreamble for InsetLayout.
# Do not forget to document format change in Customization
# Manual (section "Declaring a new text class").
@ -136,7 +139,7 @@ import os, re, string, sys
# development/tools/updatelayouts.sh script to update all
# layout files to the new format.
currentFormat = 37
currentFormat = 38
def usage(prog_name):
@ -322,6 +325,10 @@ def convert(lines):
i += 1
continue
if format == 37:
i += 1
continue
if format == 36:
match = re_CiteFormat.match(lines[i]);
if match and match.group(4) == "":

View File

@ -336,6 +336,8 @@ def layouts_l10n(input_files, output, base, layouttranslations):
keys.append(key)
keys.sort()
ContextRe = re.compile(r'(.*)(\[\[.*\]\])')
print >> out, '''# This file has been automatically generated by po/lyx_pot.py.
# PLEASE MODIFY ONLY THE LAGUAGES HAVING NO .po FILE! If you want to regenerate
# this file from the translations, run `make ../lib/layouttranslations' in po.
@ -372,8 +374,13 @@ def layouts_l10n(input_files, output, base, layouttranslations):
# also print untranslated entries to help translators
elif not lang in oldlanguages:
key = key.replace('\\', '\\\\').replace('"', '\\"')
res = ContextRe.search(key)
if res != None:
val = res.group(1)
else:
val = key
print >> out, '\t"%s" "%s"' % \
(key.encode('utf-8'), key.encode('utf-8'))
(key.encode('utf-8'), val.encode('utf-8'))
print >> out, 'End'
out.close()

View File

@ -38,6 +38,7 @@
#include "support/filetools.h"
#include "support/gettext.h"
#include "support/lstrings.h"
#include "support/regex.h"
#include <algorithm>
@ -1181,6 +1182,49 @@ docstring const getFloatI18nPreamble(docstring const & type,
<< "{\\renewcommand{\\" << type << "name}{" << translated << "}}\n";
return os.str();
}
docstring const i18npreamble(docstring const & templ, Language const * lang,
Encoding const & enc, bool const polyglossia)
{
if (templ.empty())
return templ;
string preamble = polyglossia ?
subst(to_utf8(templ), "$$lang", lang->polyglossia()) :
subst(to_utf8(templ), "$$lang", lang->babel());
string const langenc = lang->encoding()->iconvName();
string const texenc = lang->encoding()->latexName();
string const bufenc = enc.iconvName();
// First and second character of plane 15 (Private Use Area)
string const s1 = "\xf3\xb0\x80\x80"; // U+F0000
string const s2 = "\xf3\xb0\x80\x81"; // U+F0001
// FIXME UNICODE
// lyx::regex is not unicode-safe.
// Should use QRegExp or (boost::u32regex, but that requires ICU)
static regex const reg("_\\(([^\\)]+)\\)");
smatch sub;
while (regex_search(preamble, sub, reg)) {
string const key = sub.str(1);
docstring const name = lang->translateLayout(key);
// Check whether name can be encoded in the buffer encoding
bool encodable = true;
for (size_t i = 0; i < name.size(); ++i) {
if (!enc.encodable(name[i])) {
encodable = false;
break;
}
}
string const translated = encodable ? to_utf8(name)
: "\\inputencoding{" + texenc + "}"
+ s1 + langenc + s2 + to_utf8(name)
+ s1 + bufenc + s2;
preamble = subst(preamble, sub.str(), translated);
}
return from_utf8(preamble);
}
}
@ -1197,17 +1241,20 @@ docstring const LaTeXFeatures::getTClassI18nPreamble(bool use_babel, bool use_po
list<docstring>::const_iterator end = usedLayouts_.end();
for (; cit != end; ++cit) {
// language dependent commands (once per document)
snippets.insert(tclass[*cit].langpreamble(buffer().language(),
snippets.insert(i18npreamble(tclass[*cit].langpreamble(),
buffer().language(),
buffer().params().encoding(),
use_polyglossia));
// commands for language changing (for multilanguage documents)
if ((use_babel || use_polyglossia) && !UsedLanguages_.empty()) {
snippets.insert(tclass[*cit].babelpreamble(
snippets.insert(i18npreamble(
tclass[*cit].babelpreamble(),
buffer().language(),
buffer().params().encoding(),
use_polyglossia));
for (lang_it lit = lbeg; lit != lend; ++lit)
snippets.insert(tclass[*cit].babelpreamble(
snippets.insert(i18npreamble(
tclass[*cit].babelpreamble(),
*lit,
buffer().params().encoding(),
use_polyglossia));
@ -1251,6 +1298,34 @@ docstring const LaTeXFeatures::getTClassI18nPreamble(bool use_babel, bool use_po
}
}
cit = usedInsetLayouts_.begin();
end = usedInsetLayouts_.end();
TextClass::InsetLayouts const & ils = tclass.insetLayouts();
for (; cit != end; ++cit) {
TextClass::InsetLayouts::const_iterator it = ils.find(*cit);
if (it == ils.end())
continue;
// language dependent commands (once per document)
snippets.insert(i18npreamble(it->second.langpreamble(),
buffer().language(),
buffer().params().encoding(),
use_polyglossia));
// commands for language changing (for multilanguage documents)
if ((use_babel || use_polyglossia) && !UsedLanguages_.empty()) {
snippets.insert(i18npreamble(
it->second.babelpreamble(),
buffer().language(),
buffer().params().encoding(),
use_polyglossia));
for (lang_it lit = lbeg; lit != lend; ++lit)
snippets.insert(i18npreamble(
it->second.babelpreamble(),
*lit,
buffer().params().encoding(),
use_polyglossia));
}
}
odocstringstream tcpreamble;
set<docstring>::const_iterator const send = snippets.end();
set<docstring>::const_iterator it = snippets.begin();

View File

@ -53,7 +53,9 @@ docstring const Language::translateLayout(string const & m) const
if (it != layoutTranslations_.end())
return it->second;
return from_ascii(m);
docstring t = from_ascii(m);
cleanTranslation(t);
return t;
}

View File

@ -24,7 +24,6 @@
#include "support/lassert.h"
#include "support/lstrings.h"
#include "support/Messages.h"
#include "support/regex.h"
#include "support/textutils.h"
@ -859,72 +858,6 @@ void Layout::readSpacing(Lexer & lex)
}
namespace {
docstring const i18npreamble(Language const * lang, Encoding const & enc,
docstring const & templ, bool const polyglossia)
{
if (templ.empty())
return templ;
string preamble = polyglossia ?
subst(to_utf8(templ), "$$lang", lang->polyglossia()) :
subst(to_utf8(templ), "$$lang", lang->babel());
#ifdef TEX2LYX
// tex2lyx does not have getMessages()
LASSERT(false, /**/);
(void)enc;
#else
string const langenc = lang->encoding()->iconvName();
string const texenc = lang->encoding()->latexName();
string const bufenc = enc.iconvName();
// First and second character of plane 15 (Private Use Area)
string const s1 = "\xf3\xb0\x80\x80"; // U+F0000
string const s2 = "\xf3\xb0\x80\x81"; // U+F0001
// FIXME UNICODE
// lyx::regex is not unicode-safe.
// Should use QRegExp or (boost::u32regex, but that requires ICU)
static regex const reg("_\\(([^\\)]+)\\)");
smatch sub;
while (regex_search(preamble, sub, reg)) {
string const key = sub.str(1);
docstring const name = lang->translateLayout(key);
// Check whether name can be encoded in the buffer encoding
bool encodable = true;
for (size_t i = 0; i < name.size(); ++i) {
if (!enc.encodable(name[i])) {
encodable = false;
break;
}
}
string const translated = encodable ? to_utf8(name)
: "\\inputencoding{" + texenc + "}"
+ s1 + langenc + s2 + to_utf8(name)
+ s1 + bufenc + s2;
preamble = subst(preamble, sub.str(), translated);
}
#endif
return from_utf8(preamble);
}
}
docstring const Layout::langpreamble(Language const * lang,
Encoding const & enc, bool const polyglossia) const
{
return i18npreamble(lang, enc, langpreamble_, polyglossia);
}
docstring const Layout::babelpreamble(Language const * lang,
Encoding const & enc, bool const polyglossia) const
{
return i18npreamble(lang, enc, babelpreamble_, polyglossia);
}
string const & Layout::htmltag() const
{
if (htmltag_.empty())

View File

@ -14,7 +14,6 @@
#ifndef LAYOUT_H
#define LAYOUT_H
#include "Encoding.h"
#include "FontInfo.h"
#include "LayoutEnums.h"
#include "Spacing.h"
@ -25,7 +24,6 @@
namespace lyx {
class Language;
class Lexer;
class TextClass;
@ -96,10 +94,10 @@ public:
docstring const & preamble() const { return preamble_; }
/// Get language dependent macro definitions needed for this layout
/// for language \p lang
docstring const langpreamble(Language const * lang, Encoding const & enc, bool const polyglossia) const;
docstring const langpreamble() const { return langpreamble_; }
/// Get language and babel dependent macro definitions needed for
/// this layout for language \p lang
docstring const babelpreamble(Language const * lang, Encoding const & enc, bool const polyglossia) const;
docstring const babelpreamble() const { return babelpreamble_; }
///
std::set<std::string> const & requires() const { return requires_; }
///

View File

@ -57,10 +57,10 @@ namespace lyx {
// could. See LayoutFileList::addEmptyClass() and, especially, the
// definition of the layoutpost string.
// You should also run (or ask someone who has bash to run) the
// development/updatelayouts.sh script, to update the format of
// development/tools/updatelayouts.sh script, to update the format of
// all of our layout files.
//
int const LAYOUT_FORMAT = 37; //jrioux : move citation engine stuff into layouts
int const LAYOUT_FORMAT = 38; //gb : LangPreamble and BabelPreamble for InsetLayout
namespace {

View File

@ -1424,7 +1424,7 @@ GuiDocument::GuiDocument(GuiView & lv)
docPS->addPanel(pdfSupportModule, qt_("PDF Properties"));
docPS->addPanel(mathsModule, qt_("Math Options"));
docPS->addPanel(floatModule, qt_("Float Placement"));
docPS->addPanel(listingsModule, qt_("Listings"));
docPS->addPanel(listingsModule, qt_("Listings[[inset]]"));
docPS->addPanel(bulletsModule, qt_("Bullets"));
docPS->addPanel(branchesModule, qt_("Branches"));
docPS->addPanel(outputModule, qt_("Output"));

View File

@ -905,6 +905,7 @@ void InsetInclude::validate(LaTeXFeatures & features) const
features.includeFile(include_label, writefile);
features.useInsetLayout(getLayout());
if (isVerbatim(params()))
features.require("verbatim");
else if (isListings(params()))
@ -997,6 +998,13 @@ Inset::DisplayType InsetInclude::display() const
}
docstring InsetInclude::layoutName() const
{
if (isListings(params()))
return from_ascii("IncludeListings");
return InsetCommand::layoutName();
}
//
// preview stuff

View File

@ -79,6 +79,8 @@ public:
DisplayType display() const;
///
InsetCode lyxCode() const { return INCLUDE_CODE; }
///
docstring layoutName() const;
/** Fills \c key
* \param keys the list of bibkeys in the child buffer.
* \param it not used here

View File

@ -75,6 +75,7 @@ InsetLayout::InsetLaTeXType translateLaTeXType(std::string const & str)
bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
{
enum {
IL_BABELPREAMBLE,
IL_BGCOLOR,
IL_CONTENTASLABEL,
IL_COPYSTYLE,
@ -98,6 +99,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
IL_INTOC,
IL_LABELFONT,
IL_LABELSTRING,
IL_LANGPREAMBLE,
IL_LATEXNAME,
IL_LATEXPARAM,
IL_LATEXTYPE,
@ -117,6 +119,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
LexerKeyword elementTags[] = {
{ "babelpreamble", IL_BABELPREAMBLE },
{ "bgcolor", IL_BGCOLOR },
{ "contentaslabel", IL_CONTENTASLABEL },
{ "copystyle", IL_COPYSTYLE },
@ -142,6 +145,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
{ "keepempty", IL_KEEPEMPTY },
{ "labelfont", IL_LABELFONT },
{ "labelstring", IL_LABELSTRING },
{ "langpreamble", IL_LANGPREAMBLE },
{ "latexname", IL_LATEXNAME },
{ "latexparam", IL_LATEXPARAM },
{ "latextype", IL_LATEXTYPE },
@ -311,6 +315,12 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
case IL_PREAMBLE:
preamble_ = from_utf8(lex.getLongString("EndPreamble"));
break;
case IL_BABELPREAMBLE:
babelpreamble_ = from_utf8(lex.getLongString("EndBabelPreamble"));
break;
case IL_LANGPREAMBLE:
langpreamble_ = from_utf8(lex.getLongString("EndLangPreamble"));
break;
case IL_REFPREFIX:
lex >> refprefix_;
break;

View File

@ -82,6 +82,11 @@ public:
ColorCode bgcolor() const { return bgcolor_; }
///
docstring preamble() const { return preamble_; }
/// Get language dependent macro definitions needed for this inset
docstring const langpreamble() const { return langpreamble_; }
/// Get language and babel dependent macro definitions needed for
/// this inset
docstring const babelpreamble() const { return babelpreamble_; }
///
docstring counter() const { return counter_; }
///
@ -183,6 +188,10 @@ private:
docstring counter_;
///
docstring preamble_;
/// Language dependent macro definitions needed for this inset
docstring langpreamble_;
/// Language and babel dependent macro definitions needed for this inset
docstring babelpreamble_;
///
docstring refprefix_;
///

View File

@ -29,8 +29,6 @@ namespace lyx {
// Instanciate static member.
string Messages::main_lang_;
namespace {
void cleanTranslation(docstring & trans)
{
/*
@ -51,7 +49,6 @@ void cleanTranslation(docstring & trans)
}
}
} // anonymous
} // lyx

View File

@ -57,6 +57,9 @@ extern Messages const & getMessages(std::string const & language);
/// Implementation is in LyX.cpp.
extern Messages const & getGuiMessages();
/// Remove the context suffix from \p trans
extern void cleanTranslation(docstring & trans);
} // namespace lyx
#endif