summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfinnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-10 03:28:53 +0000
committerfinnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-10 03:28:53 +0000
commit7300cee914cc7af13f6e18f1c73be6892157a8c5 (patch)
treef914e634de093034b015b39ba0ec5745dd17e8e8
parent2ce0255c06ea5826bec202f5412c718ae2744b9b (diff)
downloadchromium_src-7300cee914cc7af13f6e18f1c73be6892157a8c5.zip
chromium_src-7300cee914cc7af13f6e18f1c73be6892157a8c5.tar.gz
chromium_src-7300cee914cc7af13f6e18f1c73be6892157a8c5.tar.bz2
Allow the translators to chose which link appears first in the About box.
Review URL: http://codereview.chromium.org/7035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3176 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/chromium_strings.grd2
-rw-r--r--chrome/app/google_chrome_strings.grd2
-rw-r--r--chrome/browser/views/about_chrome_view.cc29
3 files changed, 22 insertions, 11 deletions
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd
index 7385be7..67daa80 100644
--- a/chrome/app/chromium_strings.grd
+++ b/chrome/app/chromium_strings.grd
@@ -92,7 +92,7 @@ be available for now. -->
<message name="IDS_ABOUT_VERSION_COPYRIGHT" desc="Copyright information on the about pages">
Copyright © 2006-2008 The Chromium Authors. All Rights Reserved.
</message>
- <message name="IDS_ABOUT_VERSION_LICENSE" desc="The label below the copyright message, containing the URLs. Do not change the order of the links when translating.">
+ <message name="IDS_ABOUT_VERSION_LICENSE" desc="The label below the copyright message, containing the URLs.">
Chromium is made possible by the <ph name="PROJECT_LINK">$1<ex>Chromium</ex></ph> open source project and other <ph name="OPEN_SOURCE_LINK">$2<ex>open source</ex> software</ph>.
</message>
<message name="IDS_ABOUT_OPEN_SOURCE_SOFTWARE" desc="The link text on the About box that links to open source software. Used in IDS_ABOUT_VERSION_LICENSE.">
diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd
index 32b3ac0..556f9f4 100644
--- a/chrome/app/google_chrome_strings.grd
+++ b/chrome/app/google_chrome_strings.grd
@@ -131,7 +131,7 @@ Chrome supports. -->
<message name="IDS_ABOUT_VERSION_COPYRIGHT" desc="Copyright information on the about pages">
Copyright © 2006-2008 Google Inc. All Rights Reserved.
</message>
- <message name="IDS_ABOUT_VERSION_LICENSE" desc="The label below the copyright message, containing the URLs. Do not change the order of the links when translating.">
+ <message name="IDS_ABOUT_VERSION_LICENSE" desc="The label below the copyright message, containing the URLs.">
Google Chrome is made possible by the <ph name="PROJECT_LINK">$1<ex>Chromium</ex></ph> open source project and other <ph name="OPEN_SOURCE_LINK">$2<ex>open source</ex> software</ph>.
</message>
<message name="IDS_ABOUT_OPEN_SOURCE_SOFTWARE" desc="The link text on the About box that links to open source software. Used in IDS_ABOUT_VERSION_LICENSE.">
diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc
index ee275d2..5eb53c6 100644
--- a/chrome/browser/views/about_chrome_view.cc
+++ b/chrome/browser/views/about_chrome_view.cc
@@ -55,6 +55,7 @@ AboutChromeView::AboutChromeView(Profile* profile)
terms_of_service_url_(NULL),
chromium_url_(NULL),
open_source_url_(NULL),
+ chromium_url_appears_first_(true),
check_button_status_(CHECKBUTTON_HIDDEN) {
DCHECK(profile);
Init();
@@ -147,12 +148,13 @@ void AboutChromeView::Init() {
std::wstring(),
std::wstring(),
&url_offsets);
+ chromium_url_appears_first_ = url_offsets[0] < url_offsets[1];
+ int link1 = std::min(url_offsets[0], url_offsets[1]);
+ int link2 = std::max(url_offsets[0], url_offsets[1]);
- DCHECK(url_offsets[0] < url_offsets[1]);
- main_label_chunk1_ = text.substr(0, url_offsets[0]);
- main_label_chunk2_ = text.substr(url_offsets[0],
- url_offsets[1] - url_offsets[0]);
- main_label_chunk3_ = text.substr(url_offsets[1]);
+ main_label_chunk1_ = text.substr(0, link1);
+ main_label_chunk2_ = text.substr(link1, link2 - link1);
+ main_label_chunk3_ = text.substr(link2);
url_offsets.clear();
text = l10n_util::GetStringF(IDS_ABOUT_TERMS_OF_SERVICE,
@@ -308,16 +310,25 @@ void AboutChromeView::Paint(ChromeCanvas* canvas) {
CRect bounds;
main_text_label_->GetBounds(&bounds);
+ ChromeViews::Link* link1 =
+ chromium_url_appears_first_ ? chromium_url_ : open_source_url_;
+ ChromeViews::Link* link2 =
+ chromium_url_appears_first_ ? open_source_url_ : chromium_url_;
+ gfx::Rect* rect1 = chromium_url_appears_first_ ?
+ &chromium_url_rect_ : &open_source_url_rect_;
+ gfx::Rect* rect2 = chromium_url_appears_first_ ?
+ &open_source_url_rect_ : &chromium_url_rect_;
+
// This struct keeps track of where to write the next word (which x,y
// pixel coordinate). This struct is updated after drawing text and checking
// if we need to wrap.
CSize position;
// Draw the first text chunk and position the Chromium url.
- DrawTextAndPositionUrl(canvas, main_label_chunk1_, chromium_url_,
- &chromium_url_rect_, &position, bounds, font);
+ DrawTextAndPositionUrl(canvas, main_label_chunk1_, link1,
+ rect1, &position, bounds, font);
// Draw the second text chunk and position the Open Source url.
- DrawTextAndPositionUrl(canvas, main_label_chunk2_, open_source_url_,
- &open_source_url_rect_, &position, bounds, font);
+ DrawTextAndPositionUrl(canvas, main_label_chunk2_, link2,
+ rect2, &position, bounds, font);
// Draw the third text chunk.
DrawTextStartingFrom(canvas, main_label_chunk3_, &position, bounds, font);