From b545f62acbb67741c1ac093c9b8f2264e124f17d Mon Sep 17 00:00:00 2001 From: "gavin%gavinsharp.com" Date: Fri, 28 Jul 2006 01:57:25 +0000 Subject: [PATCH] Bug 323798: Keyword URL Needs to be localized, r=axel, sr=bzbarsky, a=mtschrep git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@205021 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/browser/app/profile/firefox.js | 2 +- .../chrome/browser-region/region.properties | 3 +++ mozilla/docshell/base/nsDefaultURIFixup.cpp | 16 +++++++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/mozilla/browser/app/profile/firefox.js b/mozilla/browser/app/profile/firefox.js index 91aea3ba8af..ad6cd46dffb 100644 --- a/mozilla/browser/app/profile/firefox.js +++ b/mozilla/browser/app/profile/firefox.js @@ -164,7 +164,7 @@ pref("xpinstall.whitelist.add", "update.mozilla.org"); pref("xpinstall.whitelist.add.103", "addons.mozilla.org"); pref("keyword.enabled", true); -pref("keyword.URL", "http://www.google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q="); +pref("keyword.URL", "chrome://browser-region/locale/region.properties"); pref("general.useragent.locale", "@AB_CD@"); pref("general.skins.selectedSkin", "classic/1.0"); diff --git a/mozilla/browser/locales/en-US/chrome/browser-region/region.properties b/mozilla/browser/locales/en-US/chrome/browser-region/region.properties index a41dfd3e996..4c13d33fe6d 100644 --- a/mozilla/browser/locales/en-US/chrome/browser-region/region.properties +++ b/mozilla/browser/locales/en-US/chrome/browser-region/region.properties @@ -17,3 +17,6 @@ startup.homepage_welcome_url=http://www.mozilla.com/firefox/central # This is the fallback URL for release notes. Do not change this # unless you are providing localized release notes! app.update.url.details=http://www.mozilla.com/firefox/releases/ + +# Keyword URL (for location bar searches) +keyword.URL=http://www.google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q= diff --git a/mozilla/docshell/base/nsDefaultURIFixup.cpp b/mozilla/docshell/base/nsDefaultURIFixup.cpp index 84c16134ff2..da845e185ed 100644 --- a/mozilla/docshell/base/nsDefaultURIFixup.cpp +++ b/mozilla/docshell/base/nsDefaultURIFixup.cpp @@ -45,6 +45,7 @@ #include "nsCRT.h" #include "nsIPrefService.h" +#include "nsIPrefLocalizedString.h" #include "nsIPlatformCharset.h" #include "nsILocalFile.h" @@ -373,7 +374,20 @@ NS_IMETHODIMP nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword, NS_ENSURE_STATE(mPrefBranch); nsXPIDLCString url; - mPrefBranch->GetCharPref("keyword.URL", getter_Copies(url)); + nsCOMPtr keywordURL; + mPrefBranch->GetComplexValue("keyword.URL", + NS_GET_IID(nsIPrefLocalizedString), + getter_AddRefs(keywordURL)); + + if (keywordURL) { + nsXPIDLString wurl; + keywordURL->GetData(getter_Copies(wurl)); + CopyUTF16toUTF8(wurl, url); + } else { + // Fall back to a non-localized pref, for backwards compat + mPrefBranch->GetCharPref("keyword.URL", getter_Copies(url)); + } + // if we can't find a keyword.URL keywords won't work. if (url.IsEmpty()) return NS_ERROR_NOT_AVAILABLE;