Report the user's UI language in addition to the system language to the update checker

This commit is contained in:
Thomas Goyne 2012-09-24 13:00:41 -07:00
parent ccf3e94d96
commit 85f2774033
1 changed files with 12 additions and 4 deletions

View File

@ -331,6 +331,12 @@ static wxString GetSystemLanguage()
} }
#endif #endif
static wxString GetAegisubLanguage()
{
const wxLanguageInfo *info = wxLocale::GetLanguageInfo(OPT_GET("App/Locale")->GetInt());
return info ? info->CanonicalName : "unknown";
}
template<class OutIter> template<class OutIter>
static void split_str(wxString const& str, wxString const& sep, bool empty, OutIter out) static void split_str(wxString const& str, wxString const& sep, bool empty, OutIter out)
{ {
@ -352,13 +358,14 @@ void AegisubVersionCheckerThread::DoCheck()
#ifdef __APPLE__ #ifdef __APPLE__
wxString cmd = wxString::Format( 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_SERVER,
UPDATE_CHECKER_BASE_URL, UPDATE_CHECKER_BASE_URL,
GetSVNRevision(), GetSVNRevision(),
GetIsOfficialRelease()?1:0, GetIsOfficialRelease()?1:0,
GetOSShortName(), GetOSShortName(),
GetSystemLanguage()); GetSystemLanguage(),
GetAegisubLanguage());
// wxExecute only works on the main thread so use popen instead // wxExecute only works on the main thread so use popen instead
char buf[1024]; char buf[1024];
@ -387,12 +394,13 @@ void AegisubVersionCheckerThread::DoCheck()
agi::scoped_ptr<wxStringInputStream> stream(new wxStringInputStream(update_str)); agi::scoped_ptr<wxStringInputStream> stream(new wxStringInputStream(update_str));
#else #else
wxString path = wxString::Format( 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, UPDATE_CHECKER_BASE_URL,
GetSVNRevision(), GetSVNRevision(),
GetIsOfficialRelease()?1:0, GetIsOfficialRelease()?1:0,
GetOSShortName(), GetOSShortName(),
GetSystemLanguage()); GetSystemLanguage(),
GetAegisubLanguage());
wxHTTP http; wxHTTP http;
http.SetHeader("User-Agent", wxString("Aegisub ") + GetAegisubLongVersionString()); http.SetHeader("User-Agent", wxString("Aegisub ") + GetAegisubLongVersionString());