Commit ae216af9 authored by Donn Denman's avatar Donn Denman Committed by Commit Bot

[TTS] Don't send translation params that match.

Check for matching source/target parameters and don't send the
translation information if they match.

BUG=1076197

Change-Id: Ie4ba9b9061d62512b348b0e47dd48bc2b2054c0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2298178
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Auto-Submit: Donn Denman <donnd@chromium.org>
Reviewed-by: default avatarJinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#788469}
parent 0e3a110a
......@@ -176,14 +176,17 @@ class ContextualSearchRequest {
}
/**
* Adds translation parameters.
* Adds translation parameters, unless they match.
* @param sourceLanguage The language of the original search term.
* @param targetLanguage The language the that the user prefers.
*/
void forceTranslation(String sourceLanguage, String targetLanguage) {
mIsTranslationForced = true;
// If the server is providing a full URL then we shouldn't alter it.
if (mIsFullSearchUrlProvided) return;
if (mIsFullSearchUrlProvided || TextUtils.isEmpty(targetLanguage)
|| targetLanguage.equals(sourceLanguage)) {
return;
}
if (mLowPriorityUri != null) {
mLowPriorityUri = makeTranslateUri(mLowPriorityUri, sourceLanguage, targetLanguage);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment