Skip to content

Commit

Permalink
Fix so translation comments included in .xliff
Browse files Browse the repository at this point in the history
...basically means we have to use a standard NSLocalizedString... macro with all the parameters explicitly specified each time, not a custom one where the "table" and "bundle" are handled by the macro.

Apologies for the mass regex-search-and-replace...
  • Loading branch information
Erin-Mounts committed Nov 21, 2015
1 parent b4270d0 commit a63b6e0
Show file tree
Hide file tree
Showing 64 changed files with 357 additions and 451 deletions.
181 changes: 46 additions & 135 deletions APCAppCore/APCAppCore.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions APCAppCore/APCAppCore/Consent/APCConsentTask.m
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ - (NSArray*)commonInitWithPropertiesFileName:(NSString*)fileName customSteps:(NS
identifier:@"participant"];
ORKConsentDocument* document = [[ORKConsentDocument alloc] init];

document.title = APCLocalizedString(@"Consent", nil);
document.signaturePageTitle = APCLocalizedString(@"Consent", nil);
document.signaturePageContent = APCLocalizedString(@"By agreeing you confirm that you read the consent and that you wish to take part in this research study.", nil);
document.title = NSLocalizedStringWithDefaultValue(@"Consent", @"APCAppCore", APCBundle(), @"Consent", nil);
document.signaturePageTitle = NSLocalizedStringWithDefaultValue(@"Consent", @"APCAppCore", APCBundle(), @"Consent", nil);
document.signaturePageContent = NSLocalizedStringWithDefaultValue(@"By agreeing you confirm that you read the consent and that you wish to take part in this research study.", @"APCAppCore", APCBundle(), @"By agreeing you confirm that you read the consent and that you wish to take part in this research study.", nil);
document.sections = self.documentSections;
document.htmlReviewContent = self.documentHtmlContent;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ - (ORKAnswerFormat*) rkChoiceAnswerFormat:(NSDictionary *)objectDictionary
[options addObject: choice];
}];
if (localConstraints.allowOtherValue) {
[options addObject:APCLocalizedString(@"Other", @"Spinner Option")];
[options addObject:NSLocalizedStringWithDefaultValue(@"Other", @"APCAppCore", APCBundle(), @"Other", @"Spinner Option")];
}
retAnswer = [ORKAnswerFormat choiceAnswerFormatWithStyle:localConstraints.allowMultipleValue ? ORKChoiceAnswerStyleMultipleChoice : ORKChoiceAnswerStyleSingleChoice textChoices:options];
return retAnswer;
Expand Down
2 changes: 1 addition & 1 deletion APCAppCore/APCAppCore/DataSubstrate/Model/APCUser+Bridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,6 @@ - (NSString *)passwordForAuthManager:(id<SBBAuthManagerProtocol>) __unused authM

- (NSString *)noInternetString
{
return APCLocalizedString(@"No network connection. Please connect to the internet and try again.", @"No Internet");
return NSLocalizedStringWithDefaultValue(@"No network connection. Please connect to the internet and try again.", @"APCAppCore", APCBundle(), @"No network connection. Please connect to the internet and try again.", @"No Internet");
}
@end
6 changes: 3 additions & 3 deletions APCAppCore/APCAppCore/DataSubstrate/Model/APCUser+UserData.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ @implementation APCUser (UserData)
Biologial Sex
****************/
+ (NSArray *) sexTypesInStringValue {
return @[ APCLocalizedString(@"Male", @""), APCLocalizedString(@"Female", @"")];
return @[ NSLocalizedStringWithDefaultValue(@"Male", @"APCAppCore", APCBundle(), @"Male", @""), NSLocalizedStringWithDefaultValue(@"Female", @"APCAppCore", APCBundle(), @"Female", @"")];
}

