| 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" | |
| 9 #include "base/string16.h" | |
| 10 #import "third_party/GTM/AppKit/GTMUILocalizer.h" | 8 #import "third_party/GTM/AppKit/GTMUILocalizer.h" |
| 11 | 9 |
| 12 @class NSString; | 10 @class NSString; |
| 13 | 11 |
| 14 namespace ui_localizer { | |
| 15 | |
| 16 struct ResourceMap { | |
| 17 const char* const name; | |
| 18 unsigned int label_id; | |
| 19 unsigned int label_arg_id; | |
| 20 }; | |
| 21 | |
| 22 NSString* LocalizedStringForKeyFromMapList(NSString* key, | |
| 23 const ResourceMap* map_list, | |
| 24 size_t map_list_len); | |
| 25 | |
| 26 } // namespace ui_localizer | |
| 27 | |
| 28 // A base class for generated localizers. | 12 // A base class for generated localizers. |
| 29 // | 13 // |
| 30 // To use this, have the build run generate_localizer on your xib file (see | 14 // To use this, include your xib file in the list generate_localizer scans (see |
| 31 // chrome.gyp). Then add an instance of the generated subclass to the xib. | 15 // chrome.gyp). Then add an instance of ChromeUILocalizer to the xib. |
| 32 // Connect the owner_ outlet of the instance to the "File's Owner" of the xib. | 16 // Connect the owner_ outlet of the instance to the "File's Owner" of the xib. |
| 33 // It expects the owner_ outlet to be an instance or subclass of | 17 // It expects the owner_ outlet to be an instance or subclass of |
| 34 // NSWindowController or NSViewController. It will then localize any items in | 18 // NSWindowController or NSViewController. It will then localize any items in |
| 35 // the NSWindowController's window and subviews, or the NSViewController's view | 19 // the NSWindowController's window and subviews, or the NSViewController's view |
| 36 // and subviews, when awakeFromNib is called on the instance. You can | 20 // and subviews, when awakeFromNib is called on the instance. You can |
| 37 // optionally hook up otherObjectToLocalize_ and yetAnotherObjectToLocalize_ and | 21 // optionally hook up otherObjectToLocalize_ and yetAnotherObjectToLocalize_ and |
| 38 // those will also be localized. Strings in the xib that you want localized must | 22 // those will also be localized. Strings in the xib that you want localized must |
| 39 // start with ^IDS. The value must be a valid resource constant. | 23 // start with ^IDS. The value must be a valid resource constant. |
| 40 // Things that will be localized are: | 24 // Things that will be localized are: |
| 41 // - Titles and altTitles (for menus, buttons, windows, menuitems, -tabViewItem) | 25 // - Titles and altTitles (for menus, buttons, windows, menuitems, -tabViewItem) |
| 42 // - -stringValue (for labels) | 26 // - -stringValue (for labels) |
| 43 // - tooltips | 27 // - tooltips |
| 44 // - accessibility help | 28 // - accessibility help |
| 45 // - accessibility descriptions | 29 // - accessibility descriptions |
| 46 // - menus | 30 // - menus |
| 47 @interface ChromeUILocalizer : GTMUILocalizer | 31 @interface ChromeUILocalizer : GTMUILocalizer |
| 48 @end | 32 @end |
| 49 | 33 |
| 50 #endif // CHROME_BROWSER_COCOA_UI_LOCALIZER_H_ | 34 #endif // CHROME_BROWSER_COCOA_UI_LOCALIZER_H_ |
| OLD | NEW |