[LyX/master] Localize format prettyName in some more places (#11954)

Juergen Spitzmueller spitz at lyx.org
Sat Aug 29 09:24:54 UTC 2020


commit 6f476b960edf2d774f0a4ba7d39b391034f093c7
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sat Aug 29 11:50:43 2020 +0200

    Localize format prettyName in some more places (#11954)
---
 src/Buffer.cpp               |    6 +++---
 src/Format.cpp               |    4 ++--
 src/frontends/qt/GuiView.cpp |    8 ++++----
 src/frontends/qt/Menus.cpp   |    3 ++-
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 97a6cfb..9de281d 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -4414,7 +4414,7 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir
 				// Only show this alert if this is an export to a non-temporary
 				// file (not for previewing).
 				docstring s = bformat(_("No information for exporting the format %1$s."),
-						      theFormats().prettyName(format));
+						      translateIfPossible(theFormats().prettyName(format)));
 				if (format == "pdf4")
 					s += "\n"
 					  + bformat(_("Hint: use non-TeX fonts or set input encoding "
@@ -4612,13 +4612,13 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir
 		} else {
 			message(bformat(_("Document exported as %1$s "
 				"to file `%2$s'"),
-				theFormats().prettyName(format),
+				translateIfPossible(theFormats().prettyName(format)),
 				makeDisplayPath(result_file)));
 		}
 	} else {
 		// This must be a dummy converter like fax (bug 1888)
 		message(bformat(_("Document exported as %1$s"),
-			theFormats().prettyName(format)));
+			translateIfPossible(theFormats().prettyName(format))));
 	}
 
 	return success ? ExportSuccess : ExportConverterError;
diff --git a/src/Format.cpp b/src/Format.cpp
index bdedcac..d639dbf 100644
--- a/src/Format.cpp
+++ b/src/Format.cpp
@@ -642,7 +642,7 @@ bool Formats::view(Buffer const & buffer, FileName const & filename,
 // by the caller (this should be "utility" code)
 		Alert::error(_("Cannot view file"),
 			bformat(_("No information for viewing %1$s"),
-				prettyName(format_name)));
+				translateIfPossible(prettyName(format_name))));
 		return false;
 	}
 	// viewer is 'auto'
@@ -746,7 +746,7 @@ bool Formats::edit(Buffer const & buffer, FileName const & filename,
 // be done by the caller (this should be "utility" code)
 		Alert::error(_("Cannot edit file"),
 			bformat(_("No information for editing %1$s"),
-				prettyName(format_name)));
+				translateIfPossible(prettyName(format_name))));
 		return false;
 	}
 
diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index b5bfe50..948deb9 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -746,7 +746,7 @@ QVector<GuiWorkArea*> GuiView::GuiViewPrivate::guiWorkAreas()
 static void handleExportStatus(GuiView * view, Buffer::ExportStatus status,
 	string const & format)
 {
-	docstring const fmt = theFormats().prettyName(format);
+	docstring const fmt = translateIfPossible(theFormats().prettyName(format));
 	docstring msg;
 	switch (status) {
 	case Buffer::ExportSuccess:
@@ -2536,7 +2536,7 @@ static bool import(GuiView * lv, FileName const & filename,
 		if (loader_format.empty()) {
 			frontend::Alert::error(_("Couldn't import file"),
 					 bformat(_("No information for importing the format %1$s."),
-					 theFormats().prettyName(format)));
+					 translateIfPossible(theFormats().prettyName(format))));
 			return false;
 		}
 	} else
@@ -2583,13 +2583,13 @@ void GuiView::importDocument(string const & argument)
 		}
 
 		docstring const text = bformat(_("Select %1$s file to import"),
-			theFormats().prettyName(format));
+			translateIfPossible(theFormats().prettyName(format)));
 
 		FileDialog dlg(toqstr(text));
 		dlg.setButton1(qt_("D&ocuments"), toqstr(lyxrc.document_path));
 		dlg.setButton2(qt_("&Examples"), toqstr(lyxrc.example_path));
 
-		docstring filter = theFormats().prettyName(format);
+		docstring filter = translateIfPossible(theFormats().prettyName(format));
 		filter += " (*.{";
 		// FIXME UNICODE
 		filter += from_utf8(theFormats().extensions(format));
diff --git a/src/frontends/qt/Menus.cpp b/src/frontends/qt/Menus.cpp
index a5cc9d4..3c94781 100644
--- a/src/frontends/qt/Menus.cpp
+++ b/src/frontends/qt/Menus.cpp
@@ -2304,7 +2304,8 @@ void Menus::Impl::expand(MenuDefinition const & frommenu,
 				break;
 			string const format = buf->params().getDefaultOutputFormat();
 			Format const * f = theFormats().getFormat(format);
-			docstring const name = f ? f->prettyname() : from_utf8(format);
+			docstring const name = f ? translateIfPossible(f->prettyname())
+						 : from_utf8(format);
 			docstring const label = bformat(_("Export [%1$s]|E"), name);
 			MenuItem item(MenuItem::Command, toqstr(label),
 			              FuncRequest(LFUN_BUFFER_EXPORT));


More information about the lyx-cvs mailing list