Consider files only in lang subtrees

This commit is contained in:
Juergen Spitzmueller 2019-03-21 14:39:33 +01:00
parent bd16aac366
commit 4b2cce9e0f

View File

@ -79,9 +79,6 @@ void GuiLyXFiles::getFiles(QMap<QString, QString> & in, QString const type)
if (s != -1) { if (s != -1) {
// <cat>/<subcat>/ // <cat>/<subcat>/
cat = relpath.left(s); cat = relpath.left(s);
int sc = relpath.indexOf('/', s + 1);
QString const subcat = (sc == -1) ?
QString() : relpath.mid(s + 1, sc - s - 1);
if (all_languages_.contains(cat) if (all_languages_.contains(cat)
&& !all_languages_.contains(dir.right(dir.lastIndexOf('/')))) { && !all_languages_.contains(dir.right(dir.lastIndexOf('/')))) {
QMap<QString, QString>::const_iterator li = all_languages_.find(cat); QMap<QString, QString>::const_iterator li = all_languages_.find(cat);
@ -89,17 +86,25 @@ void GuiLyXFiles::getFiles(QMap<QString, QString> & in, QString const type)
if (!available_languages_.contains(li.key())) if (!available_languages_.contains(li.key()))
available_languages_.insert(li.key(), li.value()); available_languages_.insert(li.key(), li.value());
localization = cat; localization = cat;
int sc = relpath.indexOf('/', s + 1);
cat = (sc == -1) ? QString() : relpath.mid(s + 1, sc - s - 1);
s = sc;
}
if (s != -1) {
int sc = relpath.indexOf('/', s + 1);
QString const subcat = (sc == -1) ?
QString() : relpath.mid(s + 1, sc - s - 1);
if (!subcat.isEmpty())
cat += '/' + subcat;
} }
if (!subcat.isEmpty())
cat += '/' + subcat;
} }
if (!relpaths.contains(relpath)) { if (!relpaths.contains(relpath)) {
relpaths.append(relpath); relpaths.append(relpath);
if (localization == "en") if (localization != "en")
in.insert(relpath, cat);
else
// strip off lang/ // strip off lang/
relpath = relpath.mid(relpath.indexOf('/') + 1); relpath = relpath.mid(relpath.indexOf('/') + 1);
in.insert(relpath, cat);
QMap<QString, QString> lm; QMap<QString, QString> lm;
if (localizations_.contains(relpath)) if (localizations_.contains(relpath))
lm = localizations_.find(relpath).value(); lm = localizations_.find(relpath).value();