Commit ae5dda72 authored by ofri@google.com's avatar ofri@google.com

Adding support for loading custom locale resources using a command line flag.

Loading pseudo-locale will now be done by passing --lang=myLocale --locale_res_path=path/to/pseudo-locale.pak

This patch doesn't work on Windows.

BUG=73052
TEST=NONE


Review URL: http://codereview.chromium.org/7033022

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86426 0039d316-1c4b-4281-b951-d872f2087c98
parent 1f8110b0
...@@ -21,6 +21,10 @@ const char kEnableDCHECK[] = "enable-dcheck"; ...@@ -21,6 +21,10 @@ const char kEnableDCHECK[] = "enable-dcheck";
// Generates full memory crash dump. // Generates full memory crash dump.
const char kFullMemoryCrashReport[] = "full-memory-crash-report"; const char kFullMemoryCrashReport[] = "full-memory-crash-report";
// Load the locale resources from the given path. When running on Mac/Unix the
// path should point to a locale.pak file.
const char kLocalePak[] = "locale_pak";
// Suppresses all error dialogs when present. // Suppresses all error dialogs when present.
const char kNoErrorDialogs[] = "noerrdialogs"; const char kNoErrorDialogs[] = "noerrdialogs";
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -14,6 +14,7 @@ extern const char kDebugOnStart[]; ...@@ -14,6 +14,7 @@ extern const char kDebugOnStart[];
extern const char kDisableBreakpad[]; extern const char kDisableBreakpad[];
extern const char kEnableDCHECK[]; extern const char kEnableDCHECK[];
extern const char kFullMemoryCrashReport[]; extern const char kFullMemoryCrashReport[];
extern const char kLocalePak[];
extern const char kNoErrorDialogs[]; extern const char kNoErrorDialogs[];
extern const char kNoMessageBox[]; extern const char kNoMessageBox[];
extern const char kTestChildProcess[]; extern const char kTestChildProcess[];
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/stl_util-inl.h" #include "base/stl_util-inl.h"
#include "base/string16.h" #include "base/string16.h"
...@@ -112,7 +115,14 @@ std::string ResourceBundle::LoadLocaleResources( ...@@ -112,7 +115,14 @@ std::string ResourceBundle::LoadLocaleResources(
const std::string& pref_locale) { const std::string& pref_locale) {
DCHECK(!locale_resources_data_) << "locale.pak already loaded"; DCHECK(!locale_resources_data_) << "locale.pak already loaded";
std::string app_locale = l10n_util::GetApplicationLocale(pref_locale); std::string app_locale = l10n_util::GetApplicationLocale(pref_locale);
FilePath locale_file_path = GetLocaleFilePath(app_locale); FilePath locale_file_path;
CommandLine *command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kLocalePak)) {
locale_file_path =
command_line->GetSwitchValuePath(switches::kLocalePak);
} else {
locale_file_path = GetLocaleFilePath(app_locale);
}
if (locale_file_path.empty()) { if (locale_file_path.empty()) {
// It's possible that there is no locale.pak. // It's possible that there is no locale.pak.
NOTREACHED(); NOTREACHED();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment