summaryrefslogtreecommitdiffstats
path: root/ui/base/l10n
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-17 19:39:42 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-17 19:39:42 +0000
commitea47b6a802638fa18df618d5ba71dc4b5b3b4c48 (patch)
tree6c1cc5a5aac4c5c8dd81fbee7b2f87652ab1b823 /ui/base/l10n
parent48c18de8a9e3a35f5a829e7fb01e76d80e5b596e (diff)
downloadchromium_src-ea47b6a802638fa18df618d5ba71dc4b5b3b4c48.zip
chromium_src-ea47b6a802638fa18df618d5ba71dc4b5b3b4c48.tar.gz
chromium_src-ea47b6a802638fa18df618d5ba71dc4b5b3b4c48.tar.bz2
Introduce ui.dll / libui.so for the component build.
R=ben@chromium.org Review URL: http://codereview.chromium.org/7328011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92819 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/l10n')
-rw-r--r--ui/base/l10n/l10n_font_util.h15
-rw-r--r--ui/base/l10n/l10n_util.h118
-rw-r--r--ui/base/l10n/l10n_util_collator.h10
-rw-r--r--ui/base/l10n/l10n_util_win.h18
4 files changed, 84 insertions, 77 deletions
diff --git a/ui/base/l10n/l10n_font_util.h b/ui/base/l10n/l10n_font_util.h
index 329b96d..4478569 100644
--- a/ui/base/l10n/l10n_font_util.h
+++ b/ui/base/l10n/l10n_font_util.h
@@ -7,6 +7,7 @@
#pragma once
#include "ui/gfx/size.h"
+#include "ui/ui_api.h"
namespace gfx {
class Font;
@@ -18,13 +19,13 @@ namespace ui {
// its localized size data and the given font. The width in cols is held in a
// localized string resource identified by |col_resource_id|, the height in the
// same fashion.
-int GetLocalizedContentsWidthForFont(int col_resource_id,
- const gfx::Font& font);
-int GetLocalizedContentsHeightForFont(int row_resource_id,
- const gfx::Font& font);
-gfx::Size GetLocalizedContentsSizeForFont(int col_resource_id,
- int row_resource_id,
- const gfx::Font& font);
+UI_API int GetLocalizedContentsWidthForFont(int col_resource_id,
+ const gfx::Font& font);
+UI_API int GetLocalizedContentsHeightForFont(int row_resource_id,
+ const gfx::Font& font);
+UI_API gfx::Size GetLocalizedContentsSizeForFont(int col_resource_id,
+ int row_resource_id,
+ const gfx::Font& font);
} // namespace ui
diff --git a/ui/base/l10n/l10n_util.h b/ui/base/l10n/l10n_util.h
index 4eca6fc..8c7cabc 100644
--- a/ui/base/l10n/l10n_util.h
+++ b/ui/base/l10n/l10n_util.h
@@ -14,6 +14,7 @@
#include "base/string16.h"
#include "base/string_util.h"
+#include "ui/ui_api.h"
#if defined(OS_MACOSX)
#include "ui/base/l10n/l10n_util_mac.h"
@@ -30,7 +31,7 @@ namespace l10n_util {
// as |pref_locale|), finally, we fall back on the system locale. We only return
// a value if there's a corresponding resource DLL for the locale. Otherwise,
// we fall back to en-us.
-std::string GetApplicationLocale(const std::string& pref_locale);
+UI_API std::string GetApplicationLocale(const std::string& pref_locale);
// Given a locale code, return true if the OS is capable of supporting it.
// For instance, Oriya is not well supported on Windows XP and we return
@@ -46,18 +47,18 @@ bool IsLocaleSupportedByOS(const std::string& locale);
// in the UI thread.
// If |is_for_ui| is true, U+200F is appended so that it can be
// rendered properly in a RTL Chrome.
-string16 GetDisplayNameForLocale(const std::string& locale,
- const std::string& display_locale,
- bool is_for_ui);
+UI_API string16 GetDisplayNameForLocale(const std::string& locale,
+ const std::string& display_locale,
+ bool is_for_ui);
// Converts all - into _, to be consistent with ICU and file system names.
-std::string NormalizeLocale(const std::string& locale);
+UI_API std::string NormalizeLocale(const std::string& locale);
// Produce a vector of parent locales for given locale.
// It includes the current locale in the result.
// sr_Cyrl_RS generates sr_Cyrl_RS, sr_Cyrl and sr.
-void GetParentLocales(const std::string& current_locale,
- std::vector<std::string>* parent_locales);
+UI_API void GetParentLocales(const std::string& current_locale,
+ std::vector<std::string>* parent_locales);
// Checks if a string is plausibly a syntactically-valid locale string,
// for cases where we want the valid input to be a locale string such as
@@ -67,67 +68,67 @@ void GetParentLocales(const std::string& current_locale,
// accepted, but 'z', 'German', 'en-$1', or 'abcd-1234' should not.
// Case-insensitive. Based on BCP 47, see:
// http://unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers
-bool IsValidLocaleSyntax(const std::string& locale);
+UI_API bool IsValidLocaleSyntax(const std::string& locale);
//
// Mac Note: See l10n_util_mac.h for some NSString versions and other support.
//
// Pulls resource string from the string bundle and returns it.
-std::string GetStringUTF8(int message_id);
-string16 GetStringUTF16(int message_id);
+UI_API std::string GetStringUTF8(int message_id);
+UI_API string16 GetStringUTF16(int message_id);
// Get a resource string and replace $1-$2-$3 with |a| and |b|
// respectively. Additionally, $$ is replaced by $.
-string16 GetStringFUTF16(int message_id,
- const string16& a);
-string16 GetStringFUTF16(int message_id,
- const string16& a,
- const string16& b);
-string16 GetStringFUTF16(int message_id,
- const string16& a,
- const string16& b,
- const string16& c);
-string16 GetStringFUTF16(int message_id,
- const string16& a,
- const string16& b,
- const string16& c,
- const string16& d);
-string16 GetStringFUTF16(int message_id,
- const string16& a,
- const string16& b,
- const string16& c,
- const string16& d,
- const string16& e);
-std::string GetStringFUTF8(int message_id,
- const string16& a);
-std::string GetStringFUTF8(int message_id,
- const string16& a,
- const string16& b);
-std::string GetStringFUTF8(int message_id,
- const string16& a,
- const string16& b,
- const string16& c);
-std::string GetStringFUTF8(int message_id,
- const string16& a,
- const string16& b,
- const string16& c,
- const string16& d);
+UI_API string16 GetStringFUTF16(int message_id,
+ const string16& a);
+UI_API string16 GetStringFUTF16(int message_id,
+ const string16& a,
+ const string16& b);
+UI_API string16 GetStringFUTF16(int message_id,
+ const string16& a,
+ const string16& b,
+ const string16& c);
+UI_API string16 GetStringFUTF16(int message_id,
+ const string16& a,
+ const string16& b,
+ const string16& c,
+ const string16& d);
+UI_API string16 GetStringFUTF16(int message_id,
+ const string16& a,
+ const string16& b,
+ const string16& c,
+ const string16& d,
+ const string16& e);
+UI_API std::string GetStringFUTF8(int message_id,
+ const string16& a);
+UI_API std::string GetStringFUTF8(int message_id,
+ const string16& a,
+ const string16& b);
+UI_API std::string GetStringFUTF8(int message_id,
+ const string16& a,
+ const string16& b,
+ const string16& c);
+UI_API std::string GetStringFUTF8(int message_id,
+ const string16& a,
+ const string16& b,
+ const string16& c,
+ const string16& d);
// Variants that return the offset(s) of the replaced parameters. The
// vector based version returns offsets ordered by parameter. For example if
// invoked with a and b offsets[0] gives the offset for a and offsets[1] the
// offset of b regardless of where the parameters end up in the string.
-string16 GetStringFUTF16(int message_id,
- const string16& a,
- size_t* offset);
-string16 GetStringFUTF16(int message_id,
- const string16& a,
- const string16& b,
- std::vector<size_t>* offsets);
+UI_API string16 GetStringFUTF16(int message_id,
+ const string16& a,
+ size_t* offset);
+UI_API string16 GetStringFUTF16(int message_id,
+ const string16& a,
+ const string16& b,
+ std::vector<size_t>* offsets);
// Convenience functions to get a string with a single number as a parameter.
-string16 GetStringFUTF16Int(int message_id, int a);
+UI_API string16 GetStringFUTF16Int(int message_id, int a);
string16 GetStringFUTF16Int(int message_id, int64 a);
// Truncates the string to length characters. This breaks the string at
@@ -135,19 +136,20 @@ string16 GetStringFUTF16Int(int message_id, int64 a);
// character (unicode character 0x2026) to render ...
// The supplied string is returned if the string has length characters or
// less.
-string16 TruncateString(const string16& string, size_t length);
+UI_API string16 TruncateString(const string16& string, size_t length);
// In place sorting of string16 strings using collation rules for |locale|.
-void SortStrings16(const std::string& locale,
- std::vector<string16>* strings);
+UI_API void SortStrings16(const std::string& locale,
+ std::vector<string16>* strings);
// Returns a vector of available locale codes. E.g., a vector containing
// en-US, es, fr, fi, pt-PT, pt-BR, etc.
-const std::vector<std::string>& GetAvailableLocales();
+UI_API const std::vector<std::string>& GetAvailableLocales();
// Returns a vector of locale codes usable for accept-languages.
-void GetAcceptLanguagesForLocale(const std::string& display_locale,
- std::vector<std::string>* locale_codes);
+UI_API void GetAcceptLanguagesForLocale(
+ const std::string& display_locale,
+ std::vector<std::string>* locale_codes);
} // namespace l10n_util
diff --git a/ui/base/l10n/l10n_util_collator.h b/ui/base/l10n/l10n_util_collator.h
index 8610ca2..11afe78 100644
--- a/ui/base/l10n/l10n_util_collator.h
+++ b/ui/base/l10n/l10n_util_collator.h
@@ -13,14 +13,16 @@
#include "base/memory/scoped_ptr.h"
#include "base/utf_string_conversions.h"
+#include "ui/ui_api.h"
#include "unicode/coll.h"
namespace l10n_util {
// Compares the two strings using the specified collator.
-UCollationResult CompareString16WithCollator(const icu::Collator* collator,
- const string16& lhs,
- const string16& rhs);
+UI_API UCollationResult CompareString16WithCollator(
+ const icu::Collator* collator,
+ const string16& lhs,
+ const string16& rhs);
// Used by SortStringsUsingMethod. Invokes a method on the objects passed to
// operator (), comparing the string results using a collator.
@@ -110,7 +112,7 @@ class StringComparator : public std::binary_function<const Element&,
};
// Specialization of operator() method for string16 version.
-template <>
+template <> UI_API
bool StringComparator<string16>::operator()(const string16& lhs,
const string16& rhs);
diff --git a/ui/base/l10n/l10n_util_win.h b/ui/base/l10n/l10n_util_win.h
index 52a4ecc..7e61719 100644
--- a/ui/base/l10n/l10n_util_win.h
+++ b/ui/base/l10n/l10n_util_win.h
@@ -10,6 +10,8 @@
#include <string>
#include <vector>
+#include "ui/ui_api.h"
+
namespace l10n_util {
// Returns the locale-dependent extended window styles.
@@ -17,17 +19,17 @@ namespace l10n_util {
// (e.g. WS_EX_LAYOUTRTL, WS_EX_RTLREADING, etc.) when creating a window.
// Callers should OR this value into their extended style value when creating
// a window.
-int GetExtendedStyles();
+UI_API int GetExtendedStyles();
// TODO(xji):
// This is a temporary name, it will eventually replace GetExtendedStyles
-int GetExtendedTooltipStyles();
+UI_API int GetExtendedTooltipStyles();
// Give an HWND, this function sets the WS_EX_LAYOUTRTL extended style for the
// underlying window. When this style is set, the UI for the window is going to
// be mirrored. This is generally done for the UI of right-to-left languages
// such as Hebrew.
-void HWNDSetRTLLayout(HWND hwnd);
+UI_API void HWNDSetRTLLayout(HWND hwnd);
// See http://blogs.msdn.com/oldnewthing/archive/2005/09/15/467598.aspx
// and http://blogs.msdn.com/oldnewthing/archive/2006/06/26/647365.aspx
@@ -37,22 +39,22 @@ void HWNDSetRTLLayout(HWND hwnd);
// to use in the UI of the current UI (e.g. Malayalam, Bengali). If
// override_font_family and font_size_scaler are not null, they'll be
// filled with the font family name and the size scaler.
-bool NeedOverrideDefaultUIFont(std::wstring* override_font_family,
- double* font_size_scaler);
+UI_API bool NeedOverrideDefaultUIFont(std::wstring* override_font_family,
+ double* font_size_scaler);
// If the default UI font stored in |logfont| is not suitable, its family
// and size are replaced with those stored in the per-locale resource.
-void AdjustUIFont(LOGFONT* logfont);
+UI_API void AdjustUIFont(LOGFONT* logfont);
// If the font for a given window (pointed to by HWND) is not suitable for the
// UI in the current UI langauge, its family and size are replaced with those
// stored in the per-locale resource.
-void AdjustUIFontForWindow(HWND hwnd);
+UI_API void AdjustUIFontForWindow(HWND hwnd);
// Allow processes to override the configured locale with the user's Windows UI
// languages. This function should generally be called once early in
// Application startup.
-void OverrideLocaleWithUILanguageList();
+UI_API void OverrideLocaleWithUILanguageList();
// Retrieve the locale override, or an empty vector if the locale has not been
// or failed to be overridden.