summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-06-01 10:19:18 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-06-01 10:19:18 -0700
commitf6c2f6a1eb5f795036559740af48ba8d7ead1e84 (patch)
treeb49e3c1a0f745eb55e4dcc25e18eb4943e3d0108
parent4abb74ed3e0f34f170136fd3707bbd5b5b951698 (diff)
parent506f3c92a41db1d80bfcdd8bbf1cca93b3733b6c (diff)
downloadGoogleSearch-f6c2f6a1eb5f795036559740af48ba8d7ead1e84.tar.gz
Merge change 1007 into donut
* changes: Update google_search_base for chinese language.
-rw-r--r--res/values-zh-rCN/strings.xml5
-rw-r--r--src/com/android/googlesearch/SuggestionProvider.java20
2 files changed, 23 insertions, 2 deletions
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index 43d39d3..ff937c7 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -16,4 +16,9 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="search_hint">"Google 搜索"</string>
+
+ <!-- China has a different url than the standard suggest url. -->
+ <!-- Do not translate. This string is an internal URI, not seen in the UI. -->
+ <string name="google_search_base" translatable="false">
+ http://www.google.cn/complete/search?hl=%1$s&amp;gl=%2$s&amp;</string>
</resources>
diff --git a/src/com/android/googlesearch/SuggestionProvider.java b/src/com/android/googlesearch/SuggestionProvider.java
index 416f9d0..141aaed 100644
--- a/src/com/android/googlesearch/SuggestionProvider.java
+++ b/src/com/android/googlesearch/SuggestionProvider.java
@@ -122,9 +122,25 @@ public class SuggestionProvider extends ContentProvider {
// resource strings, which are stored in mcc-specific xml files.)
if (mSuggestUri == null) {
Locale l = Locale.getDefault();
+ String language = l.getLanguage();
+ String country = l.getCountry().toLowerCase();
+ // Chinese and Portuguese have two langauge variants.
+ if ("zh".equals(language)) {
+ if ("cn".equals(country)) {
+ language = "zh-CN";
+ } else if ("tw".equals(country)) {
+ language = "zh-TW";
+ }
+ } else if ("pt".equals(language)) {
+ if ("br".equals(country)) {
+ language = "pt-BR";
+ } else if ("pt".equals(country)) {
+ language = "pt-PT";
+ }
+ }
mSuggestUri = getContext().getResources().getString(R.string.google_search_base,
- l.getLanguage(),
- l.getCountry().toLowerCase())
+ language,
+ country)
+ "json=true&q=";
}