From 12d0cd89072fdb704bb9afe56524989545d69364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Sat, 14 Sep 2024 17:09:55 +0200 Subject: [PATCH] Show full relative path for reference source text files Instead of showing just the base name (e.g. "[messages.json]"), use relative path (e.g. "[../en/messages.json]"). This makes a difference in the not-uncommon setup where the filename is the same, but located in an adjacent folder. --- src/edframe.cpp | 9 +++++++-- src/edlistctrl.cpp | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/edframe.cpp b/src/edframe.cpp index f94ab689ee..8112df159c 100644 --- a/src/edframe.cpp +++ b/src/edframe.cpp @@ -2497,18 +2497,23 @@ void PoeditFrame::OfferSideloadingSourceText() if (!Language::TryGuessFromFilename(filename, &wildcard).IsValid()) return; + wxFileName fn(filename); + wildcard.Replace("*", "en"); wxFileName ref(wildcard); - if (!ref.FileExists() || wxFileName(filename) == ref) + if (!ref.FileExists() || fn == ref) return; + wxFileName displayRef(ref); + displayRef.MakeRelativeTo(fn.GetPath()); + AttentionMessage msg ( "sideload-symbolic-id-source", AttentionMessage::Question, _("Would you like to use English for source text?") ); - msg.SetExplanation(wxString::Format(_(L"This file uses string IDs instead of source text. Poedit can load English texts from the ā€œ%sā€ file for you."), ref.GetFullName())); + msg.SetExplanation(wxString::Format(_(L"This file uses string IDs instead of source text. Poedit can load English texts from the ā€œ%sā€ file for you."), displayRef.GetFullPath())); // TRANSLATORS: Shown as action button when asking if the user wants to replace string IDs with English text; "load" as in "load from file" msg.AddAction(_("Load English"),[=]{ SideloadSourceTextFromFile(ref); diff --git a/src/edlistctrl.cpp b/src/edlistctrl.cpp index 1de274727c..9b9ea714b4 100644 --- a/src/edlistctrl.cpp +++ b/src/edlistctrl.cpp @@ -717,7 +717,8 @@ void PoeditListCtrl::UpdateColumns() if (m_catalog->HasSideloadedReferenceFile()) { wxFileName fn(m_catalog->GetSideloadedSourceData()->reference_file->GetFileName()); - sourceTitle += wxString::Format(" [%s]", fn.GetFullName()); + fn.MakeRelativeTo(wxFileName(m_catalog->GetFileName()).GetPath()); + sourceTitle += wxString::Format(" [%s]", fn.GetFullPath()); } m_colSource->SetTitle(sourceTitle);