Bug 323798: Keyword URL Needs to be localized, r=axel, sr=bzbarsky

This commit is contained in:
gavin%gavinsharp.com 2006-07-26 01:19:42 +00:00
Родитель 4f3a9fccac
Коммит e62b99303f
3 изменённых файлов: 19 добавлений и 2 удалений

Просмотреть файл

@ -161,7 +161,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");

Просмотреть файл

@ -16,3 +16,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=

Просмотреть файл

@ -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<nsIPrefLocalizedString> 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;