summaryrefslogtreecommitdiffstats
path: root/chrome/common/resource_bundle_linux.cc
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-18 21:47:54 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-18 21:47:54 +0000
commit4daf03583a367047c06cbc05aace8f9edc355237 (patch)
treed9c64ab3241e5879604ba3f25553c31be1c837c7 /chrome/common/resource_bundle_linux.cc
parenta165a0510c4b684d47ca80a4a2868c98ba01dd49 (diff)
downloadchromium_src-4daf03583a367047c06cbc05aace8f9edc355237.zip
chromium_src-4daf03583a367047c06cbc05aace8f9edc355237.tar.gz
chromium_src-4daf03583a367047c06cbc05aace8f9edc355237.tar.bz2
load strings and display them on linux
Review URL: http://codereview.chromium.org/21465 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9972 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/resource_bundle_linux.cc')
-rw-r--r--chrome/common/resource_bundle_linux.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/chrome/common/resource_bundle_linux.cc b/chrome/common/resource_bundle_linux.cc
index 1cb8307..12b0858 100644
--- a/chrome/common/resource_bundle_linux.cc
+++ b/chrome/common/resource_bundle_linux.cc
@@ -37,7 +37,15 @@ void ResourceBundle::LoadResources(const std::wstring& pref_locale) {
bool success = resources_data_->Load(resources_data_path);
DCHECK(success) << "failed to load chrome.pak";
- // TODO(tc): Load the .pak file for locale_resources_data_.
+ FilePath locale_path;
+ PathService::Get(chrome::DIR_LOCALES, &locale_path);
+ // TODO(tc): Handle other locales properly.
+ NOTIMPLEMENTED() << " loading en-US strings only";
+ locale_path = locale_path.Append(FILE_PATH_LITERAL("en-US.pak"));
+ DCHECK(locale_resources_data_ == NULL) << "locale data already loaded!";
+ locale_resources_data_ = new base::DataPack;
+ success = locale_resources_data_->Load(locale_path);
+ DCHECK(success) << "failed to load locale pak file";
}
FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) {
@@ -100,6 +108,9 @@ std::wstring ResourceBundle::GetLocalizedString(int message_id) {
return std::wstring();
}
}
- // Copy into a wstring and return.
- return UTF8ToWide(data.as_string());
+
+ // Data pack encodes strings as UTF16.
+ string16 msg(reinterpret_cast<const char16*>(data.data()),
+ data.length() / 2);
+ return UTF16ToWide(msg);
}