2002-10-31 00:02:10 +00:00
|
|
|
/** Interface for NSBundle for GNUStep -*-objc-*-
|
|
|
|
Copyright (C) 1995, 1997, 1999, 2001, 2002 Free Software Foundation, Inc.
|
1995-07-01 19:01:11 +00:00
|
|
|
|
|
|
|
Written by: Adam Fedor <fedor@boulder.colorado.edu>
|
|
|
|
Date: 1995
|
2002-10-31 00:02:10 +00:00
|
|
|
|
|
|
|
Updates by various authors.
|
|
|
|
Documentation by Nicola Pero <n.pero@mi.flashnet.it>
|
2002-08-20 10:22:05 +00:00
|
|
|
|
1996-05-12 00:56:10 +00:00
|
|
|
This file is part of the GNUstep Base Library.
|
1995-03-23 03:47:56 +00:00
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
2002-08-20 10:22:05 +00:00
|
|
|
|
1995-03-23 03:47:56 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
2002-08-20 10:22:05 +00:00
|
|
|
|
1995-03-23 03:47:56 +00:00
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; if not, write to the Free
|
1999-09-09 02:56:20 +00:00
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
2002-08-20 10:22:05 +00:00
|
|
|
*/
|
1995-03-23 03:47:56 +00:00
|
|
|
|
1996-04-17 19:36:35 +00:00
|
|
|
#ifndef __NSBundle_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
#define __NSBundle_h_GNUSTEP_BASE_INCLUDE
|
1995-03-18 17:15:15 +00:00
|
|
|
|
1995-04-17 21:13:20 +00:00
|
|
|
#include <Foundation/NSObject.h>
|
2001-02-23 00:50:10 +00:00
|
|
|
#include <Foundation/NSString.h>
|
1995-03-18 17:15:15 +00:00
|
|
|
|
|
|
|
@class NSString;
|
|
|
|
@class NSArray;
|
1997-01-06 22:30:33 +00:00
|
|
|
@class NSDictionary;
|
1999-04-22 21:26:10 +00:00
|
|
|
@class NSMutableDictionary;
|
1997-01-06 22:30:33 +00:00
|
|
|
|
2000-06-14 04:03:56 +00:00
|
|
|
GS_EXPORT NSString* NSBundleDidLoadNotification;
|
|
|
|
GS_EXPORT NSString* NSShowNonLocalizedStrings;
|
|
|
|
GS_EXPORT NSString* NSLoadedClasses;
|
1995-03-18 17:15:15 +00:00
|
|
|
|
|
|
|
@interface NSBundle : NSObject
|
|
|
|
{
|
1999-04-22 21:26:10 +00:00
|
|
|
NSString *_path;
|
|
|
|
NSArray *_bundleClasses;
|
|
|
|
Class _principalClass;
|
|
|
|
NSDictionary *_infoDict;
|
|
|
|
NSMutableDictionary *_localizations;
|
|
|
|
unsigned _bundleType;
|
|
|
|
BOOL _codeLoaded;
|
|
|
|
unsigned _version;
|
2000-10-28 21:58:48 +00:00
|
|
|
NSString *_frameworkVersion;
|
1995-03-18 17:15:15 +00:00
|
|
|
}
|
|
|
|
|
2002-10-31 00:02:10 +00:00
|
|
|
/** Return an array enumerating all the bundles in the application. This
|
|
|
|
* does not include frameworks. */
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSArray*) allBundles;
|
2002-10-31 00:02:10 +00:00
|
|
|
|
|
|
|
/** Return an array enumerating all the frameworks in the application. This
|
|
|
|
* does not include normal bundles. */
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSArray*) allFrameworks;
|
2002-02-25 15:29:53 +00:00
|
|
|
|
2002-10-31 00:02:10 +00:00
|
|
|
/** Return the bundle containing the resources for the executable. If
|
|
|
|
* the executable is an application, this is the main application
|
|
|
|
* bundle (the xxx.app directory); if the executable is a tool, this
|
|
|
|
* is a bundle 'naturally' associated with the tool: if the tool
|
|
|
|
* executable is xxx/Tools/ix86/linux-gnu/gnu-gnu-gnu/Control then the
|
|
|
|
* tool's main bundle directory is xxx/Tools/Resources/Control.
|
|
|
|
*
|
|
|
|
* NB: traditionally tools didn't have a main bundle -- this is a recent
|
|
|
|
* GNUstep extension, but it's quite nice and it's here to stay.
|
|
|
|
*
|
|
|
|
* The main bundle is where the application should put all of its
|
|
|
|
* resources, such as support files (images, html, rtf, txt, ...),
|
|
|
|
* localization tables, .gorm (.nib) files, etc. gnustep-make
|
|
|
|
* (/ProjectCenter) allows you to easily specify the resource files to
|
|
|
|
* put in the main bundle when you create an application or a tool.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSBundle*) mainBundle;
|
2002-02-25 15:29:53 +00:00
|
|
|
|
2002-10-31 00:02:10 +00:00
|
|
|
/** Return the bundle to which aClass belongs. If aClass was loaded
|
|
|
|
* from a bundle, return the bundle; if it belongs to a framework
|
|
|
|
* (either a framework linked into the application, or loaded
|
|
|
|
* dynamically), return the framework; in all other cases, return the
|
|
|
|
* main bundle.
|
|
|
|
*
|
|
|
|
* Please note that GNUstep supports plain shared libraries, while the
|
|
|
|
* openstep standard, and other openstep-like systems, do not; the
|
|
|
|
* behaviour when aClass belongs to a plain shared library is at the
|
|
|
|
* moment still under investigation -- you should consider it
|
|
|
|
* undefined since it might be changed. :-)
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSBundle*) bundleForClass: (Class)aClass;
|
2002-02-25 15:29:53 +00:00
|
|
|
|
2002-10-31 00:02:10 +00:00
|
|
|
/** Return a bundle for the path at path. If path doesn't exist or is
|
2002-02-25 15:29:53 +00:00
|
|
|
* not readable, return nil. If you want the main bundle of an
|
|
|
|
* application or a tool, it's better if you use +mainBundle. */
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSBundle*) bundleWithPath: (NSString*)path;
|
2002-02-25 15:29:53 +00:00
|
|
|
|
2002-10-31 00:02:10 +00:00
|
|
|
/** Search for a file with name 'name' and extension 'ext' in the bundle
|
|
|
|
* rooted at 'bundlePath'. */
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSString*) pathForResource: (NSString*)name
|
2002-08-20 10:22:05 +00:00
|
|
|
ofType: (NSString*)ext
|
1999-09-16 07:21:34 +00:00
|
|
|
inDirectory: (NSString*)bundlePath;
|
|
|
|
+ (NSString*) pathForResource: (NSString*)name
|
2002-08-20 10:22:05 +00:00
|
|
|
ofType: (NSString*)ext
|
1999-09-16 07:21:34 +00:00
|
|
|
inDirectory: (NSString*)bundlePath
|
|
|
|
withVersion: (int)version;
|
2002-02-25 15:29:53 +00:00
|
|
|
|
2002-10-31 00:02:10 +00:00
|
|
|
/** Init the bundle for reading resources from path. path must be an
|
|
|
|
* absolute path to a directory on disk. If path is nil or doesn't
|
|
|
|
* exist, initWithPath: returns nil. If a bundle for that path
|
|
|
|
* already existed, it is returned in place of the receiver (and the
|
|
|
|
* receiver is deallocated).
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
- (id) initWithPath: (NSString*)path;
|
2002-02-25 15:29:53 +00:00
|
|
|
|
2002-10-31 00:02:10 +00:00
|
|
|
/** Return the path to the bundle - an absolute path. */
|
1999-09-16 07:21:34 +00:00
|
|
|
- (NSString*) bundlePath;
|
2002-02-25 15:29:53 +00:00
|
|
|
|
1999-09-16 07:21:34 +00:00
|
|
|
- (Class) classNamed: (NSString*)className;
|
1997-01-06 22:30:33 +00:00
|
|
|
- (Class) principalClass;
|
1995-03-18 17:15:15 +00:00
|
|
|
|
1999-09-16 07:21:34 +00:00
|
|
|
- (NSArray*) pathsForResourcesOfType: (NSString*)extension
|
|
|
|
inDirectory: (NSString*)bundlePath;
|
|
|
|
- (NSString*) pathForResource: (NSString*)name
|
2002-08-20 10:22:05 +00:00
|
|
|
ofType: (NSString*)ext
|
1999-09-16 07:21:34 +00:00
|
|
|
inDirectory: (NSString*)bundlePath;
|
|
|
|
- (NSString*) pathForResource: (NSString*)name
|
|
|
|
ofType: (NSString*)ext;
|
2002-08-20 10:22:05 +00:00
|
|
|
- (NSString*) localizedStringForKey: (NSString*)key
|
1999-09-16 07:21:34 +00:00
|
|
|
value: (NSString*)value
|
|
|
|
table: (NSString*)tableName;
|
|
|
|
- (NSString*) resourcePath;
|
1995-03-18 17:15:15 +00:00
|
|
|
|
1997-09-01 21:59:51 +00:00
|
|
|
- (unsigned) bundleVersion;
|
|
|
|
- (void) setBundleVersion: (unsigned)version;
|
|
|
|
|
1997-01-06 22:30:33 +00:00
|
|
|
#ifndef STRICT_OPENSTEP
|
1999-09-16 07:21:34 +00:00
|
|
|
- (NSDictionary*) infoDictionary;
|
1997-09-01 21:59:51 +00:00
|
|
|
- (BOOL) load;
|
1997-01-06 22:30:33 +00:00
|
|
|
#endif
|
1995-03-18 17:15:15 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2001-02-23 00:50:10 +00:00
|
|
|
#ifndef NO_GNUSTEP
|
1997-10-18 19:49:50 +00:00
|
|
|
@interface NSBundle (GNUstep)
|
|
|
|
|
2002-10-31 00:02:10 +00:00
|
|
|
/** The following method is an experimental GNUstep extension, and
|
|
|
|
* might change. At the moment, search on the standard GNUstep
|
|
|
|
* directories (starting from GNUSTEP_USER_ROOT, and going on to
|
|
|
|
* GNUSTEP_SYSTEM_ROOT) for a directory
|
|
|
|
* Libraries/Resources/'libraryName'/.
|
|
|
|
*/
|
2001-12-21 18:30:09 +00:00
|
|
|
+ (NSBundle *) bundleForLibrary: (NSString *)libraryName;
|
|
|
|
|
2000-06-12 05:17:41 +00:00
|
|
|
+ (NSString *) _absolutePathOfExecutable: (NSString *)path;
|
1999-04-14 10:36:04 +00:00
|
|
|
+ (NSString*) _gnustep_target_cpu;
|
|
|
|
+ (NSString*) _gnustep_target_dir;
|
|
|
|
+ (NSString*) _gnustep_target_os;
|
|
|
|
+ (NSString*) _library_combo;
|
1999-04-22 21:26:10 +00:00
|
|
|
+ (NSBundle*) gnustepBundle;
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSString*) pathForGNUstepResource: (NSString*)name
|
2002-08-20 10:22:05 +00:00
|
|
|
ofType: (NSString*)ext
|
1999-09-16 07:21:34 +00:00
|
|
|
inDirectory: (NSString*)bundlePath;
|
1997-10-18 19:49:50 +00:00
|
|
|
|
|
|
|
@end
|
2001-12-21 18:30:09 +00:00
|
|
|
|
2002-10-31 00:02:10 +00:00
|
|
|
/** Warning - the following should never be used. */
|
1999-04-22 21:26:10 +00:00
|
|
|
#define GSLocalizedString(key, comment) \
|
|
|
|
[[NSBundle gnustepBundle] localizedStringForKey:(key) value:@"" table:nil]
|
|
|
|
#define GSLocalizedStringFromTable(key, tbl, comment) \
|
|
|
|
[[NSBundle gnustepBundle] localizedStringForKey:(key) value:@"" table:(tbl)]
|
|
|
|
|
2001-02-23 00:50:10 +00:00
|
|
|
#endif /* GNUSTEP */
|
1997-10-18 19:49:50 +00:00
|
|
|
|
2002-08-20 10:22:05 +00:00
|
|
|
/*
|
|
|
|
* <p>
|
|
|
|
* This function (macro) is used to get the localized
|
|
|
|
* translation of the string <code>key</code>.
|
|
|
|
* <code>key</code> is looked up in the
|
|
|
|
* <code>Localizable.strings</code> file for the current
|
|
|
|
* language. The current language is determined by the
|
|
|
|
* available languages in which the application is
|
|
|
|
* translated, and by using the <code>NSLanguages</code> user
|
|
|
|
* defaults (which should contain an array of the languages
|
|
|
|
* preferred by the user, in order of preference).
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* Technically, the function works by calling
|
|
|
|
* <code>localizedStringForKey:value:table:</code> on the
|
|
|
|
* main bundle, using <code>@""</code> as value, and
|
|
|
|
* <code>nil</code> as the table. The <code>comment</code>
|
|
|
|
* is ignored when the macro is expanded; but when we have
|
|
|
|
* tools which can generate the
|
|
|
|
* <code>Localizable.strings</code> files automatically from
|
|
|
|
* source code, the <code>comment</code> will be used by the
|
|
|
|
* tools and added as a comment before the string to
|
|
|
|
* translate. Upon finding something like
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* <code>
|
|
|
|
* NSLocalizedString (@"My useful string",
|
|
|
|
* @"My useful comment about the string");
|
|
|
|
* </code>
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* in the source code, the tools will generate a comment and the line
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* <code>
|
|
|
|
* " My useful string" = "My useful string";
|
|
|
|
* </code>
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* in the <code>Localizable.strings</code> file (the
|
|
|
|
* translator then can use this as a skeleton for the
|
|
|
|
* <code>Localizable.strings</code> for his/her own language,
|
|
|
|
* where she/he can replace the right hand side with the
|
|
|
|
* translation in her/his own language). The comment can
|
|
|
|
* help the translator to decide how to translate when it is
|
|
|
|
* not clear how to translate (because the original string is
|
|
|
|
* now out of context, and out of context might not be so
|
|
|
|
* clear what the string means). The comment is totally
|
|
|
|
* ignored by the library code.
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* If you don't have a comment (because the string is so
|
|
|
|
* self-explanatory that it doesn't need it), you can leave
|
|
|
|
* it blank, by using <code>@""</code> as a comment. If the
|
|
|
|
* string might be unclear out of context, it is recommended
|
|
|
|
* that you add a comment (even if it is unused for now).
|
|
|
|
* </p>
|
|
|
|
*/
|
1997-01-06 22:30:33 +00:00
|
|
|
#define NSLocalizedString(key, comment) \
|
|
|
|
[[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:nil]
|
2002-08-20 10:22:05 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This function (macro) does the same as
|
|
|
|
* <code>NSLocalizedString</code>, but uses the table
|
|
|
|
* <code>table</code> rather than the default table. This
|
|
|
|
* means that the string to translate will be looked up in a
|
|
|
|
* different file than <code>Localizable.strings</code>. For
|
|
|
|
* example, if you pass <code>DatabaseErrors</code> as the
|
|
|
|
* <code>table</code>, the string will be looked up for
|
|
|
|
* translation in the file
|
|
|
|
* <code>DatabaseErrors.strings</code>. This allows you to
|
|
|
|
* have the same string translated in different ways, by
|
|
|
|
* having a different translation in different tables, and
|
|
|
|
* choosing between the different translation by choosing a
|
|
|
|
* different table.
|
|
|
|
*/
|
1997-01-06 22:30:33 +00:00
|
|
|
#define NSLocalizedStringFromTable(key, tbl, comment) \
|
|
|
|
[[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:(tbl)]
|
2002-08-20 10:22:05 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This function is the full-blown localization function (it
|
|
|
|
* is actually a macro). It looks up the string
|
|
|
|
* <code>key</code> for translation in the table
|
|
|
|
* <code>table</code> of the bundle <code>bundle</code>
|
|
|
|
* (please refer to the NSBundle documentation for more
|
|
|
|
* information on how this lookup is done).
|
|
|
|
* <code>comment</code> is a comment, which is ignored by the
|
|
|
|
* library (it is discarded when the macro is expanded) but which
|
|
|
|
* can be used by tools which parse the source code and generate
|
|
|
|
* strings table to provide a comment which the translator can
|
|
|
|
* use when translating the string.
|
|
|
|
*/
|
1997-01-06 22:30:33 +00:00
|
|
|
#define NSLocalizedStringFromTableInBundle(key, tbl, bundle, comment) \
|
|
|
|
[bundle localizedStringForKey:(key) value:@"" table:(tbl)]
|
|
|
|
|
1999-04-23 02:54:45 +00:00
|
|
|
#ifndef NO_GNUSTEP
|
|
|
|
#define NSLocalizedStringFromTableInFramework(key, tbl, fpth, comment) \
|
|
|
|
[[NSBundle mainBundle] localizedStringForKey:(key) value:@"" \
|
|
|
|
table: [bundle pathForGNUstepResource:(tbl) ofType: nil inDirectory: (fpth)]
|
2001-02-23 00:50:10 +00:00
|
|
|
#endif /* GNUSTEP */
|
|
|
|
|
|
|
|
/* Now Support for Quick Localization */
|
|
|
|
#ifndef NO_GNUSTEP
|
|
|
|
|
2002-08-20 10:22:05 +00:00
|
|
|
/* The quickest possible way to localize a string:
|
|
|
|
|
2001-02-23 00:50:10 +00:00
|
|
|
NSLog (_(@"New Game"));
|
2002-08-20 10:22:05 +00:00
|
|
|
|
|
|
|
Please make use of the longer functions taking a comment when you
|
2001-02-23 00:50:10 +00:00
|
|
|
get the time to localize seriously your code.
|
|
|
|
*/
|
2002-08-20 10:22:05 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* <p>
|
|
|
|
* This function (macro) is a GNUstep extension.
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* <code>_(@"My string to translate")</code>
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* is exactly the same as
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* <code>NSLocalizedString (@"My string to translate", @"")</code>
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* It is useful when you need to translate an application
|
|
|
|
* very quickly, as you just need to enclose all strings
|
|
|
|
* inside <code>_()</code>. But please note that when you
|
|
|
|
* use this macro, you are not taking advantage of comments
|
|
|
|
* for the translator, so consider using
|
|
|
|
* <code>NSLocalizedString</code> instead when you need a
|
|
|
|
* comment.
|
|
|
|
* </p>
|
|
|
|
*/
|
2001-02-23 00:50:10 +00:00
|
|
|
#define _(X) NSLocalizedString (X, @"")
|
2002-08-20 10:22:05 +00:00
|
|
|
|
2001-02-23 00:50:10 +00:00
|
|
|
/* The quickest possible way to localize a static string:
|
2002-08-20 10:22:05 +00:00
|
|
|
|
2001-02-23 00:50:10 +00:00
|
|
|
static NSString *string = __(@"New Game");
|
2002-08-20 10:22:05 +00:00
|
|
|
|
2001-02-23 00:50:10 +00:00
|
|
|
NSLog (_(string)); */
|
2002-08-20 10:22:05 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* <p>
|
|
|
|
* This function (macro) is a GNUstep extension.
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* <code>__(@"My string to translate")</code>
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* is exactly the same as
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* <code>NSLocalizedStaticString (@"My string to translate", @"")</code>
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* It is useful when you need to translate an application very
|
|
|
|
* quickly. You would use it as follows for static strings:
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* <code>
|
|
|
|
* NSString *message = __(@"Hello there");
|
|
|
|
|
|
|
|
* ... more code ...
|
|
|
|
|
|
|
|
* NSLog (_(messages));
|
|
|
|
* </code>
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* But please note that when you use this macro, you are not
|
|
|
|
* taking advantage of comments for the translator, so
|
|
|
|
* consider using <code>NSLocalizedStaticString</code>
|
|
|
|
* instead when you need a comment.
|
|
|
|
* </p>
|
|
|
|
*/
|
2001-02-23 00:50:10 +00:00
|
|
|
#define __(X) X
|
|
|
|
|
2002-08-20 10:22:05 +00:00
|
|
|
/* The better way for a static string, with a comment - use as follows -
|
2001-02-23 00:50:10 +00:00
|
|
|
|
2002-08-20 10:22:05 +00:00
|
|
|
static NSString *string = NSLocalizedStaticString (@"New Game",
|
2001-02-23 00:50:10 +00:00
|
|
|
@"Menu Option");
|
|
|
|
|
|
|
|
NSLog (_(string));
|
|
|
|
|
2002-08-20 10:22:05 +00:00
|
|
|
If you need anything more complicated than this, please initialize
|
2001-02-23 00:50:10 +00:00
|
|
|
the static strings manually.
|
|
|
|
*/
|
2002-08-20 10:22:05 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* <p>
|
|
|
|
* This function (macro) is a GNUstep extensions, and it is used
|
|
|
|
* to localize static strings. Here is an example of a static
|
|
|
|
* string:
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* <code>
|
|
|
|
* NSString *message = @"Hi there";
|
|
|
|
|
|
|
|
* ... some code ...
|
|
|
|
|
|
|
|
* NSLog (message);
|
|
|
|
* </code>
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* This string can not be localized using the standard
|
|
|
|
* openstep functions/macros. By using this gnustep extension,
|
|
|
|
* you can localize it as follows:
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* <code>
|
|
|
|
* NSString *message = NSLocalizedStaticString (@"Hi there",
|
|
|
|
* @"Greeting");
|
|
|
|
|
|
|
|
* ... some code ...
|
|
|
|
|
|
|
|
* NSLog (NSLocalizedString (message, @""));
|
|
|
|
* </code>
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* When the tools generate the
|
|
|
|
* <code>Localizable.strings</code> file from the source
|
|
|
|
* code, they will ignore the <code>NSLocalizedString</code>
|
|
|
|
* call while they will extract the string (and the comment)
|
|
|
|
* to localize from the <code>NSLocalizedStaticString</code>
|
|
|
|
* call.
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* When the code is compiled, instead, the
|
|
|
|
* <code>NSLocalizedStaticString</code> call is ignored (discarded,
|
|
|
|
* it is a macro which simply expands to <code>key</code>), while
|
|
|
|
* the <code>NSLocalizedString</code> will actually look up the
|
|
|
|
* string for translation in the <code>Localizable.strings</code>
|
|
|
|
* file.
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* Please note that there is currently no macro/function to
|
|
|
|
* localize static strings using different tables. If you
|
|
|
|
* need that functionality, you have either to prepare the
|
|
|
|
* localization tables by hand, or to rewrite your code in
|
|
|
|
* such a way as not to use static strings.
|
|
|
|
* </p>
|
|
|
|
*/
|
2001-02-23 00:50:10 +00:00
|
|
|
#define NSLocalizedStaticString(key, comment) key
|
|
|
|
|
|
|
|
#endif /* NO_GNUSTEP */
|
1999-04-23 02:54:45 +00:00
|
|
|
|
1996-04-17 19:36:35 +00:00
|
|
|
#endif /* __NSBundle_h_GNUSTEP_BASE_INCLUDE */
|
1997-09-01 21:59:51 +00:00
|
|
|
|
|
|
|
|