Added GSBaseLocalizedString() in NSUndoManager

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32160 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Germán Arias 2011-02-14 18:55:57 +00:00
parent 7fa110e2c5
commit c5720109a0
3 changed files with 49 additions and 14 deletions

View file

@ -1,3 +1,9 @@
2011-02-14 German Arias <german@xelalug.org>
* Resources/Spanish.lproj/Localizable.strings: Added localized strings
for undo/redo.
* Source/NSUndoManager.m: Added GSBaseLocalizedString() function.
2011-02-14 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSFileManager.m:

View file

@ -32,3 +32,14 @@ NSJapaneseEUCStringEncoding = "Japon\U00e9s EUC";
NSShiftJISStringEncoding = "Japon\U00e9s Shift-JIS";
NSISO2022JPStringEncoding = "Japon\U00e9s JIS (7 bits) (ISO 2022)";
NSGB2312StringEncoding = "Chino Simplificado GB2312";
/* Menu items for NSUndoManager */
/* File: ../Source/NSUndoManager.m:718 */
Redo = Rehacer;
/* File: ../Source/NSUndoManager.m:723 */
"Redo %@" = "Rehacer %@";
/* File: ../Source/NSUndoManager.m:999 */
Undo = Deshacer;
/* File: ../Source/NSUndoManager.m:1004 */
"Undo %@" = "Deshacer %@";

View file

@ -27,12 +27,38 @@
#import "common.h"
#define EXPOSE_NSUndoManager_IVARS 1
#import "Foundation/NSArray.h"
#import "Foundation/NSBundle.h"
#import "Foundation/NSNotification.h"
#import "Foundation/NSInvocation.h"
#import "Foundation/NSException.h"
#import "Foundation/NSRunLoop.h"
#import "Foundation/NSUndoManager.h"
/*
* Localize a message of the gnustep-base library.
*/
static inline NSString *GSBaseLocalizedString (NSString *key)
{
static NSBundle *baseBundle = nil;
if (!baseBundle)
{
/* Create the base bundle we use to localize messages. */
baseBundle = [NSBundle bundleForLibrary: @"gnustep-base"
version: OBJC_STRINGIFY(GNUSTEP_BASE_MAJOR_VERSION.GNUSTEP_BASE_MINOR_VERSION)];
RETAIN(baseBundle);
}
if (baseBundle != nil)
{
return [baseBundle localizedStringForKey: key value: @"" table: nil];
}
else
{
return key;
}
}
/*
* Private class for grouping undo/redo actions.
@ -685,20 +711,16 @@
*/
- (NSString*) redoMenuTitleForUndoActionName: (NSString*)actionName
{
/*
* FIXME: The terms @"Redo" and @"Redo %@" should be localized.
* Possibly with the introduction of GSBaseLocalizedString() private
* the the library.
*/
if (actionName)
{
if ([actionName isEqual: @""])
{
return @"Redo";
return GSBaseLocalizedString(@"Redo");
}
else
{
return [NSString stringWithFormat: @"Redo %@", actionName];
return [NSString stringWithFormat:
GSBaseLocalizedString(@"Redo %@"), actionName];
}
}
return actionName;
@ -970,20 +992,16 @@
*/
- (NSString*) undoMenuTitleForUndoActionName: (NSString*)actionName
{
/*
* FIXME: The terms @"Undo" and @"Undo %@" should be localized.
* Possibly with the introduction of GSBaseLocalizedString() private
* the the library.
*/
if (actionName)
{
if ([actionName isEqual: @""])
{
return @"Undo";
return GSBaseLocalizedString(@"Undo");
}
else
{
return [NSString stringWithFormat: @"Undo %@", actionName];
return [NSString stringWithFormat:
GSBaseLocalizedString(@"Undo %@"), actionName];
}
}
return actionName;