[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GSBaseLocalizedString()

From: Richard Frith-Macdonald
Subject: Re: GSBaseLocalizedString()
Date: Tue, 15 Feb 2011 06:29:04 +0000

On 14 Feb 2011, at 23:53, Germán Arias wrote:

> On mar, 2011-02-15 at 00:20 +0100, Wolfgang Lux wrote:
>> Germán Arias wrote:
>>> On lun, 2011-02-14 at 21:55 +0100, Wolfgang Lux wrote:
>>>> I didn't have a look whether your definition is correct, because it  
>>>> is
>>>> simply pointless. The macro _(X) is defined exactly for that purpose
>>>> and it is available in -base (provided the header GNUstepBase/
>>>> GNUstep.h is included, but this should be the case for  
>>>> NSUndoManager).
>>>> Furthermore, make_strings will recognize this macro in contrast to
>>>> your definition, so you could automatically prepare a strings file
>>>> (though -base at present is not prepared to do that). Even without
>>>> that macro, you would be off using NSLocalizedString or
>>>> NSLocalizedStringFromTable rather than reinventing the wheel.
>>>> Wolfgang
>>> I tried this (include GNUstepBase/GNUstep.h and use _() ) but don't
>>> works, I get:
>>> NSUndoManager.m: In function ‘-[NSUndoManager
>>> redoMenuTitleForUndoActionName:]’:
>>> NSUndoManager.m:720: warning: implicit declaration of function
>>> ‘NSLocalizedString’
>>> NSUndoManager.m:720: warning: return makes pointer from integer  
>>> without
>>> a cast
>>> NSUndoManager.m:725: warning: passing argument 1 of  
>>> ‘stringWithFormat:’
>>> makes pointer from integer without a cast
>>> NSUndoManager.m: In function ‘-[NSUndoManager
>>> undoMenuTitleForUndoActionName:]’:
>>> NSUndoManager.m:1001: warning: return makes pointer from integer  
>>> without
>>> a cast
>>> NSUndoManager.m:1006: warning: passing argument 1 of  
>>> ‘stringWithFormat:’
>>> makes pointer from integer without a cast
>>> for this reason I implemented the function GSBaseLocalizedString as
>>> suggested the FIXME note. Maybe there is a bug in NSLocalizedString?
>> This error should tell you that the compiler didn't find the prototype  
>> of function NSLocalizedString. Adding #import <Foundation/NSBundle.h>  
>> to NSUndoManager fixes that problem.
>> Wolfgang
> Well, adding NSBundle compile fine, but there aren't localized strings.
> The menu puts "Undo" and "Redo", even when the localized strings are in
> the Localizable.strings file :(

That's because, while Wolfgang is right in principle, there was the problem 
that the _() macro uses the main bundle to lookup strings.
I changed the code so that, within the base library, the macro is redefined to 
use the base library bundle rather than the main bundle
(the redefinition is done in Source/common.h).
The changes are now in svn ... please let me know if that works OK.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]