summaryrefslogtreecommitdiffstats
path: root/chrome/common/l10n_util.cc
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-09 16:55:59 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-09 16:55:59 +0000
commit2586294b13b0d4b08d348ed2853d91654ce35b29 (patch)
tree1618a3389fdcc9a99af29352caa95571a34a4d2f /chrome/common/l10n_util.cc
parent89b760190db7878c341fb2d127011272cb03ccea (diff)
downloadchromium_src-2586294b13b0d4b08d348ed2853d91654ce35b29.zip
chromium_src-2586294b13b0d4b08d348ed2853d91654ce35b29.tar.gz
chromium_src-2586294b13b0d4b08d348ed2853d91654ce35b29.tar.bz2
Re-land add UTF8 versions of GetString and GetStringF. This is useful for
gtk which uses utf8 for all its strings. TBR=evanm Review URL: http://codereview.chromium.org/62187 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13429 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/l10n_util.cc')
-rw-r--r--chrome/common/l10n_util.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/chrome/common/l10n_util.cc b/chrome/common/l10n_util.cc
index 8d1a6f3..fabd01c 100644
--- a/chrome/common/l10n_util.cc
+++ b/chrome/common/l10n_util.cc
@@ -297,6 +297,10 @@ std::wstring GetString(int message_id) {
return rb.GetLocalizedString(message_id);
}
+std::string GetStringUTF8(int message_id) {
+ return WideToUTF8(GetString(message_id));
+}
+
static std::wstring GetStringF(int message_id,
const std::wstring& a,
const std::wstring& b,
@@ -328,6 +332,31 @@ std::wstring GetStringF(int message_id,
return GetStringF(message_id, a, b, c, std::wstring(), NULL);
}
+std::string GetStringFUTF8(int message_id,
+ const string16& a) {
+ // TODO(tc): Once this whole file uses string16, we can drop the UTF16ToWide
+ // conversions. http://crbug.com/9911
+ return WideToUTF8(GetStringF(message_id, UTF16ToWide(a)));
+}
+
+std::string GetStringFUTF8(int message_id,
+ const string16& a,
+ const string16& b) {
+ // TODO(tc): Once this whole file uses string16, we can drop the UTF16ToWide
+ // conversions. http://crbug.com/9911
+ return WideToUTF8(GetStringF(message_id, UTF16ToWide(a), UTF16ToWide(b)));
+}
+
+std::string GetStringFUTF8(int message_id,
+ const string16& a,
+ const string16& b,
+ const string16& c) {
+ // TODO(tc): Once this whole file uses string16, we can drop the UTF16ToWide
+ // conversions. http://crbug.com/9911
+ return WideToUTF8(GetStringF(message_id, UTF16ToWide(a), UTF16ToWide(b),
+ UTF16ToWide(c)));
+}
+
std::wstring GetStringF(int message_id,
const std::wstring& a,
size_t* offset) {