15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This file contains utility functions for dealing with localized 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// content. 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef UI_BASE_L10N_L10N_UTIL_H_ 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define UI_BASE_L10N_L10N_UTIL_H_ 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string> 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <vector> 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 145e3f23d412006dc4db4e659864679f29341e113fTorne (Richard Coles)#include "base/strings/string16.h" 155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ui/base/ui_base_export.h" 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(OS_MACOSX) 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/base/l10n/l10n_util_mac.h" 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // OS_MACOSX 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace l10n_util { 225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 23c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch// The same as base::i18n::GetCanonicalLocale(const char*), but takes 24c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch// std::string as an argument. 25c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen MurdochUI_BASE_EXPORT std::string GetCanonicalLocale(const std::string& locale); 26c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch 2703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// Takes normalized locale as |locale|. Returns language part (before '-'). 2803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)UI_BASE_EXPORT std::string GetLanguage(const std::string& locale); 2903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 3068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)// This method translates a generic locale name to one of the locally defined 3168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)// ones. This method returns true if it succeeds. 325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT bool CheckAndResolveLocale(const std::string& locale, 335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) std::string* resolved_locale); 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This method is responsible for determining the locale as defined below. In 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// nearly all cases you shouldn't call this, rather use GetApplicationLocale 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// defined on browser_process. 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Returns the locale used by the Application. First we use the value from the 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// command line (--lang), second we try the value in the prefs file (passed in 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// as |pref_locale|), finally, we fall back on the system locale. We only return 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// a value if there's a corresponding resource DLL for the locale. Otherwise, 4303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// we fall back to en-us. |set_icu_locale| determines whether the resulting 4403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// locale is set as the default ICU locale before returning it. 4503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)UI_BASE_EXPORT std::string GetApplicationLocale(const std::string& pref_locale, 4603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) bool set_icu_locale); 4703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 4803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// Convenience version of GetApplicationLocale() that sets the resulting locale 4903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// as the default ICU locale before returning it. 505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT std::string GetApplicationLocale(const std::string& pref_locale); 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 527d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// Returns true if a display name for |locale| is available in the locale 537d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// |display_locale|. 545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT bool IsLocaleNameTranslated(const char* locale, 555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const std::string& display_locale); 567d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Given a locale code, return true if the OS is capable of supporting it. 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// For instance, Oriya is not well supported on Windows XP and we return 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// false for "or". 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)bool IsLocaleSupportedByOS(const std::string& locale); 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This method returns the display name of the locale code in |display_locale|. 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// For example, for |locale| = "fr" and |display_locale| = "en", 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// it returns "French". To get the display name of 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// |locale| in the UI language of Chrome, |display_locale| can be 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// set to the return value of g_browser_process->GetApplicationLocale() 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// in the UI thread. 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// If |is_for_ui| is true, U+200F is appended so that it can be 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// rendered properly in a RTL Chrome. 715d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT base::string16 GetDisplayNameForLocale( 72a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const std::string& locale, 73a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const std::string& display_locale, 74a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) bool is_for_ui); 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Returns the display name of the |country_code| in |display_locale|. 775d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT base::string16 GetDisplayNameForCountry( 78a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const std::string& country_code, 79a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const std::string& display_locale); 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Converts all - into _, to be consistent with ICU and file system names. 825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT std::string NormalizeLocale(const std::string& locale); 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Produce a vector of parent locales for given locale. 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// It includes the current locale in the result. 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// sr_Cyrl_RS generates sr_Cyrl_RS, sr_Cyrl and sr. 875d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT void GetParentLocales(const std::string& current_locale, 885d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) std::vector<std::string>* parent_locales); 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Checks if a string is plausibly a syntactically-valid locale string, 915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// for cases where we want the valid input to be a locale string such as 925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 'en', 'pt-BR', 'fil', 'es-419', 'zh-Hans-CN', 'i-klingon' or 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 'de_DE@collation=phonebook', but we don't want to limit it to 945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// locales that Chrome actually knows about, so 'xx-YY' should be 955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// accepted, but 'z', 'German', 'en-$1', or 'abcd-1234' should not. 965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Case-insensitive. Based on BCP 47, see: 975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// http://unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers 985d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT bool IsValidLocaleSyntax(const std::string& locale); 995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Mac Note: See l10n_util_mac.h for some NSString versions and other support. 1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Pulls resource string from the string bundle and returns it. 1055d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT std::string GetStringUTF8(int message_id); 1065d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT base::string16 GetStringUTF16(int message_id); 1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1081e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Get a resource string and replace $i with replacements[i] for all 1091e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// i < replacements.size(). Additionally, $$ is replaced by $. 1101e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// If non-NULL |offsets| will be replaced with the start points of the replaced 1111e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// strings. 1125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT base::string16 GetStringFUTF16( 113a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) int message_id, 114a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const std::vector<base::string16>& replacements, 115a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) std::vector<size_t>* offsets); 1161e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 1171e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Convenience wrappers for the above. 1185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT base::string16 GetStringFUTF16(int message_id, 1195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& a); 1205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT base::string16 GetStringFUTF16(int message_id, 1215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& a, 1225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& b); 1235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT base::string16 GetStringFUTF16(int message_id, 1245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& a, 1255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& b, 1265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& c); 1275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT base::string16 GetStringFUTF16(int message_id, 1285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& a, 1295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& b, 1305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& c, 1315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& d); 1325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT base::string16 GetStringFUTF16(int message_id, 1335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& a, 1345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& b, 1355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& c, 1365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& d, 1375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& e); 1385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT std::string GetStringFUTF8(int message_id, 1395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& a); 1405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT std::string GetStringFUTF8(int message_id, 1415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& a, 1425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& b); 1435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT std::string GetStringFUTF8(int message_id, 1445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& a, 1455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& b, 1465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& c); 1475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT std::string GetStringFUTF8(int message_id, 1485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& a, 1495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& b, 1505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& c, 1515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& d); 1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Variants that return the offset(s) of the replaced parameters. The 1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// vector based version returns offsets ordered by parameter. For example if 1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// invoked with a and b offsets[0] gives the offset for a and offsets[1] the 1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// offset of b regardless of where the parameters end up in the string. 1575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT base::string16 GetStringFUTF16(int message_id, 1585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& a, 1595d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) size_t* offset); 1605d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT base::string16 GetStringFUTF16(int message_id, 1615d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& a, 1625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& b, 1635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) std::vector<size_t>* offsets); 1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Convenience functions to get a string with a single number as a parameter. 1665d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT base::string16 GetStringFUTF16Int(int message_id, int a); 167a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)base::string16 GetStringFUTF16Int(int message_id, int64 a); 1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 16968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)// Get a resource string using |number| to decide which of |message_ids| should 17068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)// be used. |message_ids| must be size 6 and in order: default, singular, zero, 17168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)// two, few, many. 1725d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT base::string16 GetPluralStringFUTF16( 1735d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const std::vector<int>& message_ids, 1745d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int number); 1755d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT std::string GetPluralStringFUTF8( 176a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const std::vector<int>& message_ids, 177a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) int number); 17868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) 1795d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// In place sorting of base::string16 strings using collation rules for 1805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// |locale|. 1815d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT void SortStrings16(const std::string& locale, 1825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) std::vector<base::string16>* strings); 1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Returns a vector of available locale codes. E.g., a vector containing 1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// en-US, es, fr, fi, pt-PT, pt-BR, etc. 1865d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT const std::vector<std::string>& GetAvailableLocales(); 1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Returns a vector of locale codes usable for accept-languages. 1895d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT void GetAcceptLanguagesForLocale( 1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const std::string& display_locale, 1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) std::vector<std::string>* locale_codes); 1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Returns the preferred size of the contents view of a window based on 1942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// designer given constraints which might dependent on the language used. 1955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT int GetLocalizedContentsWidthInPixels(int pixel_resource_id); 1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 19703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)UI_BASE_EXPORT const char* const* GetAcceptLanguageListForTesting(); 19803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 19903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)UI_BASE_EXPORT size_t GetAcceptLanguageListSizeForTesting(); 20003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace l10n_util 2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // UI_BASE_L10N_L10N_UTIL_H_ 204