1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 09:13:06 +00:00

make the buttons in the URL window localizable

This commit is contained in:
Mitchell Livingston 2011-02-11 03:05:57 +00:00
parent 9e4fa7a6d2
commit 32a54d1029
3 changed files with 49 additions and 6 deletions

View file

@ -227,6 +227,14 @@
</object> </object>
<int key="connectionID">21</int> <int key="connectionID">21</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">fCancelButton</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="9691643"/>
</object>
<int key="connectionID">22</int>
</object>
</object> </object>
<object class="IBMutableOrderedSet" key="objectRecords"> <object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects"> <object class="NSArray" key="orderedObjects">
@ -274,8 +282,8 @@
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="459786882"/> <reference ref="459786882"/>
<reference ref="9691643"/> <reference ref="9691643"/>
<reference ref="794131740"/>
<reference ref="1066788818"/> <reference ref="1066788818"/>
<reference ref="794131740"/>
</object> </object>
<reference key="parent" ref="461713252"/> <reference key="parent" ref="461713252"/>
</object> </object>
@ -360,6 +368,7 @@
<string>6.IBPluginDependency</string> <string>6.IBPluginDependency</string>
<string>6.ImportedFromIB2</string> <string>6.ImportedFromIB2</string>
<string>7.IBPluginDependency</string> <string>7.IBPluginDependency</string>
<string>7.IBViewBoundsToFrameTransform</string>
<string>7.ImportedFromIB2</string> <string>7.ImportedFromIB2</string>
<string>8.IBPluginDependency</string> <string>8.IBPluginDependency</string>
<string>8.ImportedFromIB2</string> <string>8.ImportedFromIB2</string>
@ -371,9 +380,9 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{535, 596}, {400, 177}}</string> <string>{{594, 582}, {400, 177}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{535, 596}, {400, 177}}</string> <string>{{594, 582}, {400, 177}}</string>
<integer value="1"/> <integer value="1"/>
<integer value="0"/> <integer value="0"/>
<integer value="1"/> <integer value="1"/>
@ -386,6 +395,9 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/> <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABDmAAAwigAAA</bytes>
</object>
<integer value="1"/> <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/> <integer value="1"/>
@ -408,7 +420,7 @@
</object> </object>
</object> </object>
<nil key="sourceID"/> <nil key="sourceID"/>
<int key="maxID">21</int> <int key="maxID">22</int>
</object> </object>
<object class="IBClassDescriber" key="IBDocument.Classes"> <object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions"> <object class="NSMutableArray" key="referencedPartialClassDescriptions">
@ -480,12 +492,14 @@
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys"> <object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<string>fCancelButton</string>
<string>fLabelField</string> <string>fLabelField</string>
<string>fOpenButton</string> <string>fOpenButton</string>
<string>fTextField</string> <string>fTextField</string>
</object> </object>
<object class="NSMutableArray" key="dict.values"> <object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<string>NSButton</string>
<string>NSTextField</string> <string>NSTextField</string>
<string>NSButton</string> <string>NSButton</string>
<string>NSTextField</string> <string>NSTextField</string>
@ -495,12 +509,17 @@
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys"> <object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<string>fCancelButton</string>
<string>fLabelField</string> <string>fLabelField</string>
<string>fOpenButton</string> <string>fOpenButton</string>
<string>fTextField</string> <string>fTextField</string>
</object> </object>
<object class="NSMutableArray" key="dict.values"> <object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">fCancelButton</string>
<string key="candidateClassName">NSButton</string>
</object>
<object class="IBToOneOutletInfo"> <object class="IBToOneOutletInfo">
<string key="name">fLabelField</string> <string key="name">fLabelField</string>
<string key="candidateClassName">NSTextField</string> <string key="candidateClassName">NSTextField</string>

View file

@ -30,7 +30,7 @@
{ {
IBOutlet NSTextField * fLabelField; IBOutlet NSTextField * fLabelField;
IBOutlet NSTextField * fTextField; IBOutlet NSTextField * fTextField;
IBOutlet NSButton * fOpenButton; IBOutlet NSButton * fOpenButton, * fCancelButton;
Controller * fController; Controller * fController;
} }

View file

@ -45,7 +45,31 @@ NSString * urlString = @"";
[fTextField setStringValue: urlString]; [fTextField setStringValue: urlString];
[fTextField selectText: self]; [fTextField selectText: self];
[fOpenButton setEnabled: ![urlString isEqualToString: @""]]; [fOpenButton setTitle: NSLocalizedString(@"Open", "URL sheet button")];
[fCancelButton setTitle: NSLocalizedString(@"Cancel", "URL sheet button")];
[fOpenButton sizeToFit];
[fCancelButton sizeToFit];
//size the two buttons the same
NSRect openFrame = [fOpenButton frame];
openFrame.size.width += 10.0;
NSRect cancelFrame = [fCancelButton frame];
cancelFrame.size.width += 10.0;
if (NSWidth(openFrame) > NSWidth(cancelFrame))
cancelFrame.size.width = NSWidth(openFrame);
else
openFrame.size.width = NSWidth(cancelFrame);
openFrame.origin.x = NSWidth([[self window] frame]) - NSWidth(openFrame) - 20.0 + 6.0; //I don't know why the extra 6.0 is needed
[fOpenButton setFrame: openFrame];
cancelFrame.origin.x = NSMinX(openFrame) - NSWidth(cancelFrame);
[fCancelButton setFrame: cancelFrame];
} }
- (IBAction) beginSheetForWindow: (NSWindow *) window - (IBAction) beginSheetForWindow: (NSWindow *) window