From 6f6d9b631d110fb71fcd99351b4f40d58451700a Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 5 Jul 2024 16:10:17 +0200 Subject: [PATCH] Fix display of page references when language is not specified Using translateIfPossible with null language does not make sense (and gives an error on console). Using translateIfPossible there actually does not make sense at all: it is only for string from layout files that may already be translated. We use the buffer language when no language has been specified. It might have been better to use the GUI language. A consequence of the commit is that "elsewhere" will be in the po files and now really translatable ;) --- src/insets/InsetRef.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp index c1ea8e4a93..11ab35e219 100644 --- a/src/insets/InsetRef.cpp +++ b/src/insets/InsetRef.cpp @@ -32,6 +32,7 @@ #include "support/docstream.h" #include "support/gettext.h" #include "support/lstrings.h" +#include "support/Messages.h" #include "support/textutils.h" using namespace lyx::support; @@ -399,8 +400,8 @@ docstring InsetRef::displayString(docstring const & ref, string const & cmd, display_string = value; else if (cmd == "pageref" || cmd == "vpageref") { // normally would be "on page #", but we have no pages. - display_string = - translateIfPossible(from_ascii("elsewhere"), language); + display_string = language.empty() ? buffer().B_("elsewhere") + : getMessages(language).get("elsewhere"); } else if (cmd == "eqref") display_string = '(' + value + ')'; else if (cmd == "formatted") { -- 2.39.5