mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-20 20:26:42 +00:00
use the _() macro for localisation within base
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32173 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e141e8aada
commit
21e22ecfb0
17 changed files with 45 additions and 60 deletions
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
|||
2011-02-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSLocale.m:
|
||||
* Source/NSTimeZone.m:
|
||||
* Source/NSBundle.m:
|
||||
* Source/NSProcessInfo.m:
|
||||
* Source/NSUndoManager.m:
|
||||
* Source/NSFileHandle.m:
|
||||
* Source/NSSortDescriptor.m:
|
||||
* Source/NSFileManager.m:
|
||||
* Source/common.h:
|
||||
* Source/externs.m:
|
||||
* Source/NSException.m:
|
||||
* Source/NSString.m:
|
||||
* Source/Additions/Unicode.m:
|
||||
* Source/Additions/GSXML.m:
|
||||
* Source/NSLocale.m:
|
||||
* Source/NSTask.m:
|
||||
As suggested by Wolfgang, change the _() macro for localization when
|
||||
used inside base to use the base library bundle rather than the main
|
||||
bundle.
|
||||
|
||||
2011-02-14 Stefan Bidigaray <stefanbidi@gmail.com>
|
||||
|
||||
* Headers/Foundation/NSDateFormatter.m:
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#import "GNUstepBase/GSMime.h"
|
||||
#import "GNUstepBase/GSXML.h"
|
||||
#import "Foundation/NSArray.h"
|
||||
#import "Foundation/NSBundle.h"
|
||||
#import "Foundation/NSCalendarDate.h"
|
||||
#import "Foundation/NSCharacterSet.h"
|
||||
#import "Foundation/NSData.h"
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#import "common.h"
|
||||
#if !defined(NeXT_Foundation_LIBRARY)
|
||||
#import "Foundation/NSArray.h"
|
||||
#import "Foundation/NSBundle.h"
|
||||
#import "Foundation/NSDictionary.h"
|
||||
#import "Foundation/NSError.h"
|
||||
#import "Foundation/NSException.h"
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include <langinfo.h>
|
||||
#endif
|
||||
#import "Foundation/NSUserDefaults.h"
|
||||
#import "Foundation/NSBundle.h"
|
||||
|
||||
#import "GSPrivate.h"
|
||||
|
||||
|
|
|
@ -54,6 +54,11 @@
|
|||
|
||||
#import "GSPrivate.h"
|
||||
|
||||
/* Constants */
|
||||
NSString * const NSBundleDidLoadNotification = @"NSBundleDidLoadNotification";
|
||||
NSString * const NSShowNonLocalizedStrings = @"NSShowNonLocalizedStrings";
|
||||
NSString * const NSLoadedClasses = @"NSLoadedClasses";
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -2102,11 +2107,11 @@ IF_NO_GC(
|
|||
if (tableContent != nil)
|
||||
{
|
||||
NSWarnMLog (@"Localisation file %@ not in portable encoding"
|
||||
@" so I'm using the default encoding for the current"
|
||||
@" system, which may not display messages correctly.\n"
|
||||
@"The file should be ASCII (using \\U escapes for unicode"
|
||||
@" characters) or Unicode (UTF16 or UTF8) with a leading "
|
||||
@"byte-order-marker.\n", tablePath);
|
||||
@" so I'm using the default encoding for the current"
|
||||
@" system, which may not display messages correctly.\n"
|
||||
@"The file should be ASCII (using \\U escapes for unicode"
|
||||
@" characters) or Unicode (UTF16 or UTF8) with a leading "
|
||||
@"byte-order-marker.\n", tablePath);
|
||||
}
|
||||
}
|
||||
if (tableContent == nil)
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#define EXPOSE_NSException_IVARS 1
|
||||
#define EXPOSE_NSThread_IVARS 1
|
||||
#import "GSPrivate.h"
|
||||
#import "Foundation/NSBundle.h"
|
||||
#import "Foundation/NSEnumerator.h"
|
||||
#import "Foundation/NSException.h"
|
||||
#import "Foundation/NSArray.h"
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#import "Foundation/NSData.h"
|
||||
#import "Foundation/NSFileHandle.h"
|
||||
#import "Foundation/NSPathUtilities.h"
|
||||
#import "Foundation/NSBundle.h"
|
||||
#import "GNUstepBase/GSFileHandle.h"
|
||||
#import "GNUstepBase/NSObject+GNUstepBase.h"
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#define EXPOSE_NSDirectoryEnumerator_IVARS 1
|
||||
#import "Foundation/NSArray.h"
|
||||
#import "Foundation/NSAutoreleasePool.h"
|
||||
#import "Foundation/NSBundle.h"
|
||||
#import "Foundation/NSData.h"
|
||||
#import "Foundation/NSDate.h"
|
||||
#import "Foundation/NSDictionary.h"
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#import "common.h"
|
||||
#import "Foundation/NSLocale.h"
|
||||
#import "Foundation/NSArray.h"
|
||||
#import "Foundation/NSBundle.h"
|
||||
#import "Foundation/NSCalendar.h"
|
||||
#import "Foundation/NSCoder.h"
|
||||
#import "Foundation/NSCharacterSet.h"
|
||||
|
|
|
@ -103,7 +103,6 @@
|
|||
|
||||
#import "GNUstepBase/GSConfig.h"
|
||||
#import "Foundation/NSArray.h"
|
||||
#import "Foundation/NSBundle.h"
|
||||
#import "Foundation/NSSet.h"
|
||||
#import "Foundation/NSDictionary.h"
|
||||
#import "Foundation/NSDate.h"
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#define EXPOSE_NSSortDescriptor_IVARS 1
|
||||
#import "Foundation/NSSortDescriptor.h"
|
||||
|
||||
#import "Foundation/NSBundle.h"
|
||||
#import "Foundation/NSCoder.h"
|
||||
#import "Foundation/NSException.h"
|
||||
#import "Foundation/NSKeyValueCoding.h"
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
#import "Foundation/NSRange.h"
|
||||
#import "Foundation/NSException.h"
|
||||
#import "Foundation/NSData.h"
|
||||
#import "Foundation/NSBundle.h"
|
||||
#import "Foundation/NSURL.h"
|
||||
#import "Foundation/NSMapTable.h"
|
||||
#import "Foundation/NSLock.h"
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#import "common.h"
|
||||
#define EXPOSE_NSTask_IVARS 1
|
||||
#import "Foundation/NSAutoreleasePool.h"
|
||||
#import "Foundation/NSBundle.h"
|
||||
#import "Foundation/NSCharacterSet.h"
|
||||
#import "Foundation/NSData.h"
|
||||
#import "Foundation/NSDate.h"
|
||||
|
|
|
@ -92,7 +92,6 @@
|
|||
#import "Foundation/NSLock.h"
|
||||
#import "Foundation/NSProcessInfo.h"
|
||||
#import "Foundation/NSUserDefaults.h"
|
||||
#import "Foundation/NSBundle.h"
|
||||
#import "Foundation/NSMapTable.h"
|
||||
#import "Foundation/NSThread.h"
|
||||
#import "Foundation/NSNotification.h"
|
||||
|
|
|
@ -27,39 +27,12 @@
|
|||
#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.
|
||||
*/
|
||||
|
@ -715,12 +688,11 @@ static inline NSString *GSBaseLocalizedString (NSString *key)
|
|||
{
|
||||
if ([actionName isEqual: @""])
|
||||
{
|
||||
return GSBaseLocalizedString(@"Redo");
|
||||
return _(@"Redo");
|
||||
}
|
||||
else
|
||||
{
|
||||
return [NSString stringWithFormat:
|
||||
GSBaseLocalizedString(@"Redo %@"), actionName];
|
||||
return [NSString stringWithFormat: @"%@ %@", _(@"Redo"), actionName];
|
||||
}
|
||||
}
|
||||
return actionName;
|
||||
|
@ -996,12 +968,11 @@ static inline NSString *GSBaseLocalizedString (NSString *key)
|
|||
{
|
||||
if ([actionName isEqual: @""])
|
||||
{
|
||||
return GSBaseLocalizedString(@"Undo");
|
||||
return _(@"Undo");
|
||||
}
|
||||
else
|
||||
{
|
||||
return [NSString stringWithFormat:
|
||||
GSBaseLocalizedString(@"Undo %@"), actionName];
|
||||
return [NSString stringWithFormat: @"%@ %@", _(@"Undo"), actionName];
|
||||
}
|
||||
}
|
||||
return actionName;
|
||||
|
|
|
@ -37,6 +37,15 @@
|
|||
*/
|
||||
#import "Foundation/NSString.h"
|
||||
#import "Foundation/NSDebug.h"
|
||||
#import "Foundation/NSBundle.h"
|
||||
#import "GNUstepBase/NSBundle+GNUstepBase.h"
|
||||
|
||||
/* Change localisation macro for use within the base library itsself.
|
||||
*/
|
||||
#undef _
|
||||
#define _(X) [[NSBundle bundleForLibrary: @"gnustep-base" version: \
|
||||
OBJC_STRINGIFY(GNUSTEP_BASE_MAJOR_VERSION.GNUSTEP_BASE_MINOR_VERSION)] \
|
||||
localizedStringForKey:(X) value: @"" table: nil]
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
|
|
@ -103,13 +103,6 @@ NSString *const NSIsNotNilTransformerName
|
|||
NSString *const NSUnarchiveFromDataTransformerName
|
||||
= @"NSUnarchiveFromData";
|
||||
|
||||
/* NSBundle */
|
||||
NSString *NSBundleDidLoadNotification = @"NSBundleDidLoadNotification";
|
||||
|
||||
NSString *NSShowNonLocalizedStrings = @"NSShowNonLocalizedStrings";
|
||||
|
||||
NSString *NSLoadedClasses = @"NSLoadedClasses";
|
||||
|
||||
|
||||
/* Standard domains */
|
||||
NSString *NSArgumentDomain = @"NSArgumentDomain";
|
||||
|
@ -245,7 +238,6 @@ GSPrivateBuildStrings()
|
|||
GS_REPLACE_CONSTANT_STRING(GSNetworkNotificationCenterType);
|
||||
GS_REPLACE_CONSTANT_STRING(NSAMPMDesignation);
|
||||
GS_REPLACE_CONSTANT_STRING(NSArgumentDomain);
|
||||
GS_REPLACE_CONSTANT_STRING(NSBundleDidLoadNotification);
|
||||
GS_REPLACE_CONSTANT_STRING(NSClassDescriptionNeededForClassNotification);
|
||||
GS_REPLACE_CONSTANT_STRING(NSConnectionDidDieNotification);
|
||||
GS_REPLACE_CONSTANT_STRING(NSConnectionDidInitializeNotification);
|
||||
|
@ -270,7 +262,6 @@ GSPrivateBuildStrings()
|
|||
GS_REPLACE_CONSTANT_STRING(NSLanguageCode);
|
||||
GS_REPLACE_CONSTANT_STRING(NSLanguageName);
|
||||
GS_REPLACE_CONSTANT_STRING(NSLaterTimeDesignations);
|
||||
GS_REPLACE_CONSTANT_STRING(NSLoadedClasses);
|
||||
GS_REPLACE_CONSTANT_STRING(GSLocale);
|
||||
GS_REPLACE_CONSTANT_STRING(NSLocalNotificationCenterType);
|
||||
GS_REPLACE_CONSTANT_STRING(NSMonthNameArray);
|
||||
|
@ -285,7 +276,6 @@ GSPrivateBuildStrings()
|
|||
GS_REPLACE_CONSTANT_STRING(NSShortMonthNameArray);
|
||||
GS_REPLACE_CONSTANT_STRING(NSShortTimeDateFormatString);
|
||||
GS_REPLACE_CONSTANT_STRING(NSShortWeekDayNameArray);
|
||||
GS_REPLACE_CONSTANT_STRING(NSShowNonLocalizedStrings);
|
||||
GS_REPLACE_CONSTANT_STRING(NSTaskDidTerminateNotification);
|
||||
GS_REPLACE_CONSTANT_STRING(NSThisDayDesignations);
|
||||
GS_REPLACE_CONSTANT_STRING(NSThousandsSeparator);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue