Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: chrome/browser/views/edit_search_engine_dialog.cc

Issue 1073005: Move RTL related functions from app/l10n_util to base/i18n/rtl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/download_item_view.cc ('k') | chrome/browser/views/frame/browser_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/views/edit_search_engine_dialog.h" 5 #include "chrome/browser/views/edit_search_engine_dialog.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/i18n/rtl.h"
9 #include "base/string_util.h" 10 #include "base/string_util.h"
10 #include "chrome/browser/search_engines/edit_search_engine_controller.h" 11 #include "chrome/browser/search_engines/edit_search_engine_controller.h"
11 #include "chrome/browser/search_engines/template_url.h" 12 #include "chrome/browser/search_engines/template_url.h"
12 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
13 #include "grit/app_resources.h" 14 #include "grit/app_resources.h"
14 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
15 #include "grit/theme_resources.h" 16 #include "grit/theme_resources.h"
16 #include "views/controls/label.h" 17 #include "views/controls/label.h"
17 #include "views/controls/image_view.h" 18 #include "views/controls/image_view.h"
18 #include "views/controls/table/table_view.h" 19 #include "views/controls/table/table_view.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // is not interpreted by the Unicode BiDi algorithm as an LTR string and 197 // is not interpreted by the Unicode BiDi algorithm as an LTR string and
197 // therefore the end result is that the following right to left text is 198 // therefore the end result is that the following right to left text is
198 // displayed: ".three two s% one" (where 'one', 'two', etc. are words in 199 // displayed: ".three two s% one" (where 'one', 'two', etc. are words in
199 // Hebrew). 200 // Hebrew).
200 // 201 //
201 // In order to fix this problem we transform the substring "%s" so that it 202 // In order to fix this problem we transform the substring "%s" so that it
202 // is displayed correctly when rendered in an RTL context. 203 // is displayed correctly when rendered in an RTL context.
203 layout->StartRowWithPadding(0, 2, 0, unrelated_y); 204 layout->StartRowWithPadding(0, 2, 0, unrelated_y);
204 std::wstring description = 205 std::wstring description =
205 l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_URL_DESCRIPTION_LABEL); 206 l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_URL_DESCRIPTION_LABEL);
206 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { 207 if (base::i18n::IsRTL()) {
207 const std::wstring reversed_percent(L"s%"); 208 const std::wstring reversed_percent(L"s%");
208 std::wstring::size_type percent_index = 209 std::wstring::size_type percent_index =
209 description.find(L"%s", static_cast<std::wstring::size_type>(0)); 210 description.find(L"%s", static_cast<std::wstring::size_type>(0));
210 if (percent_index != std::wstring::npos) 211 if (percent_index != std::wstring::npos)
211 description.replace(percent_index, 212 description.replace(percent_index,
212 reversed_percent.length(), 213 reversed_percent.length(),
213 reversed_percent); 214 reversed_percent);
214 } 215 }
215 216
216 views::Label* description_label = new views::Label(description); 217 views::Label* description_label = new views::Label(description);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 image_view->SetImage( 253 image_view->SetImage(
253 ResourceBundle::GetSharedInstance().GetBitmapNamed( 254 ResourceBundle::GetSharedInstance().GetBitmapNamed(
254 IDR_INPUT_GOOD)); 255 IDR_INPUT_GOOD));
255 } else { 256 } else {
256 image_view->SetTooltipText(l10n_util::GetString(invalid_message_id)); 257 image_view->SetTooltipText(l10n_util::GetString(invalid_message_id));
257 image_view->SetImage( 258 image_view->SetImage(
258 ResourceBundle::GetSharedInstance().GetBitmapNamed( 259 ResourceBundle::GetSharedInstance().GetBitmapNamed(
259 IDR_INPUT_ALERT)); 260 IDR_INPUT_ALERT));
260 } 261 }
261 } 262 }
OLDNEW
« no previous file with comments | « chrome/browser/views/download_item_view.cc ('k') | chrome/browser/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698