[MacRuby-devel] NSLocalizedString

Martin Hawkins martin.hawkins at gmail.com
Mon Feb 21 08:23:16 PST 2011


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 #<DateCell:0x200c86740> (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?


More information about the MacRuby-devel mailing list