Skip to content

Commit

Permalink
Show file's language in window subtitle
Browse files Browse the repository at this point in the history
If the language isn't already part of the filename, show it as substitle
(macOS) or appended to window title (elsewhere).

Fixes #819.
  • Loading branch information
vslavik committed Dec 14, 2023
1 parent ba7c8c3 commit 42bcc05
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/edframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
#include <map>
#include <fstream>

#include<boost/algorithm/string.hpp>

#include "catalog.h"
#include "catalog_po.h"
#include "cat_update.h"
Expand Down Expand Up @@ -2679,6 +2681,24 @@ void PoeditFrame::UpdateTitle()
if (subtitle == "PROJECT VERSION")
subtitle.clear();

#if wxCHECK_VERSION(3,1,5)
if (m_catalog->GetLanguage().IsValid())
{
// add language to the subtitle, but only if not part of the filename already
auto lang = m_catalog->GetLanguage().LanguageTag();
if (!boost::algorithm::icontains(fpath.utf8_string(), lang))
{
boost::replace_all(lang, "-", "_");
if (!boost::algorithm::icontains(fpath.utf8_string(), lang))
{
if (!subtitle.empty())
subtitle += L"";
subtitle += m_catalog->GetLanguage().DisplayName();
}
}
}
#endif

#ifdef __WXOSX__
if (@available(macOS 11.0, *))
{
Expand Down

0 comments on commit 42bcc05

Please sign in to comment.