[MacRuby-devel] NSLocalizedString

2011-02-21 Thread Martin Hawkins
I'm taking a look at the Apple Sample code called PhotoSearch. In
DateCell.m, there is a use of NSLocalizedString as follows:

- (NSString *)todayString {
return NSLocalizedString(@"Today", @"Today title string");
}

I translated this as:

def todayString
return NSLocalizedString( "Today", "Today title string")
end

but got:
DateCell.rb:217:in `todayString': undefined method `NSLocalizedString'
for # (NoMethodError)

Changing the line to
return NSBundle.mainBundle.localizedStringForKey("Today", value:"Today
title string", table:nil)
works but NSLocalizedString is supposed to be a Foundation Function,
so should be 'freely' available in MacRuby, shouldn't it?
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] NSLocalizedString

2011-02-21 Thread Charles Steinman
On Mon, Feb 21, 2011 at 8:23 AM, Martin Hawkins
 wrote:
> Changing the line to
> return NSBundle.mainBundle.localizedStringForKey("Today", value:"Today
> title string", table:nil)
> works but NSLocalizedString is supposed to be a Foundation Function,
> so should be 'freely' available in MacRuby, shouldn't it?

The trouble is that NSLocalizedString is not actually a function —
it's a macro, so MacRuby can't call it. It really just needs to be
reimplemented, but until then the NSBundle methods are precisely
equivalent.

— Chuck
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel