Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / base / l10n / l10n_util_mac.h
blobc1ef16389fda333b579a7494f7251c78796f1c83
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_BASE_L10N_L10N_UTIL_MAC_H_
6 #define UI_BASE_L10N_L10N_UTIL_MAC_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/strings/string16.h"
13 #include "ui/base/ui_base_export.h"
15 #ifdef __OBJC__
16 @class NSString;
17 #else
18 class NSString;
19 #endif
21 namespace l10n_util {
23 // Remove the Windows-style accelerator marker (for labels, menuitems, etc.)
24 // and change "..." into an ellipsis.
25 // Returns the result in an autoreleased NSString.
26 UI_BASE_EXPORT NSString* FixUpWindowsStyleLabel(const base::string16& label);
28 // Pulls resource string from the string bundle and returns it.
29 UI_BASE_EXPORT NSString* GetNSString(int message_id);
31 // Get a resource string and replace $1-$2-$3 with |a| and |b|
32 // respectively. Additionally, $$ is replaced by $.
33 UI_BASE_EXPORT NSString* GetNSStringF(int message_id, const base::string16& a);
34 UI_BASE_EXPORT NSString* GetNSStringF(int message_id,
35 const base::string16& a,
36 const base::string16& b);
37 UI_BASE_EXPORT NSString* GetNSStringF(int message_id,
38 const base::string16& a,
39 const base::string16& b,
40 const base::string16& c);
41 UI_BASE_EXPORT NSString* GetNSStringF(int message_id,
42 const base::string16& a,
43 const base::string16& b,
44 const base::string16& c,
45 const base::string16& d);
47 // Variants that return the offset(s) of the replaced parameters. (See
48 // app/l10n_util.h for more details.)
49 UI_BASE_EXPORT NSString* GetNSStringF(int message_id,
50 const base::string16& a,
51 const base::string16& b,
52 std::vector<size_t>* offsets);
54 // Same as GetNSString, but runs the result through FixUpWindowsStyleLabel
55 // before returning it.
56 UI_BASE_EXPORT NSString* GetNSStringWithFixup(int message_id);
58 // Same as GetNSStringF, but runs the result through FixUpWindowsStyleLabel
59 // before returning it.
60 UI_BASE_EXPORT NSString* GetNSStringFWithFixup(int message_id,
61 const base::string16& a);
62 UI_BASE_EXPORT NSString* GetNSStringFWithFixup(int message_id,
63 const base::string16& a,
64 const base::string16& b);
65 UI_BASE_EXPORT NSString* GetNSStringFWithFixup(int message_id,
66 const base::string16& a,
67 const base::string16& b,
68 const base::string16& c);
69 UI_BASE_EXPORT NSString* GetNSStringFWithFixup(int message_id,
70 const base::string16& a,
71 const base::string16& b,
72 const base::string16& c,
73 const base::string16& d);
75 // Get a resource string using |number| with a locale-specific plural rule.
76 // |message_id| points to a message in the ICU syntax.
77 // See http://userguide.icu-project.org/formatparse/messages and
78 // go/plurals (Google internal).
79 UI_BASE_EXPORT NSString* GetPluralNSStringF(int message_id, int number);
81 // Support the override of the locale with the value from Cocoa.
82 UI_BASE_EXPORT void OverrideLocaleWithCocoaLocale();
83 UI_BASE_EXPORT const std::string& GetLocaleOverride();
85 } // namespace l10n_util
87 #endif // UI_BASE_L10N_L10N_UTIL_MAC_H_