1

I have added the .h .m and .bundle files for irate. I set the preview mode to YES so the Alert View pops up right when my app launches on my phone (I'm testing). It doesn't show the Alert View at all if I don't set the preview mode to YES. So now it pops up the rating Alert View. In the .m file I tried editing the title, message and button text in the string and it still shows the original title, message and button text even though it does not exist in the .m because I have completely changed it. Does anyone know how to edit this text so that it will edit the text that appears on the Alert View. The code is below as it came from my download of irate. If I change the text in the strings it doesn't change when I test it still shows what is there right now. Going around in circles here and I'm guessing I'm missing something simple, any help would be awesome!

- (NSString *)messageTitle
{
    return [_messageTitle ?: [self localizedStringForKey:iRateMessageTitleKey  withDefault:@"Rate %@"] stringByReplacingOccurrencesOfString:@"%@" withString:self.applicationName];
}

- (NSString *)message
{
NSString *message = _message;
if (!message)
{
    message = (self.appStoreGenreID == iRateAppStoreGameGenreID)? [self localizedStringForKey:iRateGameMessageKey withDefault:@"If you enjoy playing %@, would you mind taking a moment to rate it? It won’t take more than a minute. Thanks for your support!"]: [self localizedStringForKey:iRateAppMessageKey withDefault:@"If you enjoy using %@, would you mind taking a moment to rate it? It won’t take more than a minute. Thanks for your support!"];
}
return [message stringByReplacingOccurrencesOfString:@"%@" withString:self.applicationName];
}

- (NSString *)cancelButtonLabel
{
return _cancelButtonLabel ?: [self localizedStringForKey:iRateCancelButtonKey withDefault:@"No, Thanks"];
}

- (NSString *)rateButtonLabel
{
return _rateButtonLabel ?: [self localizedStringForKey:iRateRateButtonKey withDefault:@"Rate It Now"];
}

- (NSString *)remindButtonLabel
{
return _remindButtonLabel ?: [self localizedStringForKey:iRateRemindButtonKey withDefault:@"Remind Me Later"];
}
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Herbie999
  • 315
  • 2
  • 6
  • 16

1 Answers1

1

As suggested in the iRate documentation on GitHub, there are two ways you can override those strings:

1) you can override the default strings in your app delegate initialize class method:

+ (void)initialize
{
    //overriding the default iRate strings
    [iRate sharedInstance].messageTitle = NSLocalizedString(@"Rate MyApp", @"iRate message title");
    [iRate sharedInstance].message = NSLocalizedString(@"If you like MyApp, please take the time, etc", @"iRate message");
    [iRate sharedInstance].cancelButtonLabel = NSLocalizedString(@"No, Thanks", @"iRate decline button");
    [iRate sharedInstance].remindButtonLabel = NSLocalizedString(@"Remind Me Later", @"iRate remind button");
    [iRate sharedInstance].rateButtonLabel = NSLocalizedString(@"Rate It Now", @"iRate accept button");
}

2) The recommended way is that you can also create your own Localizable.strings file and add those strings found in iRate.h:

//localisation string keys
static NSString *const iRateMessageTitleKey = @"iRateMessageTitle";
static NSString *const iRateAppMessageKey = @"iRateAppMessage";
static NSString *const iRateGameMessageKey = @"iRateGameMessage";
static NSString *const iRateCancelButtonKey = @"iRateCancelButton";
static NSString *const iRateRemindButtonKey = @"iRateRemindButton";
static NSString *const iRateRateButtonKey = @"iRateRateButton";

For example, inside the Localizable.strings file:

"iRateMessageTitle" = "My own rating title";
"iRateAppMessage" = "My own rating message";
Abhishek Thapliyal
  • 3,497
  • 6
  • 30
  • 69
Valent Richie
  • 5,226
  • 1
  • 20
  • 21
  • Hi! Thanks for the help! I'm very new to coding so I don't quite understand. I did see the bit about using the delegate but when I open my AppDelegate.h and .m I don't even see an "initialize class method" is that the same as applicationDidFinishLaunching... or something like that? Can you elaborate or explain a little more either of the solutions you offered??? Maybe a step by step type example? – Herbie999 Jul 03 '13 at 01:16
  • @Herbie999 it is not the same as applicationDidFinishLaunching. It is not there by default, but you can still declare it by yourself and it will take place because the method actually exists. – Valent Richie Jul 03 '13 at 01:22
  • In swift, i tried to add localizable strings too but its not working. Can you help me @Valent Richie – Abhishek Thapliyal Aug 28 '17 at 06:55