[foundation/usernotifications] Use NSString to preserve localization (#4697)

- Fixes #4694: NSString.GetLocalizedUserNotificationString not working with .stringsdict files
  (https://github.com/xamarin/xamarin-macios/issues/4694)
- Updated `UNNotificationCategory.FromIdentifier`'s iOS 12 overload to take a `NSString` category format to preserve localization.
- Change `GetLocalizedUserNotificationString` to only use NSString to preserve localization (similar fix to https://github.com/xamarin/xamarin-macios/pull/3266).
This commit is contained in:
Vincent Dondain 2018-08-27 10:07:36 -04:00 коммит произвёл GitHub
Родитель e51c2af9f8
Коммит f6c7a506f9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -105,5 +105,12 @@ namespace Foundation {
return _characterAtIndex (idx);
}
}
#if !XAMCORE_4_0 && !MONOMAC
[Obsolete ("Use 'GetLocalizedUserNotificationString' that takes 'NSString' to preserve localization.")]
public static string GetLocalizedUserNotificationString (string key, params NSObject[] arguments) {
return GetLocalizedUserNotificationString ((NSString) key, arguments);
}
#endif
}
}

Просмотреть файл

@ -8151,7 +8151,7 @@ namespace Foundation
[iOS (10,0), Watch (3,0), NoTV, Mac (10,14, onlyOn64: true)]
[Static]
[Export ("localizedUserNotificationStringForKey:arguments:")]
string GetLocalizedUserNotificationString (string key, [Params] [NullAllowed] NSObject [] arguments);
NSString GetLocalizedUserNotificationString (NSString key, [Params] [NullAllowed] NSObject [] arguments);
[Export ("getParagraphStart:end:contentsEnd:forRange:")]
void GetParagraphPositions (out nuint paragraphStartPosition, out nuint paragraphEndPosition, out nuint contentsEndPosition, NSRange range);

Просмотреть файл

@ -309,7 +309,7 @@ namespace UserNotifications {
[NoWatch, iOS (12,0)]
[Static]
[Export ("categoryWithIdentifier:actions:intentIdentifiers:hiddenPreviewsBodyPlaceholder:categorySummaryFormat:options:")]
UNNotificationCategory FromIdentifier (string identifier, UNNotificationAction[] actions, string[] intentIdentifiers, [NullAllowed] string hiddenPreviewsBodyPlaceholder, [NullAllowed] string categorySummaryFormat, UNNotificationCategoryOptions options);
UNNotificationCategory FromIdentifier (string identifier, UNNotificationAction[] actions, string[] intentIdentifiers, [NullAllowed] string hiddenPreviewsBodyPlaceholder, [NullAllowed] NSString categorySummaryFormat, UNNotificationCategoryOptions options);
[NoWatch, iOS (12, 0)]
[Export ("categorySummaryFormat")]