Skip to content

Commit

Permalink
OTA updates: try to fix wrong requests on Unix
Browse files Browse the repository at this point in the history
Try to fix incorrect requests on Unix, where full locale (e.g. fr_FR) is
used instead of just the catalog language name (e.g. fr).
  • Loading branch information
vslavik committed Feb 1, 2024
1 parent a98484b commit 629da53
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/edapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <wx/ipc.h>
#include <wx/translation.h>

#include <algorithm>
#include <iostream>
#include <fstream>
#include <boost/iostreams/copy.hpp>
Expand Down Expand Up @@ -656,6 +657,17 @@ void PoeditApp::SetupOTALanguageUpdate(wxTranslations *trans, const wxString& la
else
langMO.Replace("-", "_");

#if defined(__UNIX__) && !defined(__WXOSX__)
// GetBestTranslation() can fall back to the locale there, so check if we ship this translation
auto avail = trans->GetAvailableTranslations("poedit");
if (std::find(avail.begin(), avail.end(), lang) == avail.end())
{
langMO = lang.BeforeFirst('_');
if (std::find(avail.begin(), avail.end(), langMO) == avail.end())
return;
}
#endif

auto version = str::to_utf8(GetMajorAppVersion());

// use downloaded OTA translations:
Expand Down

0 comments on commit 629da53

Please sign in to comment.