diff options
author | jungshik@google.com <jungshik@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-03 21:30:51 +0000 |
---|---|---|
committer | jungshik@google.com <jungshik@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-03 21:30:51 +0000 |
commit | 243ed6775d053407531a16ce1bf986f1df697f62 (patch) | |
tree | 5d8b46fa35fcf4c2dcf65652488fc914a4235ecf /chrome/browser | |
parent | 1c370c041ab3333d091efdfbbc814853934d574d (diff) | |
download | chromium_src-243ed6775d053407531a16ce1bf986f1df697f62.zip chromium_src-243ed6775d053407531a16ce1bf986f1df697f62.tar.gz chromium_src-243ed6775d053407531a16ce1bf986f1df697f62.tar.bz2 |
Make the font family and the font size used in dom UI localizable. This is a part 1 of the fix for bug 7319 and will be followed by part 2 for non-DOM UI.
For some Indian languages (Malayalam, Bengali and Telugu), we have to
use a bigger size and a font family for that script on Windows.
This is because Windows' stock fonts for those scripts are smaller
than fonts for other scripts at a given size.
I removed 'WEB' style in chrome_font.h because it's not used anywhere any more
after our switch to the html UI. In addition, IDS_WEB_FONT_FAMILY is
recycled to localize the font family (or the list of font families) for html UI.
I also back-ported the support for setting 'style.fooBar' property to our copy
of Jstemplate (JstProcessor.prototype.jstValues_).
BUG=7319
Review URL: http://codereview.chromium.org/57025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13114 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/dom_ui/chrome_url_data_manager.cc | 16 | ||||
-rw-r--r-- | chrome/browser/dom_ui/chrome_url_data_manager.h | 3 | ||||
-rw-r--r-- | chrome/browser/dom_ui/downloads_ui.cc | 4 | ||||
-rw-r--r-- | chrome/browser/dom_ui/history_ui.cc | 7 | ||||
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui.cc | 8 | ||||
-rw-r--r-- | chrome/browser/resources/downloads.html | 6 | ||||
-rw-r--r-- | chrome/browser/resources/history.html | 6 | ||||
-rw-r--r-- | chrome/browser/resources/incognito_tab.html | 4 | ||||
-rw-r--r-- | chrome/browser/resources/new_tab.html | 5 |
9 files changed, 33 insertions, 26 deletions
diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc index 113580a..3a189b4 100644 --- a/chrome/browser/dom_ui/chrome_url_data_manager.cc +++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc @@ -9,8 +9,10 @@ #include "base/path_service.h" #include "base/string_util.h" #include "base/thread.h" +#include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/l10n_util.h" #include "chrome/common/ref_counted_util.h" #include "chrome/common/url_constants.h" #include "googleurl/src/url_util.h" @@ -24,6 +26,8 @@ #include "chrome/personalization/personalization.h" #endif +#include "grit/locale_settings.h" + // The URL scheme used for internal chrome resources. // TODO(glen): Choose a better location for this. static const char kChromeURLScheme[] = "chrome-ui"; @@ -259,6 +263,18 @@ void ChromeURLDataManager::DataSource::SendResponse( } // static +void ChromeURLDataManager::DataSource::SetFontAndTextDirection( + DictionaryValue* localized_strings) { + localized_strings->SetString(L"fontfamily", + l10n_util::GetString(IDS_WEB_FONT_FAMILY)); + localized_strings->SetString(L"fontsize", + l10n_util::GetString(IDS_WEB_FONT_SIZE)); + + localized_strings->SetString(L"textdirection", + (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? + L"rtl" : L"ltr"); +} + URLRequestJob* ChromeURLDataManager::Factory(URLRequest* request, const std::string& scheme) { // Try first with a file handler diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.h b/chrome/browser/dom_ui/chrome_url_data_manager.h index c3f5688..f11045c 100644 --- a/chrome/browser/dom_ui/chrome_url_data_manager.h +++ b/chrome/browser/dom_ui/chrome_url_data_manager.h @@ -11,6 +11,7 @@ #include "base/task.h" #include "chrome/common/ref_counted_util.h" +class DictionaryValue; class GURL; class MessageLoop; class URLRequest; @@ -61,6 +62,8 @@ class ChromeURLDataManager { MessageLoop* message_loop() const { return message_loop_; } const std::string& source_name() const { return source_name_; } + static void SetFontAndTextDirection(DictionaryValue* localized_strings); + private: // The name of this source. // E.g., for favicons, this could be "favicon", which results in paths for diff --git a/chrome/browser/dom_ui/downloads_ui.cc b/chrome/browser/dom_ui/downloads_ui.cc index 81684bc..009d65b 100644 --- a/chrome/browser/dom_ui/downloads_ui.cc +++ b/chrome/browser/dom_ui/downloads_ui.cc @@ -94,9 +94,7 @@ void DownloadsUIHTMLSource::StartDataRequest(const std::string& path, localized_strings.SetString(L"control_resume", l10n_util::GetString(IDS_DOWNLOAD_LINK_RESUME)); - localized_strings.SetString(L"textdirection", - (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? - L"rtl" : L"ltr"); + SetFontAndTextDirection(&localized_strings); static const StringPiece downloads_html( ResourceBundle::GetSharedInstance().GetRawDataResource( diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc index 9309732..5e299b6 100644 --- a/chrome/browser/dom_ui/history_ui.cc +++ b/chrome/browser/dom_ui/history_ui.cc @@ -27,6 +27,7 @@ #include "grit/browser_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" +#include "grit/locale_settings.h" // Maximum number of search results to return in a given search. We should // eventually remove this. @@ -45,6 +46,8 @@ HistoryUIHTMLSource::HistoryUIHTMLSource() void HistoryUIHTMLSource::StartDataRequest(const std::string& path, int request_id) { DictionaryValue localized_strings; + localized_strings.SetString(L"loading", + l10n_util::GetString(IDS_HISTORY_LOADING)); localized_strings.SetString(L"title", l10n_util::GetString(IDS_HISTORY_TITLE)); localized_strings.SetString(L"loading", @@ -72,9 +75,7 @@ void HistoryUIHTMLSource::StartDataRequest(const std::string& path, localized_strings.SetString(L"deletedaywarning", l10n_util::GetString(IDS_HISTORY_DELETE_PRIOR_VISITS_WARNING)); - localized_strings.SetString(L"textdirection", - (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? - L"rtl" : L"ltr"); + SetFontAndTextDirection(&localized_strings); static const StringPiece history_html( ResourceBundle::GetSharedInstance().GetRawDataResource( diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index 6250f10..15bbaa6 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -255,9 +255,7 @@ void NewTabHTMLSource::StartDataRequest(const std::string& path, localized_strings.SetString(L"closedwindow", l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW)); - localized_strings.SetString(L"textdirection", - (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? - kRTLHtmlTextDirection : kDefaultHtmlTextDirection); + SetFontAndTextDirection(&localized_strings); // Let the tab know whether it's the first tab being viewed. localized_strings.SetString(L"firstview", @@ -316,9 +314,7 @@ void IncognitoTabHTMLSource::StartDataRequest(const std::string& path, l10n_util::GetStringF(IDS_NEW_TAB_OTR_MESSAGE, l10n_util::GetString(IDS_LEARN_MORE_INCOGNITO_URL))); - localized_strings.SetString(L"textdirection", - (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? - kRTLHtmlTextDirection : kDefaultHtmlTextDirection); + SetFontAndTextDirection(&localized_strings); static const StringPiece incognito_tab_html( ResourceBundle::GetSharedInstance().GetRawDataResource( diff --git a/chrome/browser/resources/downloads.html b/chrome/browser/resources/downloads.html index acab6f0..6d85f3b 100644 --- a/chrome/browser/resources/downloads.html +++ b/chrome/browser/resources/downloads.html @@ -5,10 +5,8 @@ <title jscontent="title"></title> <style type="text/css"> body { - font-family:arial; background-color:white; color:black; - font-size:84%; margin:10px; } .header { @@ -698,7 +696,7 @@ function downloadUpdated(results) { } </script> </head> -<body onload="load();"> +<body onload="load();" jsvalues=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> <div class="header"> <a href="" onclick="setSearch(''); return false;"> <img src="../../app/theme/downloads_section.png" @@ -734,4 +732,4 @@ function downloadUpdated(results) { <span id="control_resume" jscontent="control_resume">Resume</span> </div> </body> -</html>
\ No newline at end of file +</html> diff --git a/chrome/browser/resources/history.html b/chrome/browser/resources/history.html index bd9738e..4f7347b 100644 --- a/chrome/browser/resources/history.html +++ b/chrome/browser/resources/history.html @@ -807,10 +807,8 @@ function historyDeleted() { </script> <style type="text/css"> body { - font-family:arial; background-color:white; color:black; - font-size:84%; margin:10px; } .header { @@ -921,7 +919,7 @@ html[dir='rtl'] .entry .title a { } </style> </head> -<body onload="load();"> +<body onload="load();" jsvalues=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> <div class="header"> <a href="" onclick="setSearch(''); return false;"> <img src="../../app/theme/history_section.png" @@ -954,4 +952,4 @@ html[dir='rtl'] .entry .title a { <span id="deletedaywarning" jscontent="deletedaywarning">Are you sure you want to delete this day?</span> </div> </body> -</html>
\ No newline at end of file +</html> diff --git a/chrome/browser/resources/incognito_tab.html b/chrome/browser/resources/incognito_tab.html index 6d34646..c35f351 100644 --- a/chrome/browser/resources/incognito_tab.html +++ b/chrome/browser/resources/incognito_tab.html @@ -14,8 +14,6 @@ body { background-color:#eee; color:black; padding:10px 10px 10px 10px; - font-family:arial; - font-size:84%; max-width:600px; margin-left:auto; margin-right:auto; @@ -23,7 +21,7 @@ body { </style> </head> <body> -<div class="content"> +<div class="content" jsvalues=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> <img src="../../app/theme/otr_icon_standalone.png" class="icon" /> <span jseval="this.innerHTML = $this.content;"></span> </div> diff --git a/chrome/browser/resources/new_tab.html b/chrome/browser/resources/new_tab.html index 1b966ca..e71dc51 100644 --- a/chrome/browser/resources/new_tab.html +++ b/chrome/browser/resources/new_tab.html @@ -184,9 +184,7 @@ logEvent('log start'); <title jscontent="title"></title> <style type="text/css"> body { - font-family:arial; background-color:white; - font-size:84%; margin:0px; } html[firstview='true'] #main { @@ -391,7 +389,8 @@ html[dir='rtl'] #searches input { } </style> </head> -<body onload="logEvent('body onload fired');"> +<body onload="logEvent('body onload fired');" + jsvalues=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> <div id="l10n" style="display:none;"> <span id="closedwindow" jscontent="closedwindow">Window</span> </div> |