Skip to content

Commit 42bcc05

Browse files
committed
Show file's language in window subtitle
If the language isn't already part of the filename, show it as substitle (macOS) or appended to window title (elsewhere). Fixes #819.
1 parent ba7c8c3 commit 42bcc05

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/edframe.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
#include <map>
5757
#include <fstream>
5858

59+
#include<boost/algorithm/string.hpp>
60+
5961
#include "catalog.h"
6062
#include "catalog_po.h"
6163
#include "cat_update.h"
@@ -2679,6 +2681,24 @@ void PoeditFrame::UpdateTitle()
26792681
if (subtitle == "PROJECT VERSION")
26802682
subtitle.clear();
26812683

2684+
#if wxCHECK_VERSION(3,1,5)
2685+
if (m_catalog->GetLanguage().IsValid())
2686+
{
2687+
// add language to the subtitle, but only if not part of the filename already
2688+
auto lang = m_catalog->GetLanguage().LanguageTag();
2689+
if (!boost::algorithm::icontains(fpath.utf8_string(), lang))
2690+
{
2691+
boost::replace_all(lang, "-", "_");
2692+
if (!boost::algorithm::icontains(fpath.utf8_string(), lang))
2693+
{
2694+
if (!subtitle.empty())
2695+
subtitle += L"";
2696+
subtitle += m_catalog->GetLanguage().DisplayName();
2697+
}
2698+
}
2699+
}
2700+
#endif
2701+
26822702
#ifdef __WXOSX__
26832703
if (@available(macOS 11.0, *))
26842704
{

0 commit comments

Comments
 (0)