From 85f27740331254a62b967eb1b083690a0bec7969 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Mon, 24 Sep 2012 13:00:41 -0700 Subject: [PATCH] Report the user's UI language in addition to the system language to the update checker --- aegisub/src/dialog_version_check.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/aegisub/src/dialog_version_check.cpp b/aegisub/src/dialog_version_check.cpp index ccb303f85..536c3ab52 100644 --- a/aegisub/src/dialog_version_check.cpp +++ b/aegisub/src/dialog_version_check.cpp @@ -331,6 +331,12 @@ static wxString GetSystemLanguage() } #endif +static wxString GetAegisubLanguage() +{ + const wxLanguageInfo *info = wxLocale::GetLanguageInfo(OPT_GET("App/Locale")->GetInt()); + return info ? info->CanonicalName : "unknown"; +} + template static void split_str(wxString const& str, wxString const& sep, bool empty, OutIter out) { @@ -352,13 +358,14 @@ void AegisubVersionCheckerThread::DoCheck() #ifdef __APPLE__ wxString cmd = wxString::Format( - "curl --silent --fail 'http://%s/%s?rev=%d&rel=%d&os=%s&lang=%s'", + "curl --silent --fail 'http://%s/%s?rev=%d&rel=%d&os=%s&lang=%s&aegilang=%s'", UPDATE_CHECKER_SERVER, UPDATE_CHECKER_BASE_URL, GetSVNRevision(), GetIsOfficialRelease()?1:0, GetOSShortName(), - GetSystemLanguage()); + GetSystemLanguage(), + GetAegisubLanguage()); // wxExecute only works on the main thread so use popen instead char buf[1024]; @@ -387,12 +394,13 @@ void AegisubVersionCheckerThread::DoCheck() agi::scoped_ptr stream(new wxStringInputStream(update_str)); #else wxString path = wxString::Format( - "%s?rev=%d&rel=%d&os=%s&lang=%s", + "%s?rev=%d&rel=%d&os=%s&lang=%s&aegilang=%s", UPDATE_CHECKER_BASE_URL, GetSVNRevision(), GetIsOfficialRelease()?1:0, GetOSShortName(), - GetSystemLanguage()); + GetSystemLanguage(), + GetAegisubLanguage()); wxHTTP http; http.SetHeader("User-Agent", wxString("Aegisub ") + GetAegisubLongVersionString());