mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Added new quick localization macros
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9211 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fa44ce8d5a
commit
f96ebb12ce
1 changed files with 38 additions and 3 deletions
|
@ -25,6 +25,7 @@
|
|||
#define __NSBundle_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
#include <Foundation/NSString.h>
|
||||
|
||||
@class NSString;
|
||||
@class NSArray;
|
||||
|
@ -87,7 +88,7 @@ GS_EXPORT NSString* NSLoadedClasses;
|
|||
|
||||
@end
|
||||
|
||||
#ifndef NO_GNUSTEP
|
||||
#ifndef NO_GNUSTEP
|
||||
@interface NSBundle (GNUstep)
|
||||
|
||||
+ (NSString *) _absolutePathOfExecutable: (NSString *)path;
|
||||
|
@ -106,7 +107,7 @@ GS_EXPORT NSString* NSLoadedClasses;
|
|||
#define GSLocalizedStringFromTable(key, tbl, comment) \
|
||||
[[NSBundle gnustepBundle] localizedStringForKey:(key) value:@"" table:(tbl)]
|
||||
|
||||
#endif
|
||||
#endif /* GNUSTEP */
|
||||
|
||||
#define NSLocalizedString(key, comment) \
|
||||
[[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:nil]
|
||||
|
@ -119,7 +120,41 @@ GS_EXPORT NSString* NSLoadedClasses;
|
|||
#define NSLocalizedStringFromTableInFramework(key, tbl, fpth, comment) \
|
||||
[[NSBundle mainBundle] localizedStringForKey:(key) value:@"" \
|
||||
table: [bundle pathForGNUstepResource:(tbl) ofType: nil inDirectory: (fpth)]
|
||||
#endif
|
||||
#endif /* GNUSTEP */
|
||||
|
||||
/* Now Support for Quick Localization */
|
||||
#ifndef NO_GNUSTEP
|
||||
|
||||
/* The quickest possible way to localize a string:
|
||||
|
||||
NSLog (_(@"New Game"));
|
||||
|
||||
Please make use of the longer functions taking a comment when you
|
||||
get the time to localize seriously your code.
|
||||
*/
|
||||
#define _(X) NSLocalizedString (X, @"")
|
||||
|
||||
/* The quickest possible way to localize a static string:
|
||||
|
||||
static NSString *string = __(@"New Game");
|
||||
|
||||
NSLog (_(string)); */
|
||||
|
||||
#define __(X) X
|
||||
|
||||
/* The better way for a static string, with a comment - use as follows -
|
||||
|
||||
static NSString *string = NSLocalizedStaticString (@"New Game",
|
||||
@"Menu Option");
|
||||
|
||||
NSLog (_(string));
|
||||
|
||||
If you need anything more complicated than this, please initialize
|
||||
the static strings manually.
|
||||
*/
|
||||
#define NSLocalizedStaticString(key, comment) key
|
||||
|
||||
#endif /* NO_GNUSTEP */
|
||||
|
||||
#endif /* __NSBundle_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
||||
|
|
Loading…
Reference in a new issue