+ (HKBiologicalSex) sexTypeFromStringValue:(NSString *)stringValue {
HKBiologicalSex sexType;

if ([stringValue isEqualToString:APCLocalizedString(@"Male", @"")]) {
if ([stringValue isEqualToString:NSLocalizedStringWithDefaultValue(@"Male", @"APCAppCore", APCBundle(), @"Male", @"")]) {
sexType = HKBiologicalSexMale;
}
else if ([stringValue isEqualToString:APCLocalizedString(@"Female", @"")]) {
else if ([stringValue isEqualToString:NSLocalizedStringWithDefaultValue(@"Female", @"APCAppCore", APCBundle(), @"Female", @"")]) {
sexType = HKBiologicalSexFemale;
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ - (void) handleFailureInFunction: (NSString *) __unused functionName
}

- (void) exitGracefully {
NSString *alertTitle = APCLocalizedString(@"Somethings Wrong!", @"");
NSString *alertTitle = NSLocalizedStringWithDefaultValue(@"Somethings Wrong!", @"APCAppCore", APCBundle(), @"Somethings Wrong!", @"");

NSString *alertMessage = APCLocalizedString(@"Oops! Something went wrong. We are really sorry for the inconvenience. Since we are not taking any risk on your data, you may need to restart the app.", @"");
NSString *alertMessage = NSLocalizedStringWithDefaultValue(@"Oops! Something went wrong. We are really sorry for the inconvenience. Since we are not taking any risk on your data, you may need to restart the app.", @"APCAppCore", APCBundle(), @"Oops! Something went wrong. We are really sorry for the inconvenience. Since we are not taking any risk on your data, you may need to restart the app.", @"");

UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:APCLocalizedString(@"Okay", @"") style:UIAlertActionStyleCancel handler:^(UIAlertAction * __unused action) {
UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedStringWithDefaultValue(@"Okay", @"APCAppCore", APCBundle(), @"Okay", @"") style:UIAlertActionStyleCancel handler:^(UIAlertAction * __unused action) {
exit(0);
}];

Expand Down
4 changes: 2 additions & 2 deletions APCAppCore/APCAppCore/Library/Categories/NSDate+Helper.m
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ -(NSString *) friendlyDescription
NSString * retValue;
if([date isEqual:today])
{
retValue = APCLocalizedString(@"Today", nil);
retValue = NSLocalizedStringWithDefaultValue(@"Today", @"APCAppCore", APCBundle(), @"Today", nil);
}
else if([date isEqual:yesterday])
{
retValue = APCLocalizedString(@"Yesterday", nil);
retValue = NSLocalizedStringWithDefaultValue(@"Yesterday", @"APCAppCore", APCBundle(), @"Yesterday", nil);
}
else if(([date laterDate:oneWeekAgo] == date) && ([date laterDate:tomorrow] == tomorrow))
{
Expand Down
22 changes: 11 additions & 11 deletions APCAppCore/APCAppCore/Library/Categories/NSError+APCAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ @implementation NSError (APCAdditions)

+ (void)initialize
{
kAPCServerBusyErrorMessage = APCLocalizedString(@"Thank you for your interest in this study. We are working hard to process the large volume of interest, and should be back up momentarily. Please try again soon.", @"Error message when server is too busy to respond");
kAPCUnexpectedConditionErrorMessage = APCLocalizedString(@"An unexpected network condition has occurred. Please try again soon.", @"Error message indicating unexpected network problem");
kAPCNotConnectedErrorMessage = APCLocalizedString(@"You are currently not connected to the Internet. Please try again when you are connected to a network.", @"Error message when no network connection found");
kAPCServerUnderMaintanenceErrorMessage = APCLocalizedString(@"The study server is currently undergoing maintanence. Please try again soon.", @"Error message when server is undergoing maintenance and temporarily unavailable");
kAPCAccountAlreadyExistsErrorMessage = APCLocalizedString(@"An account has already been created for this email address. Please use a different email address, or sign in using the \"already participating\" link at the bottom of the Welcome page.", @"Error message when participant attempts to sign up for a new account using an email address already associated with an account in this study");
kAPCAccountDoesNotExistErrorMessage = APCLocalizedString(@"There is no account registered for this email address and password combination.", @"Error message when participant attempts to sign in to an existing account with an incorrect email address or password");
kAPCBadEmailAddressErrorMessage = APCLocalizedString(@"The email address submitted is not a valid email address. Please correct the email address and try again.", @"Error message when participant attempts to sign up using a non-valid email address");
kAPCBadPasswordErrorMessage = APCLocalizedString(@"The password you have entered is not a valid password. Please try again.", @"Error message when participant attempts to sign up with a non-valid password");
kAPCNotReachableErrorMessage = APCLocalizedString(@"We are currently not able to reach the study server. Please retry in a few moments.", @"Error message when the app is unable to reach the Bridge server");
kAPCInvalidEmailAddressOrPasswordErrorMessage = APCLocalizedString(@"Entered email address or password is not valid. Please correct the email address or password and try again.", @"Error message when participant attempts to sign up with a non-valid email address or password");
kAPCServerBusyErrorMessage = NSLocalizedStringWithDefaultValue(@"Thank you for your interest in this study. We are working hard to process the large volume of interest, and should be back up momentarily. Please try again soon.", @"APCAppCore", APCBundle(), @"Thank you for your interest in this study. We are working hard to process the large volume of interest, and should be back up momentarily. Please try again soon.", @"Error message when server is too busy to respond");
kAPCUnexpectedConditionErrorMessage = NSLocalizedStringWithDefaultValue(@"An unexpected network condition has occurred. Please try again soon.", @"APCAppCore", APCBundle(), @"An unexpected network condition has occurred. Please try again soon.", @"Error message indicating unexpected network problem");
kAPCNotConnectedErrorMessage = NSLocalizedStringWithDefaultValue(@"You are currently not connected to the Internet. Please try again when you are connected to a network.", @"APCAppCore", APCBundle(), @"You are currently not connected to the Internet. Please try again when you are connected to a network.", @"Error message when no network connection found");
kAPCServerUnderMaintanenceErrorMessage = NSLocalizedStringWithDefaultValue(@"The study server is currently undergoing maintanence. Please try again soon.", @"APCAppCore", APCBundle(), @"The study server is currently undergoing maintanence. Please try again soon.", @"Error message when server is undergoing maintenance and temporarily unavailable");
kAPCAccountAlreadyExistsErrorMessage = NSLocalizedStringWithDefaultValue(@"An account has already been created for this email address. Please use a different email address, or sign in using the \"already participating\" link at the bottom of the Welcome page.", @"APCAppCore", APCBundle(), @"An account has already been created for this email address. Please use a different email address, or sign in using the \"already participating\" link at the bottom of the Welcome page.", @"Error message when participant attempts to sign up for a new account using an email address already associated with an account in this study");
kAPCAccountDoesNotExistErrorMessage = NSLocalizedStringWithDefaultValue(@"There is no account registered for this email address and password combination.", @"APCAppCore", APCBundle(), @"There is no account registered for this email address and password combination.", @"Error message when participant attempts to sign in to an existing account with an incorrect email address or password");
kAPCBadEmailAddressErrorMessage = NSLocalizedStringWithDefaultValue(@"The email address submitted is not a valid email address. Please correct the email address and try again.", @"APCAppCore", APCBundle(), @"The email address submitted is not a valid email address. Please correct the email address and try again.", @"Error message when participant attempts to sign up using a non-valid email address");
kAPCBadPasswordErrorMessage = NSLocalizedStringWithDefaultValue(@"The password you have entered is not a valid password. Please try again.", @"APCAppCore", APCBundle(), @"The password you have entered is not a valid password. Please try again.", @"Error message when participant attempts to sign up with a non-valid password");
kAPCNotReachableErrorMessage = NSLocalizedStringWithDefaultValue(@"We are currently not able to reach the study server. Please retry in a few moments.", @"APCAppCore", APCBundle(), @"We are currently not able to reach the study server. Please retry in a few moments.", @"Error message when the app is unable to reach the Bridge server");
kAPCInvalidEmailAddressOrPasswordErrorMessage = NSLocalizedStringWithDefaultValue(@"Entered email address or password is not valid. Please correct the email address or password and try again.", @"APCAppCore", APCBundle(), @"Entered email address or password is not valid. Please correct the email address or password and try again.", @"Error message when participant attempts to sign up with a non-valid email address or password");
}

- (NSString*)checkMessageForNonUserTerms:(NSString*)message
Expand All @@ -71,7 +71,7 @@ - (NSString*)checkMessageForNonUserTerms:(NSString*)message
[message containsString:@"NSURLError"] ||
[message rangeOfString:@"contact somebody" options:NSCaseInsensitiveSearch].location != NSNotFound)
{
return APCLocalizedString(@"An unknown error occurred", nil);
return NSLocalizedStringWithDefaultValue(@"An unknown error occurred", @"APCAppCore", APCBundle(), @"An unknown error occurred", nil);
}
return message;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ - (NSArray*)locationArrayWithLocationManager:(CLLocationManager*)manager
}
else
{
speed = APCLocalizedString(@"invalid speed", nil);
speed = NSLocalizedStringWithDefaultValue(@"invalid speed", @"APCAppCore", APCBundle(), @"invalid speed", nil);
}

NSString* speedUnit = @"meters/second"; //Not a user facing constant
Expand All @@ -102,7 +102,7 @@ - (NSArray*)locationArrayWithLocationManager:(CLLocationManager*)manager
// A nil value of manager.location.floor indicates that this info is unavailable.
if (manager.location.floor == nil)
{
floor = APCLocalizedString(@"not available", nil);
floor = NSLocalizedStringWithDefaultValue(@"not available", @"APCAppCore", APCBundle(), @"not available", nil);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ + (UIAlertController *) simpleAlertWithTitle:(NSString *)title message:(NSString
{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];

UIAlertAction *okayAction = [UIAlertAction actionWithTitle:APCLocalizedString(@"OK", @"") style:UIAlertActionStyleDefault handler:nil];
UIAlertAction *okayAction = [UIAlertAction actionWithTitle:NSLocalizedStringWithDefaultValue(@"OK", @"APCAppCore", APCBundle(), @"OK", @"") style:UIAlertActionStyleDefault handler:nil];
[alertController addAction:okayAction];

return alertController;
Expand Down
22 changes: 11 additions & 11 deletions APCAppCore/APCAppCore/Library/Insights/APCInsights.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ - (instancetype)initWithFactor:(APCInsightFactors)factor
_baselineHigh = baselineHigh;
_baselineHighOther = baselineOther;

_captionGood = APCLocalizedString(@"Not enough data", @"Not enough data");
_captionBad = APCLocalizedString(@"Not enough data", @"Not enough data");
_captionGood = NSLocalizedStringWithDefaultValue(@"Not enough data", @"APCAppCore", APCBundle(), @"Not enough data", @"Not enough data");
_captionBad = NSLocalizedStringWithDefaultValue(@"Not enough data", @"APCAppCore", APCBundle(), @"Not enough data", @"Not enough data");
_valueGood = @(0);
_valueBad = @(0);

Expand Down Expand Up @@ -141,14 +141,14 @@ - (void)configureInsight
{
self.insightFactorName = HKQuantityTypeIdentifierDistanceWalkingRunning;
self.insightFactorUnit = [HKUnit meterUnit];
self.insightFactorCaption = APCLocalizedString(@"%@ minutes spent active", @"Minutes spent active, to be filled in with the number of minutes");
self.insightFactorCaption = NSLocalizedStringWithDefaultValue(@"%@ minutes spent active", @"APCAppCore", APCBundle(), @"%@ minutes spent active", @"Minutes spent active, to be filled in with the number of minutes");
}
break;
case APCInsightFactorCarbohydrateConsumption:
{
self.insightFactorName = HKQuantityTypeIdentifierDietaryCarbohydrates;
self.insightFactorUnit = [HKUnit gramUnit];
self.insightFactorCaption = APCLocalizedString(@"%@ carbohydrates consumed", @"Grams of carbohydrate consumed, to be filled in with the number of grams");
self.insightFactorCaption = NSLocalizedStringWithDefaultValue(@"%@ carbohydrates consumed", @"APCAppCore", APCBundle(), @"%@ carbohydrates consumed", @"Grams of carbohydrate consumed, to be filled in with the number of grams");
}
break;
case APCInsightFactorCarbohydrateCalories:
Expand All @@ -157,28 +157,28 @@ - (void)configureInsight
{
self.insightFactorName = HKQuantityTypeIdentifierDietaryEnergyConsumed;
self.insightFactorUnit = [HKUnit kilocalorieUnit];
self.insightFactorCaption = APCLocalizedString(@"%@ calories consumed", @"(Kilo)calories consumed, to be filled in with the number of kilocalories");
self.insightFactorCaption = NSLocalizedStringWithDefaultValue(@"%@ calories consumed", @"APCAppCore", APCBundle(), @"%@ calories consumed", @"(Kilo)calories consumed, to be filled in with the number of kilocalories");
}
break;
case APCInsightFactorSteps:
{
self.insightFactorName = HKQuantityTypeIdentifierStepCount;
self.insightFactorUnit = [HKUnit countUnit];
self.insightFactorCaption = APCLocalizedString(@"%@ Steps", @"Steps taken, to be filled in with the number of steps");
self.insightFactorCaption = NSLocalizedStringWithDefaultValue(@"%@ Steps", @"APCAppCore", APCBundle(), @"%@ Steps", @"Steps taken, to be filled in with the number of steps");
}
break;
case APCInsightFactorSugarConsumption:
{
self.insightFactorName = HKQuantityTypeIdentifierDietarySugar;
self.insightFactorUnit = [HKUnit gramUnit];
self.insightFactorCaption = APCLocalizedString(@"%@ sugar consumed", @"Grams of sugar consumed, to be filled in with the number of grams");
self.insightFactorCaption = NSLocalizedStringWithDefaultValue(@"%@ sugar consumed", @"APCAppCore", APCBundle(), @"%@ sugar consumed", @"Grams of sugar consumed, to be filled in with the number of grams");
}
break;
case APCInsightFactorTimeSlept:
{
self.insightFactorName = HKCategoryTypeIdentifierSleepAnalysis;
self.insightFactorUnit = [HKUnit hourUnit];
self.insightFactorCaption = APCLocalizedString(@"%@ hours slept", @"Hours slept, to be filled in with the number of hours");
self.insightFactorCaption = NSLocalizedStringWithDefaultValue(@"%@ hours slept", @"APCAppCore", APCBundle(), @"%@ hours slept", @"Hours slept, to be filled in with the number of hours");
}
break;
default:
Expand Down Expand Up @@ -360,7 +360,7 @@ - (void)dataPointsAreAvailableFromHealthKit:(NSArray *)insightPoints
{
APCLogDebug(@"Insights: %@", insightPoints);

NSString *caption = APCLocalizedString(@"Not enough data", @"Not enough data");
NSString *caption = NSLocalizedStringWithDefaultValue(@"Not enough data", @"APCAppCore", APCBundle(), @"Not enough data", @"Not enough data");
NSNumber *pointValue = nil;

NSArray *goodPoints = [insightPoints filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"(%K == %@) AND (%K <> %@)",
Expand Down Expand Up @@ -552,8 +552,8 @@ - (NSDate *)dateForSpan:(NSInteger)daySpan fromDate:(NSDate *)date

- (void)resetInsight
{
self.captionGood = APCLocalizedString(@"Not enough data", @"Not enough data");
self.captionBad = APCLocalizedString(@"Not enough data", @"Not enough data");
self.captionGood = NSLocalizedStringWithDefaultValue(@"Not enough data", @"APCAppCore", APCBundle(), @"Not enough data", @"Not enough data");
self.captionBad = NSLocalizedStringWithDefaultValue(@"Not enough data", @"APCAppCore", APCBundle(), @"Not enough data", @"Not enough data");
self.valueGood = @(0);
self.valueBad = @(0);

Expand Down
Loading

0 comments on commit a63b6e0

Please sign in to comment.