Formats::const_iterator cit = form_->formats().begin();
Formats::const_iterator end = form_->formats().end();
for (; cit != end; ++cit) {
- converterFromCO->addItem(toqstr(cit->prettyname()));
- converterToCO->addItem(toqstr(cit->prettyname()));
+ converterFromCO->addItem(qt_(cit->prettyname()));
+ converterToCO->addItem(qt_(cit->prettyname()));
}
// currentRowChanged(int) is also triggered when updating the listwidget
Converters::const_iterator ccit = form_->converters().begin();
Converters::const_iterator cend = form_->converters().end();
for (; ccit != cend; ++ccit) {
- string const name =
- ccit->From->prettyname() + " -> " + ccit->To->prettyname();
+ QString const name =
+ qt_(ccit->From->prettyname()) + " -> " + qt_(ccit->To->prettyname());
int type = form_->converters().getNumber(ccit->From->name(), ccit->To->name());
- new QListWidgetItem(toqstr(name), convertersLW, type);
+ new QListWidgetItem(name, convertersLW, type);
}
convertersLW->sortItems(Qt::AscendingOrder);
convertersLW->blockSignals(false);
private:
QString toString(Format const & format) const
{
- return toqstr(format.prettyname());
+ return qt_(format.prettyname());
}
};
}
+namespace {
+
+string const l10n_shortcut(string const prettyname, string const shortcut)
+{
+ if (shortcut.empty())
+ return string();
+
+ string l10n_format =
+ to_utf8(_(prettyname + '|' + shortcut));
+ return split(l10n_format, '|');
+}
+
+}; // namespace anon
+
+
void PrefFileformats::apply(LyXRC & /*rc*/) const
{
}
Formats::const_iterator cit = form_->formats().begin();
Formats::const_iterator end = form_->formats().end();
for (; cit != end; ++cit)
- formatsCB->addItem(toqstr(cit->prettyname()),
- QVariant(form_->formats().getNumber(cit->name())) );
+ formatsCB->addItem(qt_(cit->prettyname()),
+ QVariant(form_->formats().getNumber(cit->name())));
// restore selection
int const item = formatsCB->findText(current, Qt::MatchExactly);
formatED->setText(toqstr(f.name()));
copierED->setText(toqstr(form_->movers().command(f.name())));
extensionED->setText(toqstr(f.extension()));
- shortcutED->setText(toqstr(f.shortcut()));
+ shortcutED->setText(
+ toqstr(l10n_shortcut(f.prettyname(), f.shortcut())));
viewerED->setText(toqstr(f.viewer()));
editorED->setText(toqstr(f.editor()));
documentCB->setChecked((f.documentFormat()));
void PrefFileformats::on_shortcutED_textEdited(const QString & s)
{
- currentFormat().setShortcut(fromqstr(s));
+ string const new_shortcut = fromqstr(s);
+ if (new_shortcut == l10n_shortcut(currentFormat().prettyname(),
+ currentFormat().shortcut()))
+ return;
+ currentFormat().setShortcut(new_shortcut);
changed();
}
void PrefFileformats::updatePrettyname()
{
- string const newname = fromqstr(formatsCB->currentText());
- if (newname == currentFormat().prettyname())
+ QString const newname = formatsCB->currentText();
+ if (newname == qt_(currentFormat().prettyname()))
return;
- currentFormat().setPrettyname(newname);
+ currentFormat().setPrettyname(fromqstr(newname));
formatsChanged();
updateView();
changed();