私のアプリはうまく動作しており、ローカルの通知が使用されています。iOS通知のローカライズ?
私は今、このアプリケーションを国際化し、デバイスで言語を変更する前に言語に設定された通知を除いて、すべてうまく動作するようにしました。
ローカライズされた文字列を含む配列から通知内のメッセージを読み込むので、ユーザーがデバイスの言語を変更したときに、通知の文字列も変更されますが間違っていたと考えました。
この問題に取り組むにはどうすればよいですか? NSStringテキストもNSLocalizationStringにする必要がありますか?
私の通知コード:
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
if (localNotif == nil)
return;
localNotif.fireDate = [alertTimes objectAtIndex:i];
localNotif.timeZone = [NSTimeZone defaultTimeZone];
NSString *text = [alertText objectAtIndex:i];
// Notification details
localNotif.alertBody = text;
// Set the action button
localNotif.alertAction = @"View";
localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.applicationIconBadgeNumber = 1;
// Specify custom data for the notification
NSDictionary *infoDict = [NSDictionary dictionaryWithObject:@"someValue" forKey:@"someKey"];
localNotif.userInfo = infoDict;
// Schedule the notification
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
[localNotif release];
これまでの言語で作成されたローカル通知を除き、すべての文字列がローカライズされていることを追加したいと思います。新しい通知を送信すると、新しい言語で表示されますが、まだ起動していない古い通知は古い言語で表示されます。これは、多くのユーザーが言語を頻繁に変更するのではなく、ローカライズ版に更新するユーザーが変更するため、ほとんどのユーザーが遭遇しない問題です。 – zambono