This source file includes following definitions.
- AddApiKeyToUrl
- AddHostLocaleToUrl
#include "components/translate/core/browser/translate_url_util.h"
#include "components/translate/core/browser/translate_download_manager.h"
#include "google_apis/google_api_keys.h"
#include "net/base/url_util.h"
namespace {
const char kApiKeyName[] = "key";
const char kHostLocaleQueryName[] = "hl";
}
namespace TranslateURLUtil {
GURL AddApiKeyToUrl(const GURL& url) {
return net::AppendQueryParameter(url, kApiKeyName, google_apis::GetAPIKey());
}
GURL AddHostLocaleToUrl(const GURL& url) {
return net::AppendQueryParameter(
url,
kHostLocaleQueryName,
TranslateDownloadManager::GetLanguageCode(
TranslateDownloadManager::GetInstance()->application_locale()));
}
}