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

Side by Side Diff: chrome/common/l10n_util.cc

Issue 28171: Wire up resource bundles on the mac:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 10 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/common/l10n_util.h" 7 #include "chrome/common/l10n_util.h"
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/scoped_ptr.h" 13 #include "base/scoped_ptr.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "base/string_piece.h" 15 #include "base/string_piece.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/sys_string_conversions.h" 17 #include "base/sys_string_conversions.h"
18 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/gfx/chrome_canvas.h" 20 #include "chrome/common/gfx/chrome_canvas.h"
21 #if defined(OS_WIN) || defined(OS_LINUX)
22 // TODO(port): re-enable.
23 #include "chrome/common/resource_bundle.h" 21 #include "chrome/common/resource_bundle.h"
24 #endif
25 #if defined(OS_WIN) 22 #if defined(OS_WIN)
26 #include "chrome/views/view.h" 23 #include "chrome/views/view.h"
27 #endif // defined(OS_WIN) 24 #endif // defined(OS_WIN)
28 25
29 // TODO(playmobil): remove this undef once SkPostConfig.h is fixed. 26 // TODO(playmobil): remove this undef once SkPostConfig.h is fixed.
30 // skia/include/corecg/SkPostConfig.h #defines strcasecmp() so we can't use 27 // skia/include/corecg/SkPostConfig.h #defines strcasecmp() so we can't use
31 // base::strcasecmp() without #undefing it here. 28 // base::strcasecmp() without #undefing it here.
32 #undef strcasecmp 29 #undef strcasecmp
33 30
34 namespace { 31 namespace {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 DCHECK(U_SUCCESS(error)); 275 DCHECK(U_SUCCESS(error));
279 name_local.resize(actual_size); 276 name_local.resize(actual_size);
280 // Add an RTL mark so parentheses are properly placed. 277 // Add an RTL mark so parentheses are properly placed.
281 if (is_for_ui && GetTextDirection() == RIGHT_TO_LEFT) { 278 if (is_for_ui && GetTextDirection() == RIGHT_TO_LEFT) {
282 name_local.push_back(static_cast<wchar_t>(kRightToLeftMark)); 279 name_local.push_back(static_cast<wchar_t>(kRightToLeftMark));
283 } 280 }
284 return name_local; 281 return name_local;
285 } 282 }
286 283
287 std::wstring GetString(int message_id) { 284 std::wstring GetString(int message_id) {
288 #if defined(OS_WIN) || defined(OS_LINUX)
289 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); 285 ResourceBundle &rb = ResourceBundle::GetSharedInstance();
290 return rb.GetLocalizedString(message_id); 286 return rb.GetLocalizedString(message_id);
291 #else
292 NOTIMPLEMENTED(); // TODO(port): Real implementation of GetString.
293 // Return something non-empty so callers don't freak out.
294 return L"true";
295 #endif
296 } 287 }
297 288
298 static std::wstring GetStringF(int message_id, 289 static std::wstring GetStringF(int message_id,
299 const std::wstring& a, 290 const std::wstring& a,
300 const std::wstring& b, 291 const std::wstring& b,
301 const std::wstring& c, 292 const std::wstring& c,
302 const std::wstring& d, 293 const std::wstring& d,
303 std::vector<size_t>* offsets) { 294 std::vector<size_t>* offsets) {
304 #if defined(OS_WIN) || defined(OS_LINUX)
305 // TODO(port): re-enable.
306 const std::wstring& format_string = GetString(message_id); 295 const std::wstring& format_string = GetString(message_id);
307 std::wstring formatted = ReplaceStringPlaceholders(format_string, a, b, c, 296 std::wstring formatted = ReplaceStringPlaceholders(format_string, a, b, c,
308 d, offsets); 297 d, offsets);
309 return formatted; 298 return formatted;
310 #else
311 NOTIMPLEMENTED();
312 return L"GetStringF NOTIMPLEMENTED";
313 #endif // defined(OS_WIN)
314 } 299 }
315 300
316 std::wstring GetStringF(int message_id, 301 std::wstring GetStringF(int message_id,
317 const std::wstring& a) { 302 const std::wstring& a) {
318 return GetStringF(message_id, a, std::wstring(), std::wstring(), 303 return GetStringF(message_id, a, std::wstring(), std::wstring(),
319 std::wstring(), NULL); 304 std::wstring(), NULL);
320 } 305 }
321 306
322 std::wstring GetStringF(int message_id, 307 std::wstring GetStringF(int message_id,
323 const std::wstring& a, 308 const std::wstring& a,
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 } 716 }
732 717
733 void BiDiLineIterator::GetLogicalRun(int start, 718 void BiDiLineIterator::GetLogicalRun(int start,
734 int* end, 719 int* end,
735 UBiDiLevel* level) { 720 UBiDiLevel* level) {
736 DCHECK(bidi_ != NULL); 721 DCHECK(bidi_ != NULL);
737 ubidi_getLogicalRun(bidi_, start, end, level); 722 ubidi_getLogicalRun(bidi_, start, end, level);
738 } 723 }
739 724
740 } 725 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698