Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added basic localization support #6

Open
wants to merge 4 commits into from

2 participants

@marzapower

I just added a basic localization support, that will only require some small changes in the Appirater header file. The changes are unobtrusive, meaning that everyone who is using the old version of Appirater can easily switch to this one, even if he/she does not make use of localization support for the application.

@deralexxx

added localized Version at: https://github.com/deralexxx/appirater

have fun

@marzapower

I am currently using these version of Appirater in a couple of projects.
When the localization is missing , it will behave as the default Appirater plugin. When the localization strings are redefined, you can obtain Appirater in all the different languages you need. Just scan the Appirater.h file and look at the NSLocalizedString() calls to know which strings you can localize.

In this latest version it is possible to even handle localized app names, through the [[NSBundle mainBundle] localizedInfoDictionary] dictionary. If such a localization does not exist, it will read the app's name from the main infoDictionary instead.

This fork has been subforked by almost 60 people, so I think it's worth looking at. Please, let me know what you think.

Thank you

@marzapower

This permits to anonymize the app_id in the default package, instead of leaving a personal app_id inside.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 30 additions and 7 deletions.
  1. +30 −7 Appirater.h
View
37 Appirater.h
@@ -46,38 +46,61 @@ extern NSString *const kAppiraterDeclinedToRate;
/*
Place your Apple generated software id here.
*/
-#define APPIRATER_APP_ID 301377083
+#define APPIRATER_APP_ID 0000000000
+
+/*
+ Your localized app's name.
+ */
+
+#define APPIRATER_LOCALIZED_APP_NAME [[[NSBundle mainBundle] localizedInfoDictionary] objectForKey:(NSString *)kCFBundleNameKey]
/*
Your app's name.
*/
-#define APPIRATER_APP_NAME [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey]
+#define APPIRATER_APP_NAME APPIRATER_LOCALIZED_APP_NAME ? APPIRATER_LOCALIZED_APP_NAME : [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleNameKey]
+
+/*
+ The localized template message for displaying the rating request
+ */
+#define APPIRATER_LOCALIZED_MESSAGE NSLocalizedString(@"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!", nil)
/*
This is the message your users will see once they've passed the day+launches
threshold.
*/
-#define APPIRATER_MESSAGE [NSString stringWithFormat:@"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!", APPIRATER_APP_NAME]
+#define APPIRATER_MESSAGE [NSString stringWithFormat:APPIRATER_LOCALIZED_MESSAGE, APPIRATER_APP_NAME]
+
+/*
+ The localized template title of the message alert
+ */
+
+#define APPIRATER_LOCALIZED_TITLE NSLocalizedString(@"Rate %@", nil)
/*
This is the title of the message alert that users will see.
*/
-#define APPIRATER_MESSAGE_TITLE [NSString stringWithFormat:@"Rate %@", APPIRATER_APP_NAME]
+#define APPIRATER_MESSAGE_TITLE [NSString stringWithFormat:APPIRATER_LOCALIZED_TITLE, APPIRATER_APP_NAME]
/*
The text of the button that rejects reviewing the app.
*/
-#define APPIRATER_CANCEL_BUTTON @"No, Thanks"
+#define APPIRATER_CANCEL_BUTTON NSLocalizedString(@"No, Thanks", nil)
+
+/*
+ The localized confirm button text
+ */
+
+#define APPIRATER_LOCALIZED_RATE_BUTTON NSLocalizedString(@"Rate %@", nil)
/*
Text of button that will send user to app review page.
*/
-#define APPIRATER_RATE_BUTTON [NSString stringWithFormat:@"Rate %@", APPIRATER_APP_NAME]
+#define APPIRATER_RATE_BUTTON [NSString stringWithFormat:APPIRATER_LOCALIZED_RATE_BUTTON, APPIRATER_APP_NAME]
/*
Text for button to remind the user to review later.
*/
-#define APPIRATER_RATE_LATER @"Remind me later"
+#define APPIRATER_RATE_LATER NSLocalizedString(@"Remind me later", nil)
/*
Users will need to have the same version of your app installed for this many
Something went wrong with that request. Please try again.