diff --git a/src/Foundation/NSLocale.cs b/src/Foundation/NSLocale.cs
index fd51e99efb29..a59c19bef047 100644
--- a/src/Foundation/NSLocale.cs
+++ b/src/Foundation/NSLocale.cs
@@ -27,216 +27,196 @@
//
//
-// Disable until we get around to enable + fix any issues.
-#nullable disable
+#nullable enable
namespace Foundation {
public partial class NSLocale {
- /// To be added.
- /// To be added.
- /// To be added.
- public string Identifier {
+ /// Gets the locale identifier string.
+ /// The locale identifier.
+ public string? Identifier {
get {
- return (string) (NSString) ObjectForKey (_Identifier);
+ return (string?) (NSString?) ObjectForKey (_Identifier);
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- /// To be added.
- public string GetIdentifierDisplayName (string value)
+ /// Gets the display name for the specified locale identifier.
+ /// The locale identifier.
+ /// The localized display name for the identifier, or if not available.
+ public string? GetIdentifierDisplayName (string value)
{
+ ArgumentNullException.ThrowIfNull (value);
return DisplayNameForKey (_Identifier, value);
}
- /// To be added.
- /// To be added.
- /// To be added.
- public string LanguageCode {
+ /// Gets the language code for the locale.
+ /// The language code.
+ public string? LanguageCode {
get {
- return (string) (NSString) ObjectForKey (_LanguageCode);
+ return (string?) (NSString?) ObjectForKey (_LanguageCode);
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- /// To be added.
- public string GetLanguageCodeDisplayName (string value)
+ /// Gets the display name for the specified language code.
+ /// The language code.
+ /// The localized display name for the language code, or if not available.
+ public string? GetLanguageCodeDisplayName (string value)
{
+ ArgumentNullException.ThrowIfNull (value);
return DisplayNameForKey (_LanguageCode, value);
}
- /// To be added.
- /// To be added.
- /// To be added.
- public string CountryCode {
+ /// Gets the country code for the locale.
+ /// The country code.
+ public string? CountryCode {
get {
- return (string) (NSString) ObjectForKey (_CountryCode);
+ return (string?) (NSString?) ObjectForKey (_CountryCode);
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- /// To be added.
- public string GetCountryCodeDisplayName (string value)
+ /// Gets the display name for the specified country code.
+ /// The country code.
+ /// The localized display name for the country code, or if not available.
+ public string? GetCountryCodeDisplayName (string value)
{
+ ArgumentNullException.ThrowIfNull (value);
return DisplayNameForKey (_CountryCode, value);
}
- /// To be added.
- /// To be added.
- /// To be added.
- public string ScriptCode {
+ /// Gets the script code for the locale.
+ /// The script code.
+ public string? ScriptCode {
get {
- return (string) (NSString) ObjectForKey (_ScriptCode);
+ return (string?) (NSString?) ObjectForKey (_ScriptCode);
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- public string VariantCode {
+ /// Gets the variant code for the locale.
+ /// The variant code.
+ public string? VariantCode {
get {
- return (string) (NSString) ObjectForKey (_VariantCode);
+ return (string?) (NSString?) ObjectForKey (_VariantCode);
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- public NSCharacterSet ExemplarCharacterSet {
+ /// Gets the exemplar character set for the locale.
+ /// The character set containing exemplar characters.
+ public NSCharacterSet? ExemplarCharacterSet {
get {
return ObjectForKey (_ExemplarCharacterSet) as NSCharacterSet;
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- public NSCalendar Calendar {
+ /// Gets the calendar for the locale.
+ /// The object associated with the locale.
+ public NSCalendar? Calendar {
get {
return ObjectForKey (_Calendar) as NSCalendar;
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- public string CollationIdentifier {
+ /// Gets the collation identifier for the locale.
+ /// The collation identifier.
+ public string? CollationIdentifier {
get {
- return (string) (NSString) ObjectForKey (_CollationIdentifier);
+ return (string?) (NSString?) ObjectForKey (_CollationIdentifier);
}
}
- /// To be added.
- /// To be added.
- /// To be added.
+ /// Gets a value indicating whether the locale uses the metric system.
+ /// if the locale uses the metric system; otherwise, .
public bool UsesMetricSystem {
get {
- return ((NSNumber) ObjectForKey (_UsesMetricSystem)).Int32Value != 0;
+ return (ObjectForKey (_UsesMetricSystem) as NSNumber)?.BoolValue == true;
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- public string MeasurementSystem {
+ /// Gets the measurement system for the locale.
+ /// The measurement system identifier.
+ public string? MeasurementSystem {
get {
- return (string) (NSString) ObjectForKey (_MeasurementSystem);
+ return (string?) (NSString?) ObjectForKey (_MeasurementSystem);
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- public string DecimalSeparator {
+ /// Gets the decimal separator for the locale.
+ /// The decimal separator character.
+ public string? DecimalSeparator {
get {
- return (string) (NSString) ObjectForKey (_DecimalSeparator);
+ return (string?) (NSString?) ObjectForKey (_DecimalSeparator);
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- public string GroupingSeparator {
+ /// Gets the grouping separator for the locale.
+ /// The grouping separator character used in numbers.
+ public string? GroupingSeparator {
get {
- return (string) (NSString) ObjectForKey (_GroupingSeparator);
+ return (string?) (NSString?) ObjectForKey (_GroupingSeparator);
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- public string CurrencySymbol {
+ /// Gets the currency symbol for the locale.
+ /// The currency symbol.
+ public string? CurrencySymbol {
get {
- return (string) (NSString) ObjectForKey (_CurrencySymbol);
+ return (string?) (NSString?) ObjectForKey (_CurrencySymbol);
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- public string CurrencyCode {
+ /// Gets the currency code for the locale.
+ /// The ISO 4217 currency code.
+ public string? CurrencyCode {
get {
- return (string) (NSString) ObjectForKey (_CurrencyCode);
+ return (string?) (NSString?) ObjectForKey (_CurrencyCode);
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- /// To be added.
- public string GetCurrencyCodeDisplayName (string value)
+ /// Gets the display name for the specified currency code.
+ /// The currency code.
+ /// The localized display name for the currency code, or if not available.
+ public string? GetCurrencyCodeDisplayName (string value)
{
+ ArgumentNullException.ThrowIfNull (value);
return DisplayNameForKey (_CurrencyCode, value);
}
- /// To be added.
- /// To be added.
- /// To be added.
- public string CollatorIdentifier {
+ /// Gets the collator identifier for the locale.
+ /// The collator identifier.
+ public string? CollatorIdentifier {
get {
- return (string) (NSString) ObjectForKey (_CollatorIdentifier);
+ return (string?) (NSString?) ObjectForKey (_CollatorIdentifier);
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- public string QuotationBeginDelimiterKey {
+ /// Gets the quotation begin delimiter for the locale.
+ /// The character or string used to begin a quotation.
+ public string? QuotationBeginDelimiterKey {
get {
- return (string) (NSString) ObjectForKey (_QuotationBeginDelimiterKey);
+ return (string?) (NSString?) ObjectForKey (_QuotationBeginDelimiterKey);
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- public string QuotationEndDelimiterKey {
+ /// Gets the quotation end delimiter for the locale.
+ /// The character or string used to end a quotation.
+ public string? QuotationEndDelimiterKey {
get {
- return (string) (NSString) ObjectForKey (_QuotationEndDelimiterKey);
+ return (string?) (NSString?) ObjectForKey (_QuotationEndDelimiterKey);
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- public string AlternateQuotationBeginDelimiterKey {
+ /// Gets the alternate quotation begin delimiter for the locale.
+ /// The character or string used to begin an alternate (nested) quotation.
+ public string? AlternateQuotationBeginDelimiterKey {
get {
- return (string) (NSString) ObjectForKey (_AlternateQuotationBeginDelimiterKey);
+ return (string?) (NSString?) ObjectForKey (_AlternateQuotationBeginDelimiterKey);
}
}
- /// To be added.
- /// To be added.
- /// To be added.
- public string AlternateQuotationEndDelimiterKey {
+ /// Gets the alternate quotation end delimiter for the locale.
+ /// The character or string used to end an alternate (nested) quotation.
+ public string? AlternateQuotationEndDelimiterKey {
get {
- return (string) (NSString) ObjectForKey (_AlternateQuotationEndDelimiterKey);
+ return (string?) (NSString?) ObjectForKey (_AlternateQuotationEndDelimiterKey);
}
}
}
diff --git a/src/foundation.cs b/src/foundation.cs
index 941be471e454..0d3c66dd191f 100644
--- a/src/foundation.cs
+++ b/src/foundation.cs
@@ -6952,9 +6952,11 @@ interface NSLocale : NSSecureCoding, NSCopying {
[Notification]
NSString CurrentLocaleDidChangeNotification { get; }
+ [return: NullAllowed]
[Export ("objectForKey:"), Internal]
NSObject ObjectForKey (NSString key);
+ [return: NullAllowed]
[Export ("displayNameForKey:value:"), Internal]
NSString DisplayNameForKey (NSString key, string value);
diff --git a/tests/xtro-sharpie/api-annotations-dotnet/common-Foundation.ignore b/tests/xtro-sharpie/api-annotations-dotnet/common-Foundation.ignore
index 2fcae0dca80a..d285ab995faf 100644
--- a/tests/xtro-sharpie/api-annotations-dotnet/common-Foundation.ignore
+++ b/tests/xtro-sharpie/api-annotations-dotnet/common-Foundation.ignore
@@ -1008,7 +1008,6 @@
!missing-null-allowed! 'Foundation.NSObject Foundation.NSKeyedArchiverDelegate::WillEncode(Foundation.NSKeyedArchiver,Foundation.NSObject)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSObject Foundation.NSKeyedUnarchiverDelegate::DecodedObject(Foundation.NSKeyedUnarchiver,Foundation.NSObject)' is missing an [NullAllowed] on parameter #1
!missing-null-allowed! 'Foundation.NSObject Foundation.NSKeyedUnarchiverDelegate::DecodedObject(Foundation.NSKeyedUnarchiver,Foundation.NSObject)' is missing an [NullAllowed] on return type
-!missing-null-allowed! 'Foundation.NSObject Foundation.NSLocale::ObjectForKey(Foundation.NSString)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSObject Foundation.NSMetadataItem::ValueForAttribute(System.String)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSObject Foundation.NSMetadataQuery::ValueOfAttribute(System.String,System.IntPtr)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSObject Foundation.NSMetadataQueryAttributeValueTuple::get_Value()' is missing an [NullAllowed] on return type
@@ -1027,7 +1026,6 @@
!missing-null-allowed! 'Foundation.NSOrthography Foundation.NSTextCheckingResult::get_Orthography()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSProgress Foundation.NSProgress::get_CurrentProgress()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSRegularExpression Foundation.NSRegularExpression::Create(Foundation.NSString,Foundation.NSRegularExpressionOptions,Foundation.NSError&)' is missing an [NullAllowed] on return type
-!missing-null-allowed! 'Foundation.NSString Foundation.NSLocale::DisplayNameForKey(Foundation.NSString,System.String)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSString Foundation.NSRunLoop::get_CurrentMode()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSString Foundation.NSString::AppendPathExtension(Foundation.NSString)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSString Foundation.NSUrlUtilities_NSString::CreateStringByAddingPercentEncoding(Foundation.NSString,Foundation.NSCharacterSet)' is missing an [NullAllowed] on return type