OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_COCOA_UI_LOCALIZER_H_ | 5 #ifndef CHROME_BROWSER_COCOA_UI_LOCALIZER_H_ |
6 #define CHROME_BROWSER_COCOA_UI_LOCALIZER_H_ | 6 #define CHROME_BROWSER_COCOA_UI_LOCALIZER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #import "third_party/GTM/AppKit/GTMUILocalizer.h" |
10 | 11 |
11 @class NSString; | 12 @class NSString; |
12 | 13 |
13 namespace ui_localizer { | 14 namespace ui_localizer { |
14 | 15 |
15 // Remove the Windows-style accelerator marker and change "..." into an | 16 // Remove the Windows-style accelerator marker and change "..." into an |
16 // ellipsis. Returns the result in an autoreleased NSString. | 17 // ellipsis. Returns the result in an autoreleased NSString. |
17 NSString* FixUpWindowsStyleLabel(const string16& label); | 18 NSString* FixUpWindowsStyleLabel(const string16& label); |
18 | 19 |
19 struct ResourceMap { | 20 struct ResourceMap { |
20 const char* const name; | 21 const char* const name; |
21 unsigned int label_id; | 22 unsigned int label_id; |
22 unsigned int label_arg_id; | 23 unsigned int label_arg_id; |
23 }; | 24 }; |
24 | 25 |
25 NSString* LocalizedStringForKeyFromMapList(NSString* key, | 26 NSString* LocalizedStringForKeyFromMapList(NSString* key, |
26 const ResourceMap* map_list, | 27 const ResourceMap* map_list, |
27 size_t map_list_len); | 28 size_t map_list_len); |
28 | 29 |
29 } // namespace ui_localizer | 30 } // namespace ui_localizer |
30 | 31 |
| 32 // A base class for generated localizers. |
| 33 // |
| 34 // To use this, have the build run generate_localizer on your xib file (see |
| 35 // chrome.gyp). Then add an instance of the generated subclass to the xib. |
| 36 // Connect the owner_ outlet of the instance to the "File's Owner" of the xib. |
| 37 // It expects the owner_ outlet to be an instance or subclass of |
| 38 // NSWindowController or NSViewController. It will then localize any items in |
| 39 // the NSWindowController's window and subviews, or the NSViewController's view |
| 40 // and subviews, when awakeFromNib is called on the instance. You can |
| 41 // optionally hook up otherObjectToLocalize_ and yetAnotherObjectToLocalize_ and |
| 42 // those will also be localized. Strings in the xib that you want localized must |
| 43 // start with ^IDS. The value must be a valid resource constant. |
| 44 // Things that will be localized are: |
| 45 // - Titles and altTitles (for menus, buttons, windows, menuitems, -tabViewItem) |
| 46 // - -stringValue (for labels) |
| 47 // - tooltips |
| 48 // - accessibility help |
| 49 // - accessibility descriptions |
| 50 // - menus |
| 51 @interface ChromeUILocalizer : GTMUILocalizer |
| 52 @end |
| 53 |
31 #endif // CHROME_BROWSER_COCOA_UI_LOCALIZER_H_ | 54 #endif // CHROME_BROWSER_COCOA_UI_LOCALIZER_H_ |
OLD | NEW |